This repository has been archived by the owner on Dec 6, 2023. It is now read-only.
/
install
136 lines (121 loc) · 2.73 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
#!/bin/sh
# Name : Onex installer script
# Read about onex in README.md
set -e
logo="
/ _ \\| '_ \\ / _ \\ \\/ /
| (_) | | | | __/> <
\___/|_| |_|\\___/_/\_\\
"
# 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 [ `command -v sudo` ]; then
sudo="sudo"
else
sudo=""
fi
# checking for system package manager
if [ -e /data/data/com.termux/files/usr/bin/pkg ]; then
pac="pkg"
elif [ `command -v apt` ]; then
pac="apt"
elif [ `command -v apt-get` ]; then
pac="apt-get"
elif [ `command -v apk` ]; then
pac="apk"
elif [ `command -v dnf` ]; then
pac="dnf"
elif [ `command -v brew` ]; then
pac="brew"
sudo=""
fi
# setup process
clear
echo "$logo"
echo "Do you want to install onex ?? [yes/no]"
read a
if [ $a != "yes" ]; then exit;fi
echo " Installing ... "
sleep 0.5
# installing dependency
for each_pac in "curl" "wget" "git"; do
if [ ! `command -v $each_pac` ]; then
$sudo $pac install $each_pac -y
fi
done
# removing old one
if [ -e $bin/onex ]; then
if [ -d $conf_dir/onex ]; then
$sudo rm -rf $bin/onex
$sudo rm -rf $conf_dir/onex
fi
fi
# install onex
if [ $0 = "install" -o $0 = "./install" ]; then
if [ -e onex ]; then
$sudo mv -v onex $bin
$sudo chmod +x $bin/onex
fi
cd ..
if [ -d onex ]; then
$sudo mv -v onex $conf_dir
fi
else
if [ -e onex/onex ]; then
$sudo mv -v onex/onex $bin
$sudo chmod +x $bin/onex
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 command -v $bin/onex ; then
if [ -d $conf_dir/onex ]; then
clear
echo "$logo"
echo " Onex installed successfully !!"
echo " type 'onex -h' for more."
fi
else
clear
echo "$logo"
echo " Sorry: onex is not installed !!"
echo " Please try again"
echo " If you can't solve the problem, tell about your problem in: https://github.com/1RaY-1/onex/issues"
fi