-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshistmanager-code-remover
145 lines (136 loc) · 3.75 KB
/
shistmanager-code-remover
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/usr/bin/bash
# Confirm Uninstall - we don't want to see you go!
echo ""
while true; do
read -p "Do you wish to uninstall HistManagerBETA?(y/n) " yn
case $yn in
[Yy]* ) echo ""; break;;
[Nn]* ) echo ""; echo "Quiting HistManagerBETA uninstaller."; exit;;
* ) echo " invalid input";; #"Do you wish to install HistManagerBETA?(y/n) ";;
esac
done
# Starting Uninstall
echo "Uninstalling HistManagerBETA"
echo ""
# create multiple (hidden) backups, remove histmanager from terminal startup config
python3 ~/.khist/HistManager-Uninstall.py
{
sleep 0.5
printf "%s" "Removing HistManagerBETA from Terminal Startup Config"
sleep 0.5
printf "%s" " ."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" ". "
sleep 0.5
echo "[Done]"
sleep 0.5
} # Fancy Display
{
sleep 0.5
printf "%s" "Creating backup of Terminal History"
# as on $(date +%y-%m-%d)"
sleep 0.5
printf "%s" " ."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" ". "
sleep 0.5
echo "[Done]"
sleep 0.5
} # Fancy Display
# Restore Default History Management
mv ~/.khist/history/Master.khtxt ~/.bash_history
{
sleep 0.5
printf "%s" "Restoring original History Settings"
sleep 0.5
printf "%s" " ."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" ". "
sleep 0.5
echo "[Done]"
sleep 0.5
}
# Moving Error Logs
if [ $(wc -l < ~/.khist/errorlog.khtxt) -ge 2 ]; then
mv ~/.khist/errorlog.khtxt ~/HistErrorLogReport.khtxt
{
sleep 0.5
printf "%s" "Generating Error Logs from your past usage of HistManager"
sleep 0.5
printf "%s" " ."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" ". "
sleep 0.5
echo "[Done]"
sleep 0.5
}
fi
# Clean Up
mv ~/uninstall-histmanager.sh ~/.khist/uninstallfile_archived.sh
rm -rf ~/.khist/
{
sleep 0.5
printf "%s" "Deleting HistManagerBETA Data and Programs"
sleep 0.5
printf "%s" " ."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" ". "
sleep 1.5
echo "[Done]"
sleep 0.5
}
# GoodBye!
sleep 3
echo ""
echo "Successfully Uninstalled HistManagerBETA"
if [ -f ~/HistErrorLogReport.khtxt ]; then
sleep 0.5
echo ""
echo "HistManager uninstaller has generated an ErrorLogReport in your home directory."
sleep 0.5
echo "Please email it to histmanager@gmail.com so we can improve further versions of HistManager."
echo ""
# Should have an option to send mail directly, if mail, uuencode, mutt, metasend, or sendfile is installed.
# http://www.shelldorado.com/articles/mailattachments.html
# http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
fi
sleep 1
echo "Please restart the Terminal."
sleep 1
echo ""
exit
# HistManager - Effectively Manage Terminal History
# Copyright (C) 2016 Kaivalya Rawal (histmanager@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.