diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-18 13:08:19 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-18 13:08:19 (EDT) |
commit | 752fc2f1dc5c45a703ed5c822777e2bd1b4064a0 (patch) | |
tree | e6e65191cf287ccf533ff4944e5723b366a6cde0 /src | |
parent | 715ccf55c90a5d41444b5f8af455c56ff8b8e239 (diff) |
ob-gencontrol: Track md5sum additions with var, not head cmd
Diffstat (limited to 'src')
-rw-r--r-- | src/ob-gencontrol.sh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index c25fb89..79ea56c 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -169,20 +169,23 @@ gen_md5sums() { local binary="${1}" shift 1 + local has_data= local sum= local file= + has_data=false exec 3>"${binary}.control/md5sums" while read -r sum file; do case "${file}" in '-') continue;; esac file="${file#${binary}.data}" printf '%s %s\n' "${sum}" "${file}" >&3 + has_data=true done <<-EOF $(find "${binary}.data" -type f | sort | xargs md5sum) EOF exec 3>&- - if [ -z "$(head -n 1 "${binary}.control/md5sums")" ]; then + if ! ${has_data}; then rm -f -- "${binary}.control/md5sums" else chmod 644 "${binary}.control/md5sums" |