3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 case "$PACKER_BUILDER_TYPE" in
20 count
=$
(df
--sync -kP / |
tail -n1 |
awk -F ' ' '{print $4}')
22 dd if=/dev
/zero of
=/tmp
/whitespace bs
=1M count
=$count ||
echo "dd exit code $? is suppressed";
26 count
=$
(df
--sync -kP /boot |
tail -n1 |
awk -F ' ' '{print $4}')
28 dd if=/dev
/zero of
=/boot
/whitespace bs
=1M count
=$count ||
echo "dd exit code $? is suppressed";
32 swapuuid
="`/sbin/blkid -o value -l -s UUID -t TYPE=swap`";
39 if [ "x${swapuuid}" != "x" ]; then
40 # Whiteout the swap partition to reduce box size
41 # Swap is disabled till reboot
42 swappart
="`readlink -f /dev/disk/by-uuid/$swapuuid`";
43 /sbin
/swapoff
"$swappart";
44 dd if=/dev
/zero of
="$swappart" bs
=1M ||
echo "dd exit code $? is suppressed";
45 /sbin
/mkswap
-U "$swapuuid" "$swappart";