summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-06-16 17:42:33 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-06-16 17:42:33 (EDT)
commit9437b57a3ecff5b63daecb52858e040ebbe83448 (patch)
tree9407f161f6ec185b3f815f8a87d7a4f0855ecb5b /src
parentc24c900a2ae6c388ee74790a92b96f0d7c3a39d2 (diff)
ob-gencontrol: Move Installed-Size calculation into separate func
Diffstat (limited to 'src')
-rw-r--r--src/ob-gencontrol.sh30
1 files changed, 18 insertions, 12 deletions
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