-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathadd.repo
executable file
·282 lines (239 loc) · 6.9 KB
/
add.repo
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
#!/usr/bin/env bash
export PREFIX="/data/data/com.termux/files/usr"
export REPO_DIR=$"$PREFIX/etc/apt/sources.list.d/abhacker.repo.list"
export PACKAGE=$"${PREFIX}/share/gnupg"
export APT_DIR="${PREFIX}/etc/apt"
export SOURCES_LIST="${APT_DIR}/sources.list.d"
export PREFIX="${PREFIX}"
export PUB_DIR=$"$PREFIX/etc/apt/trusted.gpg"
export TERMUX=$(uname -o | grep -o "Android")
export ARCH=`dpkg --print-architecture`
export TMPDIR="${PREFIX}/tmp"
W="\e[38;2;255;255;255m"
O="\e[93m"
if [[ $TERMUX != *'Android'* ]];then
echo "Sorry, but your system doesn't support !"
# if you're removed that lines I don't know what happens to you !
exit 1
fi
# interrupter management
exit_on_signal_SIGINT () {
{ error=$(echo $?)
code[0]="^"
code[1]="~"
i=0
if [ ${error} -gt "0" ];then
printf "\n\e[91mProgram interrupted. with \e[0m‘${error}’\e[91m Code.\e[0m\n"
printf " "
printf "\e[1;92m${code[0]}"
else
printf "\n\e[91mProgram interrupted. with \e[0m‘${error}’\e[91m Code.\e[0m\n"
exit 0
fi
while [ $i -le ${#error} ]
do
printf "${code[1]}"
((i++))
done
printf "\e[0m\n" ;2>&1;}
exit 0
}
trap exit_on_signal_SIGINT SIGINT
connection() {
#wget -q --spider http://google.com
curl -Is http://www.google.com &> /dev/null
}
true() {
printf "\r\e[93m[Connecting to github.io]... "
}
false() {
printf "\r\e[93m[Connecting to github.io]... "
sleep 0.5
printf "\e[91m[Failed connect to github.io]...\n"
connection || printf "\e[91m); Connection error code : $?\n"
}
connections() {
connection
if [[ $? -eq 0 ]];then
connection | true
else
connection | false
exit
fi
}
connections
if [ ! -e "${SOURCES_LIST}" ]; then
mkdir -p "${SOURCES_LIST}"
fi
#if [ -z "${TMPDIR}" ]; then
# TMPDIR="${PREFIX}/tmp"
#fi
if [ ! -e "${TMPDIR}" ]; then
mkdir -p "${TMPDIR}"
fi
if [ ! -d "$PACKAGE" ];then
echo -e "\nInstalling dependencies..."
apt update ; apt upgrade -y ; apt install gnupg -y
fi
# Download signed key
sleep 0.1
printf "\r\e[93m[Connecting to github.io]... "
sleep 0.6
printf "[Connected to github.io]..."
sleep 0.3
echo -en "\033[?25l"
printf "\r\e[93m "
echo -en "\033[?12l\033[?25h"
printf "\rRetrieving informations [${W}${ARCH}${O}]..."
sleep 0.3
grep -q "[email protected]" $PUB_DIR &> /dev/null
if [ $? != 0 ]; then
sleep 0.4
echo -en "\033[?25l"
printf "\r\e[93m "
echo -en "\033[?12l\033[?25h"
printf "\r\e[93mAdding Public GPG Key [${W}${ARCH}${O}]... "
curl -fsSL https://abhackerofficial.github.io/abhacker.repo/abhacker.repo.key | apt-key add &> /dev/null &
printf "OK"
fi
if [ ! -f "$PREFIX/etc/raw_keys" ];then
mkdir -p ${PREFIX}/etc/raw_keys
fi
if [ ! -f "$PREFIX/etc/raw_keys/abhacker.repo.key" ];then
curl -fsSL https://github.com/abhackerofficial/abhacker.repo/raw/master/abhacker.repo.key | cat &> ${PREFIX}/etc/raw_keys/abhacker.repo.key &
fi
get1=`curl -fsSL https://github.com/abhackerofficial/abhacker.repo/raw/master/abhacker.repo.key | awk NR==3 &`
get2=`cat $PREFIX/etc/raw_keys/abhacker.repo.key | awk NR==3`
if [[ ${get1} != ${get2} ]];then
sleep 0.4
echo -en "\033[?25l"
printf "\r\e[93m "
echo -en "\033[?12l\033[?25h"
printf "\r\e[93mAdding Public GPG Key [${W}${ARCH}${O}]... "
curl -fsSL https://github.com/abhackerofficial/abhacker.repo/raw/master/abhacker.repo.key | cat &> ${PREFIX}/etc/raw_keys/abhacker.repo.key &
curl -fsSL https://github.com/abhackerofficial/abhacker.repo/raw/master/abhacker.repo.key | apt-key add &> /dev/null
printf "OK"
else
printf "\r\e[93mPublic GPG Key Already exists [${W}${ARCH}${O}]..."
fi
aarch64_architecture()
{
printf "# abhacker's repository\ndeb [arch=all,aarch64] https://abhackerofficial.github.io/abhacker.repo/ abhacker main" > "${SOURCES_LIST}/abhacker.repo.list"
}
arm_architecture()
{
printf "# abhacker's repository\ndeb [arch=all,arm] https://abhackerofficial.github.io/abhacker.repo/ abhacker main" > "${SOURCES_LIST}/abhacker.repo.list"
}
i686_architecture()
{
printf "# abhacker's repository\ndeb [arch=all,i686] https://abhackerofficial.github.io/abhacker.repo/ abhacker main" > "${SOURCES_LIST}/abhacker.repo.list"
}
x86_64_architecture()
{
printf "# abhacker's repository\ndeb [arch=all,x86_64] https://abhackerofficial.github.io/abhacker.repo/ abhacker main" > "${SOURCES_LIST}/abhacker.repo.list"
}
# abhacker's repository
if [ -f "$REPO_DIR" ];then
sleep 0.5
printf "\r\e[93mABHacker's Repository Already exists [${W}${ARCH}${O}]..."
else
printf "\r\e[93mAdding ABHacker's Repository [${W}${ARCH}${O}]... "
sleep 0.5
printf "OK"
case "$ARCH" in
aarch64)
aarch64_architecture
;;
arm)
arm_architecture
;;
armhf)
arm_architecture
;;
i686)
i686_architecture
;;
x86_64)
x86_64_architecture
;;
esac
fi
sleep 0.7
printf "\r\e[93mUpdating Termux emulator [${W}${ARCH}${O}]... \n\e[0m"
apt-get update
echo -e "\e[94mInstall package : apt install <pkg> ..."
echo -e "GitHub help page : https://github.com/abhackerofficial/abhacker.repo\e[0m"
# arguments management
if [[ ${1} == "--update" || ${1} == "-u" ]];then
if [[ ${#2} -gt "0" ]];then
apt upgrade "${@:2}"
exit
fi
elif [[ ${1} == "--list" || ${1} == "-l" ]];then
list() {
apt list | grep -a "abhacker" | head -n -0
}
printf "`list`\n" | cut -d ":" -f 2
exit
elif [[ ${1} == "--show" || ${1} == "-s" ]];then
if [[ ${#2} -gt "0" ]];then
apt search "${@:2}"
exit
fi
elif [[ ${1} == "--remove" || ${1} == "-r" ]];then
if [[ ${#2} -gt "0" ]];then
apt autoremove "${@:2}"
exit
fi
elif [[ ${1} == "--addon" || ${1} == "-a" ]];then
if [[ ${2} == "http://"* || ${2} == "https://"* ]];then
printf "\n\e[93mGetting your Program !...\n\e[0m"
bash <(curl -fsSL "${2}") ${@:3}
echo -e "\e[93mProgram Ended with \e[0m‘${?}’ \e[93mCode.\n\e[0m"
exit
else
echo -e "\e[92mInvalid Url Address : \e[91m${2}\e[0m"
exit
fi
elif [[ ${1} == "--eval" || ${1} == "-e" ]];then
if [[ ${2} == "eval"* ]];then
printf "\n\e[93mGetting your Program !...\n\e[0m"
eval ${@:3}
echo -e "\e[93mProgram Ended with \e[0m‘${?}’ \e[93mCode.\n\e[0m"
else
echo -e "\e[92mInvalid ‘eval’ script : \e[91m${2}\e[0m"
fi
fi
function arguments() {
for i in "${arry[@]}" ; do
((++control))
if [ "$i" = "--run" ]; then
break
fi
if [ ! "$i" = "--install" ]; then
package+=($i)
fi
done
for ((i=$control; i<$MAXLEN; i++)); do
((++control))
if [ ${arry[$i]} = "--run" ]; then
break
fi
command+=(${arry[$i]})
done
if [[ ${#package[@]} -gt "0" ]];then
apt install -y ${package[@]}
fi
if [[ ${#command[@]} -gt "0" ]];then
${command[@]}
fi
}
arry=("$@")
if [ ! ${arry[0]} = "--install" ]; then
exit
fi
package=()
command=()
control=0
MAXLEN=$#
arguments