summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ob-gencontrol.sh17
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>&-