This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathuninstall.sh
executable file
·76 lines (66 loc) · 1.96 KB
/
uninstall.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
set -e -E -u -o pipefail
cd "$(dirname "$0")"
PLIST="$HOME/Library/LaunchAgents/com.dziemba.mobymac.plist"
function main() {
echo "==========="
echo " mobymac "
echo " UNINSTALL "
echo "==========="
echo
echo "WARNING: this will uninstall mobymac and destroy all existing docker data"
echo "Press CTRL-C to abort (sleeping for 5 seconds)"
sleep 5
echo
echo "=== Checking for mobymac updates (set MOBYMAC_NO_UPDATES=1 to skip)..."
if [ -z "${MOBYMAC_NO_UPDATES-}" ]; then
git fetch
if [ "$(git rev-list HEAD...origin/master --count)" -ne 0 ]; then
echo "==> Updates available - please 'git pull', then run the uninstaller again."
exit 2
fi
echo "==> OK"
else
echo "==> Skipping"
fi
echo
echo "=== Removing mobymac/docker-machine VMs..."
for VM in default mobymac; do
if VBoxManage showvminfo "$VM" &>/dev/null; then
echo "=== Shut down and destroy: '$VM'"
VBoxManage controlvm "$VM" poweroff || true
sleep 10
VBoxManage unregistervm "$VM" --delete
else
echo "=== No VM with name: '$VM'"
fi
done
echo "=== Remaining VMs (please clean up manually if needed):"
VBoxManage list vms
echo "==> OK"
echo
echo "=== Removing vagrant state..."
rm -rf .vagrant Vagrantfile
echo "==> OK"
echo
echo "=== Removing all NFS mounts on host..."
echo "=== NOTE: sudo will be required to edit /etc/exports and restart NFS server"
echo |sudo tee /etc/exports
nfsd checkexports
sudo nfsd restart
echo "==> OK"
echo
echo "=== Removing mobymac launch-at-login plist..."
rm -f "$PLIST"
echo "==> OK"
echo
echo "=== Removing docker host env from shell config..."
for FILE in "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/fish/config.fish"; do
sed -i -e '/^# mobymac-begin/{N;N;d;}' "$FILE"
done
echo "==> OK"
echo
echo "=== Uninstalled successfully!"
echo "=== Please re-open all your terminal windows to complete the process."
}
main