diff options
-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" |