diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-18 17:34:25 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-18 17:34:25 (EDT) |
commit | 92548d7de28f7adc0d4a513c8eb2ed3d45519c10 (patch) | |
tree | 987d62273339d58357469a8ce9c01f0f083758ba | |
parent | 074116d05238cd67fa02f4e9a688647ced52f138 (diff) |
ob-gencontrol: Don't run find on non-existent dirs
-rw-r--r-- | src/ob-gencontrol.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index c2eb61b..181a279 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -28,8 +28,8 @@ gen_control() local desc="${5}" local gen_rel="${6}" shift 6 - local sizes= local inst_size= + local sizes= local size= local name= local value= @@ -43,12 +43,14 @@ gen_control() # <http://pubs.opengroup.org/onlinepubs/9699919799/utilities/du.html> # <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=630533> # <https://www.gnu.org/software/coreutils/manual/html_node/du-invocation.html> - sizes="$(find "${binary}.data" -type f -exec wc -c '{}' ';' | \ - cut -d ' ' -f 1)" inst_size=0 - for size in ${sizes}; do - inst_size=$((${inst_size} + ${size})) - done + if [ -d "${binary}.data" ]; then + sizes="$(find "${binary}.data" -type f -exec wc -c '{}' ';' | \ + cut -d ' ' -f 1)" + for size in ${sizes}; do + inst_size=$((${inst_size} + ${size})) + done + fi # Convert bytes to kibibytes and round up. # Note: There is an inconsistency between the Debian Policy Manual and # opkg in the units of this field. Debian Policy defines this field in @@ -183,7 +185,8 @@ gen_md5sums() printf '%s %s\n' "${sum}" "${file}" >&3 has_data=true done <<-EOF - $(find "${binary}.data" -type f | sort | xargs md5sum) + $(find "${binary}.data" -type f 2>/dev/null | sort | \ + xargs md5sum) EOF exec 3>&- |