-
Notifications
You must be signed in to change notification settings - Fork 2
/
uninstall.sh
executable file
·30 lines (23 loc) · 1.12 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
#!/bin/bash
source $(dirname "$0")/lib.sh
[ ! -z "$HOME" ] && pushd $HOME 2>&1 >/dev/null || die "Unable to cd to \$HOME (\"$HOME\")"
remove_line "$HOME/.profile" $'# MANAGED \.tools: .profile$'
remove_line "$HOME/.bash_profile" $'# MANAGED \.tools: .bash_profile$'
remove_line "$HOME/.bashrc" $'# MANAGED \.tools: .bashrc$'
for SOURCE_PATH in $CONFIGFILES; do
test_path "$SOURCE_PATH" ".*/\.$" && continue
test_path "$SOURCE_PATH" ".*/\.\.$" && continue
test_path "$SOURCE_PATH" ".*/\.DS_Store$" && continue
test_path "$SOURCE_PATH" ".*/\.git$" && continue # Don't bother with .git
test_path "$SOURCE_PATH" ".*/\.gitignore$" && continue # Don't bother with .gitignore
test_path "$SOURCE_PATH" ".*/\.gitmodules$" && continue # Don't bother with .gitmodules
test_path "$SOURCE_PATH" ".*/\..*.sw.$" && continue
BASE_FNAME="$HOME/$(basename "$SOURCE_PATH")"
if [[ -h $BASE_FNAME ]]; then
TARGET_PATH=$($READLINK $BASE_FNAME)
if [[ $? == 1 || $TARGET_PATH == $($READLINK "$SOURCE_PATH") ]]; then
rm -v $BASE_FNAME
fi
fi
done
popd 2>&1 >/dev/null