diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-09-23 15:56:25 -0700 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-11 18:33:35 -0700 |
| commit | e7d2d6d8a72a2e32f331c1ae4e1ee8511e460cee (patch) | |
| tree | b23d59fb0d8e50a64e8e1d8915d4237ff560987c | |
| parent | Configure cpus for openbsd image build dynamically (diff) | |
| download | site-server-images-e7d2d6d8a72a2e32f331c1ae4e1ee8511e460cee.zip | |
Add prompt to remove build directory if it exists
If the build directory exists, the packer build will abort.
| -rwxr-xr-x | build-openbsd-image.sh | 14 |
1 files changed, 14 insertions, 0 deletions
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" \ |