-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.sh
executable file
·51 lines (43 loc) · 1.28 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
#!/bin/bash
DIR=$(dirname "$(readlink -f "$0")")
# running as root?
[ "$(id -u)" == "0" ] && ROOT=true
# bashrc
if [ "$(readlink -f ~/.bashrc)" == "$DIR/bashrc" ] && [ -f ~/.bashrc.backup ]; then
echo 'Restoring' ~/.bashrc.backup '->' ~/.bashrc
rm ~/.bashrc &&
mv ~/.bashrc.backup ~/.bashrc
else
echo 'Error:' ~/.bashrc 'symlink or' ~/.bashrc.backup 'not found.' >&2
echo 'Error: NOT removing' ~/.bashrc >&1
fi
# inputrc
if [ "$(readlink -f ~/.inputrc)" == "$DIR/inputrc" ]; then
echo 'Removing symlink' ~/.inputrc "-> $DIR/inputrc"
rm ~/.inputrc
else
echo 'Error:' ~/.inputrc 'not found.' >&2
fi
# todo remove in the future; see also install.sh
# bash_completion
if [ "$(readlink -f ~/.bash_completion)" == "$DIR/bash_completion" ]; then
echo 'Removing symlink' ~/.bash_completion "-> $DIR/bash_completion"
rm ~/.bash_completion
else
echo 'Error:' ~/.bash_completion 'not found.' >&2
fi
# vimrc
if [ $ROOT ]; then
if [ "$(readlink -f /etc/vim/vimrc)" == "$DIR/vimrc" ]; then
echo 'Restoring /etc/vim/vimrc.backup -> /etc/vim/vimrc'
rm /etc/vim/vimrc &&
mv /etc/vim/vimrc.backup /etc/vim/vimrc
else
echo 'Error: /etc/vim/vimrc not found.' >&2
fi
fi
# bashrc.local
[ -f ~/.bashrc.local ] && echo && rm -i ~/.bashrc.local
echo
echo "To completly remove bash-pack, run: rm -rf $DIR"
echo