From e7d2d6d8a72a2e32f331c1ae4e1ee8511e460cee Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Wed, 23 Sep 2026 15:56:25 -0700 Subject: Add prompt to remove build directory if it exists If the build directory exists, the packer build will abort. --- build-openbsd-image.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build-openbsd-image.sh b/build-openbsd-image.sh index 17f2145..faa6bc1 100755 --- a/build-openbsd-image.sh +++ b/build-openbsd-image.sh @@ -18,6 +18,20 @@ export PACKER_LOG=1 main() ( parse_args "$@" cd openbsd-image/ + if [ -d build/ ]; then + printf 'Build directory exists. Must delete before re-building. Proceed? (y/N)' + read -r answer + case $answer in + [yY]) + echo "Removing build/.." + rm -r build/ + ;; + *) + echo "Aborting.." + exit 0 + ;; + esac + fi packer init . packer build \ -only "qemu.openbsd-$ARCH" \ -- cgit v1.2.3