-
Notifications
You must be signed in to change notification settings - Fork 86
/
uninstall.sh
executable file
·67 lines (60 loc) · 1.51 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
#!/usr/bin/env bash
export check="\xE2\x9C\x94"
export cross="\xE2\x9D\x8C"
command=$1
if [[ ! $command =~ native|web ]]; then
printf "\nSelect which version you would want to uninstall:\n\n"
select command in web native
do
if [[ $command =~ native|web ]]; then
echo $command
break
else
echo "Please input 1 or 2"
fi
done
fi
uninstall_prep() {
export install_dir
export shortcut_dir
export exec_dir
local share_dir
share_dir="/usr/share"
if [[ -d ${share_dir}/lotion ]]; then
install_dir="${share_dir}/lotion-$command"
shortcut_dir="${share_dir}/applications"
exec_dir="/usr/bin"
else
install_dir="$(pwd)/Lotion-$command"
shortcut_dir="$HOME/.local/share/applications"
exec_dir="$HOME/.local/bin"
fi
}
delete_directory() {
if [[ -d "${install_dir}" ]]; then
rm -Rf "${install_dir}" || exit
echo -e "${check} ${install_dir} was successfully deleted."
else
echo -e "${cross} ${install_dir} directory was not found. Skipping."
fi
}
if [[ $command == 'web' ]]; then
shortcut_file=Lotion.desktop
else
shortcut_file=Notion_native.desktop
fi
delete_files() {
declare -a files
files=("${shortcut_dir}/${shortcut_file}" "${exec_dir}/lotion-$command" "${exec_dir}/lotion_uninstall")
for file in "${files[@]}"; do
if [[ -f "${file}" ]]; then
rm "${file}" || exit
echo -e "${cross} ${file} was successfully deleted."
else
echo -e "${cross} ${file} was not found. Skipping."
fi
done
}
uninstall_prep
delete_directory
delete_files