From 953050d634d2842c904f8549226585e65b9181aa Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 18 Mar 2019 12:54:10 -0400 Subject: ob-gencontrol: Use read loop instead of sed with var in RE --- (limited to 'src') 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 -- cgit v0.9.1