mirror of
https://github.com/elasticdog/packer-arch.git
synced 2026-01-23 02:14:40 +00:00
It takes some time to write zeros to the disk and it aborts later if less than 20GB are available. Add variable to the template, cleanup script and add a new option to wrapacker.
14 lines
435 B
Bash
Executable file
14 lines
435 B
Bash
Executable file
#!/usr/bin/bash -x
|
|
|
|
# Clean the pacman cache.
|
|
echo ">>>> cleanup.sh: Cleaning pacman cache.."
|
|
/usr/bin/pacman -Scc --noconfirm
|
|
|
|
# Write zeros to improve virtual disk compaction.
|
|
if [[ $WRITE_ZEROS == "true" ]]; then
|
|
echo ">>>> cleanup.sh: Writing zeros to improve virtual disk compaction.."
|
|
zerofile=$(/usr/bin/mktemp /zerofile.XXXXX)
|
|
/usr/bin/dd if=/dev/zero of="$zerofile" bs=1M
|
|
/usr/bin/rm -f "$zerofile"
|
|
/usr/bin/sync
|
|
fi
|