diff options
-rw-r--r-- | src/ob-gencontrol.sh | 30 |
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 |