From 92548d7de28f7adc0d4a513c8eb2ed3d45519c10 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 18 Mar 2019 17:34:25 -0400 Subject: ob-gencontrol: Don't run find on non-existent dirs --- (limited to 'src') 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() # # # - 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>&- -- cgit v0.9.1