-
Notifications
You must be signed in to change notification settings - Fork 2
/
installer
executable file
·225 lines (219 loc) · 12.9 KB
/
installer
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#!/bin/bash
# batnotify installer - made by Gabubu
# Checking for root
if whoami | grep -q 'root'; then
# If oppened as root
# Languages menu
CHOICE=$(whiptail --backtitle "Made by Gabubu" --title "batnotify installer" --menu "Welcome!/Bun venit!/Bienvenue!" 10 55 0\
"English" "| Choose if you speak this language" \
"Romana" "| Alege daca vorbesti aceasta limba" \
"Francais" "| Choisissez si vous parlez le francais" 3>&1 1>&2 2>&3)
# Romanian menu
if [ $CHOICE = "Romana" ]; then
whiptail --backtitle "Made by Gabubu" --title "batnotify installer" --textbox "readme/readme_ro" 13 80
while true; do
CHOICE=$(whiptail --backtitle "Facut de Gabubu" --title "batnotify installer" --menu "Cu ce vrei sa incepi?" 10 55 0\
"Instalare" "| Instaleaza batnotify" \
"Dezinstalare" "| Dezinstaleaza batnotify" \
"Inchidere" "| Inchide installer-ul" 3>&1 1>&2 2>&3)
if [ $CHOICE = "Instalare" ]; then
if whiptail --backtitle "Facut de Gabubu" --title "batnotify installer" --yesno "Doresti sa instalati?" 7 30; then
if which beep > /dev/null && echo $? | grep -q "0"; then
COUNTER=0
while [[ ${COUNTER} -le 100 ]]; do
sleep 1
COUNTER=$(($COUNTER+10))
sleep 1
COUNTER=$(($COUNTER+10))
sleep 1
COUNTER=$(($COUNTER+10))
cd src/
sleep 1
COUNTER=$(($COUNTER+20))
chmod +x batnotify_ro
sleep 1
COUNTER=$(($COUNTER+20))
cp batnotify_ro /bin/batnotify
sleep 1
COUNTER=$(($COUNTER+20))
modprobe pcspkr
COUNTER=$(($COUNTER+10))
sleep 2
echo ${COUNTER}
done | whiptail --gauge "Se instaleaza batnotify" 6 50 ${COUNTER}
whiptail --msgbox "Instalat cu succes. Ce trebuie sa faci este ca batnotify sa se deschida automat si asta e tot. Acum urmeaza un mic ghid sa intelegi cum functioneaza ;)" 8 80
beep -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n
whiptail --msgbox "Aceasta sunet o sa cante cand bateria este la 15%. Apasa OK pentru a continua." 8 80
beep -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100
whiptail --msgbox "Aceasta sunet o sa cante cand bateria este la 10%. Apasa OK pentru a continua." 8 80
beep -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100
whiptail --msgbox "Aceasta sunet o sa cante cand bateria este la 5%. Apasa OK pentru a continua." 8 80
beep -f 300 -D 150 -l 300 -n -f 250 -D 150 -l 300 -n -f 200 -l 1250
whiptail --msgbox "Aceasta sunet o sa cante cand bateria este la 3%. Asta a fost tot." 8 80
whiptail --msgbox "In timp ce acele beep-uri canta, o sa primiti si notificari." 8 80
whiptail --msgbox "Iti multumesc ca ai instalat. Sper sa iti placa ce am facut :-)" 8 80
else
whiptail --backtitle "Facut de Gabubu" --title "batnotify installer - EROARE" --msgbox "Nu ai instalat beep. Instaleaza acum!" 8 80
fi
else
beep
fi
elif [ $CHOICE = "Dezinstalare" ]; then
if whiptail --backtitle "Facut de Gabubu" --title "batnotify installer" --yesno "Doresti sa dezinstalezi?" 7 30; then
whiptail --gauge "Se dezinstaleaza batnotify" 6 50 0 &
sleep 1
whiptail --gauge "Se dezinstaleaza batnotify" 6 50 50 &
sleep 1
whiptail --gauge "Se dezinstaleaza batnotify" 6 50 75 &
rm /bin/batnotify
sleep 1
whiptail --gauge "Se dezinstaleaza batnotify" 6 50 100 &
sleep 1
whiptail --msgbox "Dezinstalat cu succes." 7 80
else
beep
fi
else
exit
fi
done
# English menu
elif [ $CHOICE = "English" ]; then
whiptail --backtitle "Made by Gabubu" --title "batnotify installer" --textbox "readme/readme_en" 13 80
while true; do
CHOICE=$(whiptail --backtitle "Made by Gabubu" --title "batnotify installer" --menu "What you want to start with?" 10 55 0\
"Install" "| Install batnotify" \
"Uninstall" "| Uninstall batnotify" \
"Exit" "| Close the installer" 3>&1 1>&2 2>&3)
if [ $CHOICE = "Install" ]; then
if whiptail --backtitle "Made by Gabubu" --title "batnotify installer" --yesno "Do you want to install?" 7 30; then
if which beep > /dev/null && echo $? | grep -q "0"; then
COUNTER=0
while [[ ${COUNTER} -le 100 ]]; do
sleep 1
COUNTER=$(($COUNTER+10))
sleep 1
COUNTER=$(($COUNTER+10))
sleep 1
COUNTER=$(($COUNTER+10))
cd src/
COUNTER=$(($COUNTER+20))
chmod +x batnotify_en
COUNTER=$(($COUNTER+20))
cp batnotify_en /bin/batnotify
COUNTER=$(($COUNTER+20))
modprobe pcspkr
COUNTER=$(($COUNTER+10))
sleep 2
echo ${COUNTER}
done | whiptail --gauge "Installing batnotify" 6 50 ${COUNTER}
whiptail --msgbox "Installed with success. What you need to do is to autostart-up this software and done. Now it's comming a small guide to understand how it works ;)" 8 80
beep -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n
whiptail --msgbox "This sound will play at 15%. Press OK to continue." 8 80
beep -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100
whiptail --msgbox "This sound will play at 10%. Press OK to continue." 8 80
beep -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100
whiptail --msgbox "This sound will play at 5%. Press OK to continue." 8 80
beep -f 300 -D 150 -l 300 -n -f 250 -D 150 -l 300 -n -f 200 -l 1250
whiptail --msgbox "This sound will play at 3%. Press OK to continue." 8 80
whiptail --msgbox "While playing these beeps you'll receive notifications too." 8 80
whiptail --msgbox "Thanks for installing. I hope you'll like what i've made :-)" 8 80
else
whiptail --backtitle "Made by Gabubu" --title "batnotify installer - ERROR" --msgbox "You don't have beep installed. Install now!" 8 80
fi
else
beep
fi
elif [ $CHOICE = "Uninstall" ]; then
if whiptail --backtitle "Made by Gabubu" --title "batnotify installer" --yesno "Do you want to uninstall?" 7 30; then
whiptail --gauge "Uninstalling batnotify" 6 50 0 &
sleep 1
whiptail --gauge "Uninstalling batnotify" 6 50 50 &
sleep 1
whiptail --gauge "Uninstalling batnotify" 6 50 75 &
rm /bin/batnotify
sleep 1
whiptail --gauge "Uninstalling batnotify" 6 50 100 &
sleep 1
whiptail --msgbox "Uninstalled with success." 7 80
else
beep
fi
else
exit
fi
done
# French menu
elif [ $CHOICE = "Francais" ]; then
whiptail --backtitle "Made by Gabubu" --title "batnotify installer" --textbox "readme/readme_fr" 13 80
while true; do
CHOICE=$(whiptail --backtitle "Création par Gabubu" --title "batnotify installer" --menu "Par quoi vous voulez commencer?" 10 55 0\
"Installe" "| Installe batnotify" \
"Deinstalle" "| Deinstalle batnotify" \
"Quitter" "| Quittez L'installeur" 3>&1 1>&2 2>&3)
if [ $CHOICE = "Installe" ]; then
if whiptail --backtitle "Création par Gabubu" --title "batnotify installer" --yesno "Vous voulez qu'on installe?" 7 33; then
if which beep > /dev/null && echo $? | grep -q "0"; then
COUNTER=0
while [[ ${COUNTER} -le 100 ]]; do
sleep 1
COUNTER=$(($COUNTER+10))
sleep 1
COUNTER=$(($COUNTER+10))
sleep 1
COUNTER=$(($COUNTER+10))
cd src/
COUNTER=$(($COUNTER+20))
chmod +x batnotify_fr
COUNTER=$(($COUNTER+20))
cp batnotify_fr /bin/batnotify
COUNTER=$(($COUNTER+20))
modprobe pcspkr
COUNTER=$(($COUNTER+10))
sleep 2
echo ${COUNTER}
done | whiptail --gauge "Installation de Batnotify" 6 50 ${COUNTER}
whiptail --msgbox "Installe avec succes. Vous avez qu'a auto-demarrer ce program et fini. Maintenant un guide pour montrer comment ca marche ;)" 8 80
beep -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n
whiptail --msgbox "Ce bruit vas se jouer quant votre batterie est 15%. Appuyez sur Ok pour continuer." 8 80
beep -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100
whiptail --msgbox "Ce bruit vas se jouer quant votre batterie est 10%. Appuyez sur Ok pour continuer." 8 80
beep -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100 -n -f 500 -D 1 -l 100 -n -f 300 -D 100 -l 100
whiptail --msgbox "Ce bruit vas se jouer quant votre batterie est 5%. Appuyez sur Ok pour continuer." 8 80
beep -f 300 -D 150 -l 300 -n -f 250 -D 150 -l 300 -n -f 200 -l 1250
whiptail --msgbox "Ce bruit vas se jouer quant votre batterie est 3%. Appuyez sur Ok pour continuer." 8 80
whiptail --msgbox "En jouant ces beeps, on n'envoie des notifications aussi. :)" 8 80
whiptail --msgbox "Merci pour installer batnotify, j'espere que vous aimais mon travail :-)" 8 80
else
whiptail --backtitle "Création par Gabubu" --title "batnotify installer - ERREUR" --msgbox "Vous n'avez pas beep installe. Installe le maintenant!" 8 80
fi
else
beep
fi
elif [ $CHOICE = "Deinstalle" ]; then
if whiptail --backtitle "Création par Gabubu" --title "batnotify installer" --yesno "Vous voulez Deinstalle?" 7 30; then
whiptail --gauge "Deinstallation de batnotify" 6 50 0 &
sleep 1
whiptail --gauge "Deinstallation de batnotify" 6 50 50 &
sleep 1
whiptail --gauge "Deinstallation de batnotify" 6 50 75 &
rm /bin/batnotify
sleep 1
whiptail --gauge "Deinstallation de batnotify" 6 50 100 &
sleep 1
whiptail --msgbox "Desinstallation avec succes." 7 80
else
beep
fi
else
exit
fi
done
# End of installer
else
exit
fi
# If not openned as root
else
whiptail --backtitle "Made by Gabubu" --title "batnotify installer" --msgbox "Please, run the installer as root." 7 38
fi