-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·27 lines (23 loc) · 840 Bytes
/
uninstall.sh
File metadata and controls
executable file
·27 lines (23 loc) · 840 Bytes
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
#!/usr/bin/env bash
INSTALL_NAME="annote"
INSTALLED_BIN="$(which "$INSTALL_NAME" 2> /dev/null)"
if [ -n "$INSTALLED_BIN" ]; then
rm -f "$INSTALLED_BIN"
HOME_DIR="$(realpath ~)/.config/annote"
CONF_FILE="$HOME_DIR/annote.config"
VIMRC_FILE="$HOME_DIR/vimrc"
if [ -f "$VIMRC_FILE" ]; then
rm $VIMRC_FILE
fi
if [ -d "$HOME_DIR" ] && [ -f "$CONF_FILE" ]; then
DB_DIR="$(cat "$CONF_FILE" | sed -e 's/^\s\+//' | grep "^db_loc" | cut -d= -f2- | sed -e 's/^\s\+//' -e 's/\s\+$//')"
rm -f "$CONF_FILE"
rmdir "$HOME_DIR" 2> /dev/null
if [ -n "$DB_DIR" ]; then
echo "db is configured at '$DB_DIR', remove if not required."
fi
echo "Done uninstalling."
fi
else
echo "'$INSTALL_NAME' is not installed, or is not in your '\$PATH' locations."
fi