-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
36 lines (29 loc) · 1.39 KB
/
uninstall.sh
File metadata and controls
36 lines (29 loc) · 1.39 KB
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
#!/usr/bin/env bash
# This script uninstalls sysupdate
# set terminal font color
TEXT_YELLOW="$(tput bold)$(tput setaf 3)"
TEXT_GREEN="$(tput bold)$(tput setaf 2)"
TEXT_RESET="$(tput sgr0)"
# confirm and remove
echo ""
read -n1 -s -r -p "$(echo -e $TEXT_YELLOW'Remove <sysupdate> command? [y/n]'$TEXT_RESET)"$'\n' choice
case "$choice" in
y|Y ) # notify start
echo -e "\n${TEXT_YELLOW}Uninstalling <sysupdate> command... ${TEXT_RESET}\n" && sleep 1
# remove alias
if grep -q "alias sysupdate='bash ~/.update.sh'" ~/.bashrc ; then sed -i '/alias sysupdate=/d' ~/.bashrc ; fi
if grep -q "alias rupdate='sudo Rscript ~/.update.R'" ~/.bashrc ; then sed -i '/alias rupdate=/d' ~/.bashrc ; fi
if grep -q "alias pyupdate='bash ~/.conda_update.sh'" ~/.bashrc ; then sed -i '/alias pyupdate=/d' ~/.bashrc ; fi
sleep 1
# remove shell scripts
[ -f ~/.update.R ] && rm ~/.update.R
[ -f ~/.update.sh ] && rm ~/.update.sh
[ -f ~/.conda_update.sh ] && rm ~/.conda_update.sh
[ -f ~/.shortcut.sh ] && rm ~/.shortcut.sh
[ -f ~/.size-restore.sh ] && rm ~/.size-restore.sh
sleep 1
# notify end
echo -e "${TEXT_GREEN}<sysupdate> command removed! Please reopen the terminal. ${TEXT_RESET}\n";;
* ) # notify end
echo -e "\n${TEXT_GREEN}<sysupdate> command not removed. ${TEXT_RESET}\n";;
esac