-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathuninstall.sh
executable file
·67 lines (56 loc) · 1.42 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
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR
if [ "$(uname)" == "Darwin" ]; then
function realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
fi
while getopts "c:p:" flag
do
case "${flag}" in
p) prefix=$(realpath ${OPTARG});;
\?) echo "usage: $0 [-p PREFIX]" && exit 1;;
esac
done
if ! [ -f install.options ]; then
echo "install.sh: [!] Missing 'install.options'."
exit 1
fi
source install.options
function uninstall {
yes | rm ${bin_dir}/yed || exit 1
echo "Uninstalled ${bin_dir}/yed"
yes | rm -rf ${lib_dir}/libyed.so ${lib_dir}/libyed.so.dSYM || exit 1
echo "Uninstalled ${lib_dir}/libyed.so"
yes | rm -rf ${inc_dir}/yed || exit 1
echo "Uninstalled ${inc_dir}/yed"
yes | rm -rf ${share_dir}/yed || exit 1
echo "Uninstalled ${share_dir}/yed"
yes | rm -rf ${plug_dir} || exit 1
echo "Uninstalled ${plug_dir}"
}
function confirm {
echo "The following files/directories will be removed:
${bin_dir}/yed
${lib_dir}/libyed.so
${inc_dir}/yed
${share_dir}/yed
${plug_dir}
"
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case "$response" in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
if confirm; then
uninstall
else
echo "Uninstall cancelled."
fi