-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.sh
executable file
·115 lines (87 loc) · 3.15 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
# Run: ./uninstall.sh
while [[ ! -d ./.git/ && ! -d ./files/ && ! -d ./src/ ]]; do
if [[ "$PWD" == "/" ]]; then
echo "Repository root not found"
exit 1
fi
if ! cd ..; then
echo "An error occurred while doing 'cd ..'"
exit 1
fi
done
source ./src/remotes/_vars_colors.sh
# Go clean: golangci-lint cache clean ; sudo rm -rf "$(go env GOPATH)/pkg" ; go clean -x -cache -modcache -testcache -fuzzcache
function uninstall() {
set -o errexit
trap exit-error-message ERR SIGINT
source ./src/remotes/_required_commands.sh
if [[ "$(uname -s)" == "Linux" ]]; then
required-commands curl cargo
required-sudo-commands snap apt
elif [[ "$(uname -s)" == "Darwin" ]]; then
required-commands brew curl cargo
fi
echo -en "$fgcolor_white_bold"
echo "[Uninstaller]: - Uninstalling alacritty, vim, neovim and lunarvim..."
echo -en "$fgcolor_yellow_bold"
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `install.sh` has finished
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2>/dev/null &
echo -e "${fgcolor_white_bold}[Uninstaller]: ${fgcolor_green_bold}Privileges for uninstallation obtained"
echo -en "$fgcolor_reset"
echo -en "$fgcolor_white_bold"
echo "[Uninstaller]: - ... Phase 1/3"
if [[ "$(uname -s)" == "Linux" ]]; then
sudo apt remove -y --purge alacritty vim neovim fzf &>/dev/null
sudo snap remove --purge zsh &>/dev/null
sudo snap remove --purge tmux &>/dev/null
sudo snap remove --purge alacritty &>/dev/null
sudo snap remove --purge vim-editor &>/dev/null
sudo snap remove --purge nvim &>/dev/null
elif [[ "$(uname -s)" == "Darwin" ]]; then
brew uninstall alacritty neovim fzf &>/dev/null
fi
echo "[Uninstaller]: - ... Phase 2/3"
cargo uninstall alacritty &>/dev/null || :
bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/uninstall.sh) &>/dev/null || :
rm -rf ~/.config/lvim || :
echo "[Uninstaller]: - ... Phase 3/3"
echo -e "[Uninstaller]: - ${fgcolor_green_bold}... Ready!${fgcolor_white_bold}"
echo
echo "[Uninstaller]: - Deleting configuration files and caches..."
rm -rf ~/.config/lvim &>/dev/null
rm -rf ~/.config/nvim &>/dev/null
rm -rf ~/.local/share/nvim &>/dev/null
rm -rf ~/.local/share/lunarvim &>/dev/null
rm -rf ~/.local/share/lvim &>/dev/null
rm -rf ~/.local/bin/lvim &>/dev/null
rm -rf ~/.cache/nvim &>/dev/null
rm -rf ~/.cache/tmux &>/dev/null
rm -rf ~/.cache/nvim.bak &>/dev/null
rm -rf ~/.config/alacritty &>/dev/null
rm -rf ~/.tmux &>/dev/null
golangci-lint cache clean &>/dev/null
echo "[Uninstaller]: - ... Phase 1/1"
echo -e "[Uninstaller]: - ${fgcolor_green_bold}... Ready!${fgcolor_white_bold}"
echo
echo -e "[Uninstaller]: ${fgcolor_green_bold}✔️ Uninstallation is complete${fgcolor_white_bold}"
echo -en "$fgcolor_reset"
echo
}
function exit-error-message() {
echo -e "$(
cat <<EOF
${fgcolor_white_bold}[Uninstaller Error]: ---
[Uninstaller Error]: ${fgcolor_red_bold}The installation had an error and was interrupted, the installation was not completed.${fgcolor_white_bold}
[Uninstaller Error]: ---${fgcolor_reset}
EOF
)"
exit 1
}
uninstall "$@"