diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-18 12:54:10 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-18 13:05:28 (EDT) |
commit | 953050d634d2842c904f8549226585e65b9181aa (patch) | |
tree | 96a112587a669cda494d732a2dc9d6b600af8878 | |
parent | 10ba6f0d61625818bf19f32226de71d6d0c02070 (diff) |
ob-gencontrol: Use read loop instead of sed with var in RE
-rw-r--r-- | src/ob-gencontrol.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index d13c991..4a6e943 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -169,10 +169,18 @@ gen_md5sums() { local binary="${1}" shift 1 + local sum= + local file= + + exec 3>"${binary}.control/md5sums" + while read -r sum file; do + file="${file#${binary}.data}" + printf '%s %s\n' "${sum}" "${file}" >&3 + done <<-EOF + $(find "${binary}.data" -type f | sort | xargs md5sum) + EOF + exec 3>&- - find "${binary}.data" -type f | sort | xargs md5sum | \ - sed "s@ ${binary}.data@ @" \ - >"${binary}.control/md5sums" if [ -z "$(head -n 1 "${binary}.control/md5sums")" ]; then rm -f -- "${binary}.control/md5sums" else |