forked from ikipro/aos
-
Notifications
You must be signed in to change notification settings - Fork 2
/
delete-vbox-vm
executable file
·40 lines (30 loc) · 919 Bytes
/
delete-vbox-vm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
## Copyright (C) 2012 - 2021 ENCRYPTED SUPPORT LP <[email protected]>
## See the file COPYING for copying conditions.
set -x
set -e
true "INFO: Currently running script: $BASH_SOURCE $@"
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$MYDIR/pre"
source "$MYDIR/colors"
source "$MYDIR/variables"
main() {
## Turning off the VM without saving.
sudo $SUDO_OPTS VBoxManage controlvm "$VMNAME" poweroff || true
sync
## Delete old Whonix-Gateway.
sudo $SUDO_OPTS VBoxManage unregistervm "$VMNAME" --delete || true
sync
## The "VBoxManage unregistervm --delete" does not do its job,
## we have to manually delete the VM folder.
if [ -d "$HOMEVAR/VirtualBox VMs/$VMNAME" ]; then
rm -r "$HOMEVAR/VirtualBox VMs/$VMNAME"
fi
sync
## Delete old ova.
if [ -e "$binary_image_ova" ]; then
rm "$binary_image_ova"
fi
sync
}
main "$@"