Skip to content

Commit

Permalink
Incorrect calculation of block count
Browse files Browse the repository at this point in the history
Block count were returned based of KB, but blocks of 1MB were written !

Signed-off-by: Damien Gustave <delovan@gmail.com>
  • Loading branch information
DeLoWaN authored and martintamare committed Nov 17, 2020
1 parent a691150 commit c6db01a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packer_templates/_common/minimize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ case "$PACKER_BUILDER_TYPE" in
esac

# Whiteout root
count=$(df --sync -kP / | tail -n1 | awk -F ' ' '{print $4}')
count=$(($count-1))
count=$(df --sync -kP / | tail -n1 | awk -F ' ' '{printf("%d",($4-1)/1024-1)}')
dd if=/dev/zero of=/tmp/whitespace bs=1M count=$count || echo "dd exit code $? is suppressed";
rm /tmp/whitespace

# Whiteout /boot
count=$(df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}')
count=$(($count-1))
count=$(df --sync -kP /boot | tail -n1 | awk -F ' ' '{printf("%d",($4-1)/1024-1)}')
dd if=/dev/zero of=/boot/whitespace bs=1M count=$count || echo "dd exit code $? is suppressed";
rm /boot/whitespace

Expand Down

0 comments on commit c6db01a

Please sign in to comment.