-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathuninstall.sh
executable file
·37 lines (28 loc) · 1018 Bytes
/
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
#!/bin/bash
source src/utils/global.sh 2>>.log
if [[ $(grep -c "alias up=" ~/.bashrc) -lt 1 ]]; then
puts GREEN "Nothing to uninstall $CHECKMARK"
exit 0
fi
puts RED "Uninstall: starting"
sed -i "/alias up=/d" ~/.bashrc 2>>.log
puts LOGO "Alias 'up' removed"
# Get favourite terminal
TERMINAL=$(cat src/utils/.cache | head -n 2 | tail -n 1)
# Remove cronjob, if it exists (and if the user can)
if [[ $(grep -c "utils/privileges" $(dirname "$(readlink -f "$0")")/src/utils/.cache) -gt 0 && $(crontab -l | grep -c "eMerger/update.sh") -gt 0 ]]; then
sudo crontab -u $USER -l | grep -v "eMerger/update.sh" | sudo crontab -u $USER -
puts LOGO "Cronjob successfully removed"
fi
# Remove .cache and .md5
rm -f src/utils/.cache 2>>.log
rm -f src/utils/.md5 2>>.log
puts GREEN "Uninstall: completed $SAD"
if [[ $TERMINAL == "unknown" ]]; then
exec bash
exit 0
else
read -p "$(echo -e ${RED}Press enter, this process will be killed${NORMAL})"
$TERMINAL 2>>.log
kill -9 $PPID
fi