forked from MasterScott/onex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
224 lines (212 loc) · 4.62 KB
/
install
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
#!/bin/sh
# Name : Onex
# Date : 24 November 2019
# Description : onex is a hacking tools installer and package manager for hacker's.
logo="\033[01;33m
___ _ __ ___\033[01;31m__ __
\033[01;33m / _ \\| '_ \\ / _ \033[01;31m\\ \\/ /
\033[01;33m| (_) | | | | __/\033[01;31m> <
\033[01;33m \___/|_| |_|\\___\033[01;31m/_/\_\\
"
# checking for system home dir
if [ -d $HOME ]; then
home=$HOME
else
home="~/"
fi
# checking for system bin dir
if [ -d /data/data/com.termux/files/usr/bin ]; then
bin="/data/data/com.termux/files/usr/bin"
elif [ -d /usr/local/bin ]; then
bin="/usr/local/bin"
elif [ -d /bin ]; then
bin="/bin"
elif [ -d /sbin ]; then
bin="/sbin"
fi
# checking for configuration dir
if [ -d /data/data/com.termux/files/usr/etc ]; then
conf_dir="/data/data/com.termux/files/usr/etc"
elif [ -d /etc ]; then
conf_dir="/etc"
fi
# configuration files
if [ -d $conf_dir/onex ]; then
if [ -e $conf_dir/onex/data/tools.dat ]; then
tools_data="$conf_dir/onex/data/tools.dat"
fi
if [ -e $conf_dir/onex/data/category.dat ]; then
category_data="$conf_dir/onex/data/category.dat"
fi
else
if [ -e data/tools.dat ]; then
tools_data="data/tools.dat"
fi
if [ -e data/category.dat ]; then
category_data="data/category.dat"
fi
fi
# checking for system root access
if [ -e /usr/lib/sudo ]; then
sudo="sudo"
elif [ -e /usr/bin/sudo ]; then
sudo="sudo"
elif [ -e /usr/sbin/sudo ]; then
sudo="sudo"
elif [ -e /lib/sudo ]; then
sudo="sudo"
elif [ -e /bin/sudo ]; then
sudo="sudo"
elif [ -e /sbin/sudo ]; then
sudo="sudo"
elif [ -e /data/data/com.termux/files/usr/bin/sudo ]; then
sudo="sudo"
else
sudo=""
fi
# checking for system package manager
if [ -e /bin/apt ]; then
pac="apt-get"
system="linux"
elif [ -e /bin/apt-get ]; then
pac="apt-get"
system="linux"
elif [ -e /usr/bin/apt-get ]; then
pac="apt-get"
system="linux"
elif [ -e /sbin/apt-get ]; then
pac="apt-get"
system="linux"
elif [ -e /usr/sbin/apt-get ]; then
pac="apt-get"
system="linux"
elif [ -e /bin/apk ]; then
pac="apk"
system="linux"
elif [ -e /usr/bin/apk ]; then
pac="apk"
system="linux"
elif [ -e /sbin/apk ]; then
pac="apk"
system="linux"
elif [ -e /usr/sbin/apk ]; then
pac="apk"
system="linux"
elif [ -e /bin/yum ]; then
pac="yum"
system="fedora"
elif [ -e /usr/bin/yum ]; then
pac="yum"
system="fedora"
elif [ -e /sbin/yum ]; then
pac="yum"
system="fedora"
elif [ -e /usr/sbin/yum ]; then
pac="yum"
system="fedora"
elif [ -e /usr/local/bin/brew ]; then
pac="brew"
system="mac"
sudo=""
elif [ -e /data/data/com.termux/files/usr/bin/pkg ]; then
pac="pkg"
system="termux"
elif [ -e /data/data/com.termux/files/usr/bin/apt ]; then
pac="apt"
system="termux"
elif [ -e /data/data/com.termux/files/usr/bin/apt-get ]; then
pac="apt-get"
system="termux"
fi
# setup process
clear
echo "$logo"
echo "\033[01;32m Installing .... \033[00m"
sleep 1
echo "\033[01;33m Running setup .... \033[00m"
sleep 1
# installing dependency
if [ ! -e $bin/wget ]; then
if [ $sudo ]; then
$sudo $pac install wget -y
else
$pac install wget -y
fi
fi
if [ ! -e $bin/curl ]; then
if [ $sudo ]; then
$sudo $pac install curl -y
else
$pac install curl -y
fi
fi
if [ ! -e $bin/git ]; then
if [ $sudo ]; then
$sudo $pac install git -y
else
$pac install git -y
fi
fi
# removing old one
if [ -e $bin/onex ]; then
if [ -d $conf_dir/onex ]; then
if [ $sudo ]; then
$sudo rm -rf $bin/onex
$sudo rm -rf $conf_dir/onex
else
rm -rf $bin/onex
rm -rf $conf_dir/onex
fi
fi
fi
# install onex
if [ $0 = "install" -o $0 = "./install" ]; then
if [ -e onex ]; then
if [ $sudo ]; then
$sudo mv -v onex $bin
$sudo chmod +x $bin/onex
else
mv -v onex $bin
chmod +x $bin/onex
fi
fi
cd ..
if [ -d onex ]; then
if [ $sudo ]; then
$sudo mv -v onex $conf_dir
else
mv -v onex $conf_dir
fi
fi
else
if [ -e onex/onex ]; then
if [ $sudo ]; then
$sudo mv -v onex/onex $bin
$sudo chmod +x $bin/onex
else
mv -v onex/onex $bin
chmod +x $bin/onex
fi
fi
if [ -d onex ]; then
if [ $sudo ]; then
$sudo mv -v onex $conf_dir
else
mv -v onex $conf_dir
fi
fi
fi
# check onex is installed or not
if [ -e $bin/onex ]; then
if [ -d $conf_dir/onex ]; then
clear
echo "$logo"
echo " \033[00mOnex \033[01;32minstalled successfully !!"
echo " \033[01;32mtype \033[00m'onex -h'\033[01;32m for more.\033[00m"
else
clear
echo "$logo"
echo " \033[01;31mSorry \033[00m: onex \033[01;31mis not installed !!"
echo " \033[01;32mPlease try again\033[00m"
fi
fi