Skip to content

Commit

Permalink
Revert "Incorrect calculation of block count"
Browse files Browse the repository at this point in the history
  • Loading branch information
tas50 authored and martintamare committed Nov 17, 2020
1 parent c6db01a commit 62e7c18
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packer_templates/_common/minimize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ case "$PACKER_BUILDER_TYPE" in
esac

# Whiteout root
count=$(df --sync -kP / | tail -n1 | awk -F ' ' '{printf("%d",($4-1)/1024-1)}')
count=$(df --sync -kP / | tail -n1 | awk -F ' ' '{print $4}')
count=$(($count-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 ' ' '{printf("%d",($4-1)/1024-1)}')
count=$(df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}')
count=$(($count-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 62e7c18

Please sign in to comment.