From 238b70bfbcd4069951a622cf7834933876955cd6 Mon Sep 17 00:00:00 2001 From: Sheldon Hearn Date: Mon, 19 Oct 2015 23:39:25 +0200 Subject: [PATCH] Support swapless builders in minimize.sh The blkid utility returns exit status 2 when the requested label can't be found. --- scripts/common/minimize.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/common/minimize.sh b/scripts/common/minimize.sh index 379e0f5de..1ca88bee9 100644 --- a/scripts/common/minimize.sh +++ b/scripts/common/minimize.sh @@ -4,7 +4,13 @@ case "$PACKER_BUILDER_TYPE" in qemu) exit 0 ;; esac +set +e swapuuid="`/sbin/blkid -o value -l -s UUID -t TYPE=swap`"; +case "$?" in + 2|0) ;; + *) exit 1 ;; +esac +set -e if [ "x${swapuuid}" != "x" ]; then # Whiteout the swap partition to reduce box size