-
Notifications
You must be signed in to change notification settings - Fork 1
/
update-histmanager.sh
173 lines (158 loc) · 5.38 KB
/
update-histmanager.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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/usr/bin/bash
# Display Welcome Message
echo ""
echo "Welcome to HistManagerBETA Updater"
echo "===================================="
echo "checking if python3 is installed on this system"
# Systems Check
if $(python3 -V | grep -q 'Python 3'); then # if python3 version command runs successfully -> python3 must be installed
sleep 1
echo "[python3 functional]"
sleep 0.5
echo ""
else # Quit if python3 unavailable
echo ""
sleep 1
echo "Python3 is not installed on this system."
sleep 1
echo "Please install python3, and then re-run the HistManager updater."
sleep 1
echo "===============ERROR================"
echo "Quitting Installer."
exit 1
fi
# Confirm Update
while true; do
read -p "Do you wish to update HistManagerBETA? (y/n) " yn
case $yn in
[Yy]* ) echo ""; break;;
[Nn]* ) echo ""; echo "Quiting HistManagerBETA installer."; exit;;
* ) echo " invalid input";; #"Do you wish to install HistManagerBETA?(y/n) ";;
esac
done
# Stage is Set, Begin!
echo "Updating HistManagerBETA - report any errors to [email protected]"
sleep 1
echo ""
cp ~/.bash_history ~/MasterHistoryBackup_20$(date +%y-%m-%d_%H':'%M':'%S).txt
{
sleep 0.5
printf "%s" "Creating backup of Master History"
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!
echo '{"underline": "\u001b[4m", "hmagenta": "\u001b[45m", "bhcyan": "\u001b[106m", "magenta": "\u001b[35m", "hgreen": "\u001b[42m", "bhyellow": "\u001b[103m", "bwhite": "\u001b[97m", "bhgreen": "\u001b[102m", "blue": "\u001b[34m", "hwhite": "\u001b[47m", "bgreen": "\u001b[92m", "byellow": "\u001b[93m", "bcyan": "\u001b[96m", "hcyan": "\u001b[46m", "black": "\u001b[30m", "bold": "\u001b[1m", "bhblue": "\u001b[104m", "white": "\u001b[37m", "yellow": "\u001b[33m", "bmagenta": "\u001b[95m", "PFORMAT": "", "bhblack": "\u001b[100m", "hred": "\u001b[41m", "hblue": "\u001b[44m", "hyellow": "\u001b[43m", "bblack": "\u001b[90m", "bhmagenta": "\u001b[105m", "bhwhite": "\u001b[107m", "normal": "\u001b[0m", "EMPHASIS": "\u001b[1m", "red": "\u001b[31m", "hblack": "\u001b[40m", "cyan": "\u001b[36m", "INFORMAT": "\u001b[33m", "bred": "\u001b[91m", "COMMENTARY": "\u001b[34m", "bhred": "\u001b[101m", "green": "\u001b[32m", "bblue": "\u001b[94m", "ERRFORMAT": "\u001b[31m"}' > ~/.khist/styles.hmconfig
{
sleep 0.5
printf "%s" "Updating the 'khist' Directory"
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
}
echo "\nHistManagerBETA 2.0(update) ErrorLog\n" >> ~/.khist/errorlog.khtxt
mv ~/histmanager-code ~/.khist/HistManager.py
{
sleep 1
printf "%s" "Updating HistManager to version 2.0"
sleep 0.5
printf "%s" " ."
sleep 1
printf "%s" "."
sleep 1
printf "%s" "."
sleep 1
printf "%s" ". "
sleep 0.5
echo "[Done]"
sleep 0.5
}
mv ~/update-histmanager.sh ~/.khist/updatefile2.0_archived.sh
{
sleep 1
printf "%s" "Deleting Updater Files"
sleep 0.5
printf "%s" " ."
sleep 0.5
printf "%s" "."
sleep 0.5
printf "%s" "."
sleep 1
printf "%s" ". "
sleep 0.5
echo "[Done]"
sleep 0.5
}
# ReConfigure Terminal Startup
welmes="HistManagerBETA 2.0 running."
{
{
echo "printf 'W'"
#echo "sleep 0.5"
echo "printf 'e'"
#echo "sleep 0.5"
echo "printf 'l'"
#echo "sleep 0.5"
echo "printf 'c'"
#echo "sleep 0.5"
echo "printf 'o'"
#echo "sleep 0.5"
echo "printf 'm'"
#echo "sleep 0.5"
echo "printf 'e'"
#echo "sleep 0.5"
echo "echo '.'"
#echo "sleep 0.5"
} # Fancy Display, for HistManager.sh - upon every startup!
echo "echo $welmes"
echo "echo ------------------------------------"
echo "echo "
echo "python3 ~/.khist/HistManager.py"
echo "echo "
echo "echo ------------------------------------"
echo "sleep 1.1"
echo "clear"
echo ""
echo "# HistManager - Effectively Manage Terminal History"
echo "# Copyright (C) 2016 Kaivalya Rawal ([email protected])"
echo "# You should have received a copy of the GNU Affero General Public License"
echo "# along with this program. If not, see <http://www.gnu.org/licenses/>."
} > ~/.khist/histmanager.sh
# Say your Goodbyes!
sleep 3
echo ""
sleep 1
echo "Updation successful, please restart the terminal to start using HistManagerBETA 2.0"
echo ""
sleep 1
exit
# HistManager - Effectively Manage Terminal History
# Copyright (C) 2016 Kaivalya Rawal ([email protected])
#
# 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/>.