1
1

Add --purge to reset.sh

This commit is contained in:
Derek Smith 2023-03-19 13:49:37 -04:00
parent 9e7d9d3a90
commit 1fdf96bfa2
Signed by: farscapian
GPG Key ID: B443E530A14E1C90
2 changed files with 49 additions and 28 deletions

View File

@ -10,7 +10,7 @@ if lxc remote get-default | grep -q "local"; then
exit 1
fi
echo "WARNING: This will DESTROY any existing VMs!"
echo "WARNING: This will DESTROY any existing VMs! Use the --purge flag to delete ALL Sovereign Stack LXD resources."
RESPONSE=
read -r -p "Are you sure you want to continue (y/n): ": RESPONSE

View File

@ -4,6 +4,23 @@
set -e
cd "$(dirname "$0")"
PURGE_LXD=false
# grab any modifications from the command line.
for i in "$@"; do
case $i in
--purge)
PURGE_LXD=true
shift
;;
*)
echo "Unexpected option: $1"
exit 1
;;
esac
done
source ../defaults.sh
./destroy.sh
@ -27,6 +44,9 @@ if ! lxc info | grep -q "project: default"; then
lxc project delete "$CURRENT_PROJECT"
fi
if [ "$PURGE_LXD" = true ]; then
if lxc profile show default | grep -q "root:"; then
lxc profile device remove default root
fi
@ -63,3 +83,4 @@ if ! lxc remote get-default | grep -q "local"; then
echo "INFO: The remote '$CURRENT_REMOTE' has been removed! You are now controlling your local instance."
fi
fi