From 9437b57a3ecff5b63daecb52858e040ebbe83448 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 16 Jun 2019 17:42:33 -0400 Subject: ob-gencontrol: Move Installed-Size calculation into separate func --- diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index 87eab3a..49fecf4 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -19,21 +19,13 @@ set -eu -gen_control() +calc_inst_size() { local binary="${1}" - local version="${2}" - local arch="${3}" - local plat="${4}" - local desc="${5}" - local gen_rel="${6}" - shift 6 + shift 1 local inst_size= local sizes= local size= - local name= - local value= - local homepage= # Calculate installed size. # Don't use du, since that considers the allocated size of files, @@ -67,7 +59,21 @@ gen_control() # opkg checks for 10 MiB of available space. # TODO: Further investigate opkg's disk space calculation and, if # necessary, patch opkg and submit a bug report. - inst_size=$(((${inst_size} + 1023) / 1024)) + printf '%d' $(((${inst_size} + 1023) / 1024)) +} + +gen_control() +{ + local binary="${1}" + local version="${2}" + local arch="${3}" + local plat="${4}" + local desc="${5}" + local gen_rel="${6}" + shift 6 + local name= + local value= + local homepage= mkdir -p -- "${binary}.control" @@ -116,7 +122,7 @@ gen_control() fi cat >>"${binary}.control/control" <<-EOF - Installed-Size: ${inst_size} + Installed-Size: $(calc_inst_size "${binary}") Description:$(printf '%s' "${desc}" | sed 's/^/ /') EOF -- cgit v0.9.1