Skip to content

Commit

Permalink
Use GB rather than GiB for size
Browse files Browse the repository at this point in the history
It's not exactly a nitpick. debos uses github.com/docker/go-units to
parse the size, and docker/go-units is fundamentally broken, as it
parses both GiB anb GB as GB. It's a known issue that's been there
forever, and will probably never be fixed because backward compat
(that's my guess).

Cf. <docker/go-units#31>, or better
<docker/go-units#27 (comment)>.

So let's make sure that we talk about GB, because that's what happens in
practice.
  • Loading branch information
elboulangero committed Jun 23, 2022
1 parent 1fa6089 commit bb1c955
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Options:
-b BRANCH Kali branch used to build the image, default: $BRANCH
-d DESKTOP Desktop environment installed in the image, default: $DESKTOP
-m MIRROR Mirror used to build the image, default: $MIRROR
-s SIZE Size of the disk image created in GiB, default: $SIZE
-s SIZE Size of the disk image created in GB, default: $SIZE
-t TYPE Type of image to build (see below for details), default: $TYPE
-v VERSION Release version of Kali, defaults: ${BRANCH#kali-}
Expand Down Expand Up @@ -89,8 +89,8 @@ echo $SUPPORTED_DESKTOPS | grep -qw $DESKTOP \
echo $SUPPORTED_TYPES | grep -qw $TYPE \
|| fail "Unsupported type '$TYPE'"

[[ $SIZE =~ ^[0-9]+$ ]] && SIZE=${SIZE}GiB \
|| fail "Size must be given in GiB and must contain only digits"
[[ $SIZE =~ ^[0-9]+$ ]] && SIZE=${SIZE}GB \
|| fail "Size must be given in GB and must contain only digits"
[ "$VERSION" ] || VERSION=${BRANCH#kali-}

# Print a summary of the build options
Expand Down

0 comments on commit bb1c955

Please sign in to comment.