From 752fc2f1dc5c45a703ed5c822777e2bd1b4064a0 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 18 Mar 2019 13:08:19 -0400 Subject: ob-gencontrol: Track md5sum additions with var, not head cmd --- 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" -- cgit v0.9.1