-
Notifications
You must be signed in to change notification settings - Fork 215
/
install
189 lines (178 loc) · 3.8 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
#!/bin/sh
# onex v0.1
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/_/\_\\
"
if [ -d $HOME ]; then
home=$HOME
else
home="~/"
fi
if [ -d /data/data/com.termux/files/usr/bin ]; then
bin="/data/data/com.termux/files/usr/bin"
elif [ -d /usr/bin ]; then
bin="/usr/bin"
elif [ -d /bin ]; then
bin="/bin"
fi
if [ -d /data/data/com.termux/files/usr/etc ]; then
conf_dir="/data/data/com.termux/files/usr/etc"
elif [ -d /usr/etc ]; then
conf_dir="/usr/etc"
elif [ -d /etc ]; then
conf_dir="/etc"
fi
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
if [ -e /usr/lib/sudo ]; then
sudo="sudo"
elif [ -e /usr/bin/sudo ]; then
sudo="sudo"
elif [ -e /lib/sudo ]; then
sudo="sudo"
elif [ -e /bin/sudo ]; then
sudo="sudo"
elif [ -e /data/data/com.termux/files/usr/bin/sudo ]; then
sudo="sudo"
else
sudo=""
fi
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 /bin/yum ]; then
pac="yum"
system="fedora"
elif [ -e /usr/bin/yum ]; then
pac="yum"
system="fedora"
elif [ -e /bin/brew ]; then
pac="brew"
system="mac"
elif [ -e /usr/bin/brew ]; then
pac="brew"
system="mac"
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