*--min-pkg-size <size>*::
Minimal size of the package file in bytes to be considered for delta creation.
- Default value: 1048576 bytes = 1MiB
+ Default value: 1048576 bytes = 1MiB. This may be any absolute size in bytes, or
+ a human readable value such as `4 MiB` or `3.5MB`.
*-q, \--quiet*::
Be quiet. Do not output anything but warnings and errors.
echo
printf -- "$(gettext "Options:\n")"
printf -- "$(gettext " -q, --quiet minimize output\n")"
- printf -- "$(gettext " --min-pkg-size minimum package size before deltas are generated (bytes)\n")"
- printf -- "$(gettext " --max-delta-size percent of package size above which deltas will be discarded\n")"
+ printf -- "$(gettext " --min-pkg-size minimum package size before deltas are generated\n")"
+ printf -- "$(gettext " --max-delta-size percent of new package above which the delta will be discarded\n")"
}
version() {
There is NO WARRANTY, to the extent permitted by law.\n")"
}
+m4_include(library/human_to_size.sh)
+
isnumeric() {
[[ $1 != *[!0-9]* ]]
}
-q|--quiet)
QUIET=1;;
--min-pkg-size)
- if ! isnumeric "$2"; then
+ if ! min_pkg_size=$(human_to_size "$2"); then
echo "invalid argument '$2' for option -- '$1'"
exit 1
fi
- min_pkg_size=$2
shift ;;
--max-delta-size)
- arg=$(echo "$2" | awk '{print $1 * 100}')
- if ! isnumeric "$arg" || (($arg > 200)); then
+ arg=$(awk -v val="$2" 'BEGIN { print val * 100 }')
+ if ! isnumeric "$arg" || (( arg > 200 )); then
echo "invalid argument '$2' for option -- '$1'"
exit 1
fi