forked from coredamage/phonia
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
208 lines (188 loc) · 4.58 KB
/
install.sh
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
#!/bin/bash
# MIT License
# Copyright (C) 2019, Entynetproject. All Rights Reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
N="\033[1;37m"
C="\033[0m"
CE="\033[0m"
RS="\033[1;31m"
YS="\033[1;33m"
BS="-e \033[34m"
R="\033[31m"
if [[ $EUID -ne 0 ]]
then
sleep 1
echo -e "["$RS"*"$CE"] "$RS"This script must be run as "$YS"root"$C"" 1>&2
sleep 1
exit
fi
if [[ -d ~/phonia ]]
then
cd ~/phonia/bin
{
cp phonia /usr/local/bin
chmod +x /usr/local/bin/phonia
cp phonia /bin
chmod +x /bin/phonia
cp phonia /data/data/com.termux/files/usr/bin
chmod +x /data/data/com.termux/files/usr/bin/phonia
} &> /dev/null
else
cd ~
{
git clone https://github.com/entynetproject/phonia.git
cd ~/phonia/bin
cp phonia /usr/local/bin
chmod +x /usr/local/bin/phonia
cp phonia /bin
chmod +x /bin/phonia
cp phonia /data/data/com.termux/files/usr/bin
chmod +x /data/data/com.termux/files/usr/bin/phonia
} &> /dev/null
fi
sleep 0.5
clear
sleep 0.5
echo
cd ~/phonia
cat banner/banner.txt
echo
if [[ -f /etc/phonia.conf ]]
then
CONF="$( cat /etc/phonia.conf )"
sleep 1
if [[ "$CONF" = "arm" ]]
then
if [[ -d /System/Library/CoreServices/SpringBoard.app ]]
then
echo ""$BS"Installing dependencies..."$CE""
else
echo ""$BS"Installing dependencies..."$CE""
pkg update
pkg -y install python3
pkg -y install python3-pip
pkg -y install wget
fi
fi
if [[ "$CONF" = "amd" ]]
then
if [[ -d /System/Library/CoreServices/Finder.app ]]
then
echo ""$BS"Installing dependencies..."$CE""
else
echo ""$BS"Installing dependencies..."$CE""
apt-get update
apt-get -y install python3
apt-get -y install python3-pip
apt-get -y install wget
fi
fi
if [[ "$CONF" = "intel" ]]
then
if [[ -d /System/Library/CoreServices/Finder.app ]]
then
echo ""$BS"Installing dependencies..."$CE""
else
echo ""$BS"Installing dependencies..."$CE""
apt-get update
apt-get -y install python3
apt-get -y install python3-pip
apt-get -y install wget
fi
fi
else
read -e -p $'Select your architecture (amd/intel/arm): ' CONF
if [[ "$CONF" = "" ]]
then
exit
else
if [[ "$CONF" = "arm" ]]
then
read -e -p $'Is this a single board computer (yes/no)? ' PI
if [[ "$PI" = "yes" ]]
then
echo "amd" >> /etc/phonia.conf
CONF="amd"
else
echo "$CONF" >> /etc/phonia.conf
fi
else
echo "$CONF" >> /etc/phonia.conf
fi
fi
sleep 1
if [[ "$CONF" = "arm" ]]
then
if [[ -d /System/Library/CoreServices/SpringBoard.app ]]
then
echo ""$BS"Installing dependencies..."$CE""
else
echo ""$BS"Installing dependencies..."$CE""
pkg update
pkg -y install python3
pkg -y install python3-pip
pkg -y install wget
fi
fi
if [[ "$CONF" = "amd" ]]
then
if [[ -d /System/Library/CoreServices/Finder.app ]]
then
echo ""$BS"Installing dependencies..."$CE""
else
echo ""$BS"Installing dependencies..."$CE""
apt-get update
apt-get -y install python3
apt-get -y install python3-pip
apt-get -y install wget
fi
fi
if [[ "$CONF" = "intel" ]]
then
if [[ -d /System/Library/CoreServices/Finder.app ]]
then
echo ""$BS"Installing dependencies..."$CE""
else
echo ""$BS"Installing dependencies..."$CE""
apt-get update
apt-get -y install python3
apt-get -y install python3-pip
apt-get -y install wget
fi
fi
fi
{
cp config.example.py config.py
pip3 install setuptools
pip3 install -r requirements.txt
} &> /dev/null
{
if [[ -f /etc/phonia.conf ]]
then
wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
if [[ -d /System/Library/CoreServices/Finder.app ]]
then
sh -c 'tar -x geckodriver -zf geckodriver-*.tar.gz -O > /usr/local/bin/geckodriver'
chmod +x /usr/local/bin/geckodriver
else
sh -c 'tar -x geckodriver -zf geckodriver-*.tar.gz -O > /usr/bin/geckodriver'
chmod +x /usr/bin/geckodriver
fi
else
exit
fi
} &> /dev/null