forked from NeySlim/xtreamui_mirror
-
Notifications
You must be signed in to change notification settings - Fork 2
/
phpbuild.sh
308 lines (306 loc) · 15.1 KB
/
phpbuild.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
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
#!/bin/bash
# wget --no-check-certificate -qO- https://raw.githubusercontent.com/amidevous/xtream-ui-ubuntu20.04/master/phpbuild.sh | bash -s
if [ -f "/home/xtreamcodes/iptv_xtream_codes/php-7.4.33" ]; then
echo "update exists."
else
echo -e "\nChecking that minimal requirements are ok"
# Ensure the OS is compatible with the launcher
if [ -f /etc/centos-release ]; then
inst() {
rpm -q "$1" &> /dev/null
}
if (inst "centos-stream-repos"); then
OS="CentOS-Stream"
else
OS="CentOs"
fi
VERFULL=$(sed 's/^.*release //;s/ (Fin.*$//' /etc/centos-release)
VER=${VERFULL:0:1} # return 6, 7 or 8
elif [ -f /etc/fedora-release ]; then
inst() {
rpm -q "$1" &> /dev/null
}
OS="Fedora"
VERFULL=$(sed 's/^.*release //;s/ (Fin.*$//' /etc/fedora-release)
VER=${VERFULL:0:2} # return 34, 35 or 36
elif [ -f /etc/lsb-release ]; then
OS=$(grep DISTRIB_ID /etc/lsb-release | sed 's/^.*=//')
VER=$(grep DISTRIB_RELEASE /etc/lsb-release | sed 's/^.*=//')
elif [ -f /etc/os-release ]; then
OS=$(grep -w ID /etc/os-release | sed 's/^.*=//')
VER=$(grep VERSION_ID /etc/os-release | sed 's/^.*"\(.*\)"/\1/' | head -n 1 | tail -n 1)
else
OS=$(uname -s)
VER=$(uname -r)
fi
ARCH=$(uname -m)
#wget https://raw.githubusercontent.com/amidevous/xtream-ui-ubuntu20.04/master/install-dep.sh -O /root/depbuild.sh && bash /root/install-dep.sh
if [[ "$OS" = "CentOs" && "$VER" = "6" && "$ARCH" == "x86_64" ]] ; then
/opt/rh/devtoolset-9/enable
source /opt/rh/devtoolset-9/enable
fi
cd /root
rm -rf /root/phpbuild/
mkdir -p /root/phpbuild/
cd /root/phpbuild/
rm -rf /root/phpbuild/ngx_http_geoip2_module
rm -rf /root/phpbuild/nginx-1.24.0
rm -rf /root/phpbuild/openssl-OpenSSL_1_1_1h
wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1h.tar.gz -O /root/phpbuild/OpenSSL_1_1_1h.tar.gz
tar -xzvf OpenSSL_1_1_1h.tar.gz
wget http://nginx.org/download/nginx-1.24.0.tar.gz -O /root/phpbuild/nginx-1.24.0.tar.gz
tar -xzvf nginx-1.24.0.tar.gz
git clone https://github.com/leev/ngx_http_geoip2_module.git /root/phpbuild/ngx_http_geoip2_module
rm -rf /root/phpbuild/v1.2.2.zip
rm -rf /root/phpbuild/nginx-rtmp-module-1.2.2
wget https://github.com/arut/nginx-rtmp-module/archive/v1.2.2.zip -O /root/phpbuild/v1.2.2.zip
unzip /root/phpbuild/v1.2.2.zip
cd /root/phpbuild/nginx-1.24.0
if [ -f "/usr/bin/dpkg-buildflags" ]; then
configureend="--with-openssl=/root/phpbuild/openssl-OpenSSL_1_1_1h --with-ld-opt='$(dpkg-buildflags --get LDFLAGS)' --with-cc-opt='$(dpkg-buildflags --get CFLAGS)'"
elif [ -f "/usr/bin/rpm" ]; then
configureend="--with-openssl=/root/phpbuild/openssl-OpenSSL_1_1_1h --with-cc-opt='$(rpm --eval %{build_ldflags})' --with-cc-opt='$(rpm --eval %{optflags})'"
else
configureend="--with-openssl=/root/phpbuild/openssl-OpenSSL_1_1_1h"
fi
./configure --prefix=/home/xtreamcodes/iptv_xtream_codes/nginx/ \
--http-client-body-temp-path=/home/xtreamcodes/iptv_xtream_codes/tmp/client_temp \
--http-proxy-temp-path=/home/xtreamcodes/iptv_xtream_codes/tmp/proxy_temp \
--http-fastcgi-temp-path=/home/xtreamcodes/iptv_xtream_codes/tmp/fastcgi_temp \
--lock-path=/home/xtreamcodes/iptv_xtream_codes/tmp/nginx.lock \
--http-uwsgi-temp-path=/home/xtreamcodes/iptv_xtream_codes/tmp/uwsgi_temp \
--http-scgi-temp-path=/home/xtreamcodes/iptv_xtream_codes/tmp/scgi_temp \
--conf-path=/home/xtreamcodes/iptv_xtream_codes/nginx/conf/nginx.conf \
--error-log-path=/home/xtreamcodes/iptv_xtream_codes/logs/error.log \
--http-log-path=/home/xtreamcodes/iptv_xtream_codes/logs/access.log \
--pid-path=/home/xtreamcodes/iptv_xtream_codes/nginx/nginx.pid \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_v2_module \
--with-pcre \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-threads \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-cpu-opt=generic \
--add-module=/root/phpbuild/ngx_http_geoip2_module \
"$configureend"
make -j$(nproc --all)
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/nginx/"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/nginx/sbin/"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/nginx/modules"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/nginx/conf"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/logs/"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/tmp/client_temp"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/tmp/proxy_temp"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/tmp/fastcgi_temp"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/tmp/uwsgi_temp"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/tmp/scgi_temp"
killall nginx
kill $(ps aux | grep 'xtreamcodes' | grep -v grep | grep -v 'start_services.sh' | awk '{print $2}') 2>/dev/null
killall nginx
kill $(ps aux | grep 'xtreamcodes' | grep -v grep | grep -v 'start_services.sh' | awk '{print $2}') 2>/dev/null
killall nginx
kill $(ps aux | grep 'xtreamcodes' | grep -v grep | grep -v 'start_services.sh' | awk '{print $2}') 2>/dev/null
rm -f /home/xtreamcodes/iptv_xtream_codes/nginx/sbin/nginx
cp /root/phpbuild/nginx-1.24.0/objs/nginx /home/xtreamcodes/iptv_xtream_codes/nginx/sbin/
if [ ! -f "/home/xtreamcodes/iptv_xtream_codes/nginx/sbin/nginx" ]; then
echo "nginx build error"
exit 0
fi
cd /root/phpbuild/
rm -rf /root/phpbuild/ngx_http_geoip2_module
rm -rf /root/phpbuild/nginx-1.24.0
rm -rf /root/phpbuild/openssl-OpenSSL_1_1_1h
wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1h.tar.gz -O /root/phpbuild/OpenSSL_1_1_1h.tar.gz
tar -xzvf OpenSSL_1_1_1h.tar.gz
wget http://nginx.org/download/nginx-1.24.0.tar.gz -O /root/phpbuild/nginx-1.24.0.tar.gz
tar -xzvf nginx-1.24.0.tar.gz
git clone https://github.com/leev/ngx_http_geoip2_module.git /root/phpbuild/ngx_http_geoip2_module
rm -rf /root/phpbuild/v1.2.2.zip
rm -rf /root/phpbuild/nginx-rtmp-module-1.2.2
wget https://github.com/arut/nginx-rtmp-module/archive/v1.2.2.zip -O /root/phpbuild/v1.2.2.zip
unzip /root/phpbuild/v1.2.2.zip
cd /root/phpbuild/nginx-1.24.0
./configure --prefix=/home/xtreamcodes/iptv_xtream_codes/nginx_rtmp/ \
--http-client-body-temp-path=/home/xtreamcodes/iptv_xtream_codes/tmp/client_temp \
--http-proxy-temp-path=/home/xtreamcodes/iptv_xtream_codes/tmp/proxy_temp \
--http-fastcgi-temp-path=/home/xtreamcodes/iptv_xtream_codes/tmp/fastcgi_temp \
--lock-path=/home/xtreamcodes/iptv_xtream_codes/tmp/nginx.lock \
--http-uwsgi-temp-path=/home/xtreamcodes/iptv_xtream_codes/tmp/uwsgi_temp \
--http-scgi-temp-path=/home/xtreamcodes/iptv_xtream_codes/tmp/scgi_temp \
--conf-path=/home/xtreamcodes/iptv_xtream_codes/nginx_rtmp/conf/nginx.conf \
--error-log-path=/home/xtreamcodes/iptv_xtream_codes/logs/rtmp_error.log \
--http-log-path=/home/xtreamcodes/iptv_xtream_codes/logs/rtmp_access.log \
--pid-path=/home/xtreamcodes/iptv_xtream_codes/nginx_rtmp/nginx.pid \
--add-module=/root/phpbuild/nginx-rtmp-module-1.2.2 \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_v2_module \
--with-pcre \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-threads \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-cpu-opt=generic \
--without-http_rewrite_module \
--add-module=/root/phpbuild/ngx_http_geoip2_module \
"$configureend"
make -j$(nproc --all)
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/nginx_rtmp/"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/nginx_rtmp/sbin/"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/nginx_rtmp/modules"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/nginx_rtmp/conf"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/logs/"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/tmp/client_temp"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/tmp/proxy_temp"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/tmp/fastcgi_temp"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/tmp/uwsgi_temp"
mkdir -p "/home/xtreamcodes/iptv_xtream_codes/tmp/scgi_temp"
killall nginx_rtmp
kill $(ps aux | grep 'xtreamcodes' | grep -v grep | grep -v 'start_services.sh' | awk '{print $2}') 2>/dev/null
killall nginx_rtmp
kill $(ps aux | grep 'xtreamcodes' | grep -v grep | grep -v 'start_services.sh' | awk '{print $2}') 2>/dev/null
killall nginx_rtmp
kill $(ps aux | grep 'xtreamcodes' | grep -v grep | grep -v 'start_services.sh' | awk '{print $2}') 2>/dev/null
rm -f /home/xtreamcodes/iptv_xtream_codes/nginx_rtmp/sbin/nginx_rtmp
mv /root/phpbuild/nginx-1.24.0/objs/nginx /root/phpbuild/nginx-1.24.0/objs/nginx_rtmp
cp /root/phpbuild/nginx-1.24.0/objs/nginx_rtmp /home/xtreamcodes/iptv_xtream_codes/nginx_rtmp/sbin/
if [ ! -f "/home/xtreamcodes/iptv_xtream_codes/nginx_rtmp/sbin/nginx_rtmp" ]; then
echo "nginx_rtmp build error"
exit 0
fi
cd /root/phpbuild/
# php 7.4 include security patch php 8 backported to php 7.4 by Remi Collet
# Oficial phpbuilder and security patch
# Red Hat/Fedora system Remi Collet
# https://blog.remirepo.net/pages/Config-en
# Debian/Ubuntu system Ondřej Surý
# https://launchpad.net/~ondrej/+archive/ubuntu/php
# https://deb.sury.org/#debian-dpa
# github with security patch
# https://github.com/remicollet/php-src-security
# since php 5 Remi Collet makes security patches and packages for RedHat/Fedora distributions
# and Ondřej Surý the packages for the Debian/Ubuntu distribution based on the security patches which are provided by Remi Collet in this github repository
wget --no-check-certificate https://github.com/remicollet/php-src-security/archive/refs/heads/PHP-7.4-security-backports.tar.gz
tar -xvf PHP-7.4-security-backports.tar.gz
cd php-src-security-PHP-7.4-security-backports
./buildconf --force
./configure --prefix=/home/xtreamcodes/iptv_xtream_codes/php \
--with-zlib-dir --with-freetype --enable-mbstring --enable-calendar --with-curl \
--disable-rpath --enable-inline-optimization --with-bz2 --with-zlib \
--enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl \
--enable-mbregex --enable-exif --enable-bcmath --with-mhash \
--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --with-fpm-user=xtreamcodes \
--with-fpm-group=xtreamcodes --with-libdir=/lib/x86_64-linux-gnu \
--with-gettext --with-xmlrpc --with-xsl --enable-opcache \
--enable-fpm --enable-static --disable-shared --enable-gd-jis-conv
make -j$(nproc --all)
killall php
killall php-fpm
kill $(ps aux | grep 'xtreamcodes' | grep -v grep | grep -v 'start_services.sh' | awk '{print $2}') 2>/dev/null
killall php
killall php-fpm
kill $(ps aux | grep 'xtreamcodes' | grep -v grep | grep -v 'start_services.sh' | awk '{print $2}') 2>/dev/null
killall php
killall php-fpm
kill $(ps aux | grep 'xtreamcodes' | grep -v grep | grep -v 'start_services.sh' | awk '{print $2}') 2>/dev/null
rm -rf /home/xtreamcodes/iptv_xtream_codes/php/lib/php/extensions/
make install
if [ ! -f "/home/xtreamcodes/iptv_xtream_codes/php/bin/php" ]; then
echo "php build error"
exit 0
fi
cd /root/phpbuild
wget --no-check-certificate -O /root/phpbuild/mcrypt-1.0.5.tgz https://pecl.php.net/get/mcrypt-1.0.5.tgz
tar -xvf /root/phpbuild/mcrypt-1.0.5.tgz
cd /root/phpbuild/mcrypt-1.0.5
/home/xtreamcodes/iptv_xtream_codes/php/bin/phpize
./configure --with-php-config=/home/xtreamcodes/iptv_xtream_codes/php/bin/php-config
make -j$(nproc --all)
make install
if [ ! -f "/home/xtreamcodes/iptv_xtream_codes/php/lib/php/extensions/no-debug-non-zts-20190902/mcrypt.so" ]; then
echo "php-mcrypt build error"
exit 0
fi
cd /root/phpbuild/
wget --no-check-certificate -O /root/phpbuild/geoip-1.1.1.tgz https://pecl.php.net/get/geoip-1.1.1.tgz
tar -xvf /root/phpbuild/geoip-1.1.1.tgz
cd /root/phpbuild/geoip-1.1.1
/home/xtreamcodes/iptv_xtream_codes/php/bin/phpize
./configure --with-php-config=/home/xtreamcodes/iptv_xtream_codes/php/bin/php-config
make -j$(nproc --all)
make install
if [ ! -f "/home/xtreamcodes/iptv_xtream_codes/php/lib/php/extensions/no-debug-non-zts-20190902/geoip.so" ]; then
echo "php-mcrypt build error"
exit 0
fi
cd /root/phpbuild/
mkdir -p /home/xtreamcodes/iptv_xtream_codes/php/lib/php/extensions/no-debug-non-zts-20190902/
wget --no-check-certificate -O /root/phpbuild/ioncube_loaders_lin_x86-64.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar -xvf /root/phpbuild/ioncube_loaders_lin_x86-64.tar.gz
rm -f /root/phpbuild/ioncube_loaders_lin_x86-64.tar.gz
rm -rf /home/xtreamcodes/iptv_xtream_codes/php/lib/php/extensions/no-debug-non-zts-20190902/ioncube_loader_lin_*.so
mv /root/phpbuild/ioncube/ioncube_loader_lin_7.4.so /root/phpbuild/ioncube/ioncube.so
cp /root/phpbuild/ioncube/ioncube.so /home/xtreamcodes/iptv_xtream_codes/php/lib/php/extensions/no-debug-non-zts-20190902/
rm -rf /root/phpbuild/ioncube
chmod 777 /home/xtreamcodes/iptv_xtream_codes/php/lib/php/extensions/no-debug-non-zts-20190902/ioncube.so
if [ ! -f "/home/xtreamcodes/iptv_xtream_codes/php/lib/php/extensions/no-debug-non-zts-20190902/ioncube.so" ]; then
echo "ioncube install error"
exit 0
fi
cd /root
wget --no-check-certificate https://raw.githubusercontent.com/amidevous/xtream-ui-ubuntu20.04/master/ubuntu/php.ini -O /home/xtreamcodes/iptv_xtream_codes/php/lib/php.ini
cd /root
rm -rf /root/phpbuild/
mkdir -p /home/xtreamcodes/iptv_xtream_codes/bin/
cd /home/xtreamcodes/iptv_xtream_codes/bin/
wget https://bitbucket.org/emre1393/xtreamui_mirror/downloads/ffmpeg_v5.0.1_amd64.zip -O /home/xtreamcodes/iptv_xtream_codes/bin/ffmpeg_v5.0.1_amd64.zip
rm -f /home/xtreamcodes/iptv_xtream_codes/bin/ffmpeg
rm -f /home/xtreamcodes/iptv_xtream_codes/bin/ffprobe
unzip /home/xtreamcodes/iptv_xtream_codes/bin/ffmpeg_v5.0.1_amd64.zip
rm -f /home/xtreamcodes/iptv_xtream_codes/bin/ffmpeg_v5.0.1_amd64.zip
cd /root
rm -rf /root/phpbuild/
sudo rm -rf /tmp/update/
mkdir -p /tmp/update/
wget "https://github.com/amidevous/xtream-ui-ubuntu20.04/releases/download/start/update.zip" -O /tmp/update/update.zip
unzip /tmp/update/update.zip -d /tmp/update/
rm -f /tmp/update/update.zip
sudo cp -rf /tmp/update/XtreamUI-master/admin/* /home/xtreamcodes/iptv_xtream_codes/admin/
sudo cp /tmp/update/XtreamUI-master/permissions.sh /home/xtreamcodes/iptv_xtream_codes/
sudo chmod +x /home/xtreamcodes/iptv_xtream_codes/permissions.sh
sudo rm -rf /home/xtreamcodes/iptv_xtream_codes/pytools/
sudo mkdir -p /home/xtreamcodes/iptv_xtream_codes/pytools/
sudo cp -rf /tmp/update/XtreamUI-master/pytools/* /home/xtreamcodes/iptv_xtream_codes/pytools/
rm -rf /tmp/update/XtreamUI-master
rm -rf /tmp/update
sudo chown -R xtreamcodes:xtreamcodes /home/xtreamcodes/
sudo chmod +x /home/xtreamcodes/iptv_xtream_codes/permissions.sh
sudo /home/xtreamcodes/iptv_xtream_codes/permissions.sh
sudo find /home/xtreamcodes/ -type d -not \( -name .update -prune \) -exec chmod -R 777 {} +
sudo wget https://raw.githubusercontent.com/amidevous/xtream-ui-ubuntu20.04/master/start_services.sh -O /home/xtreamcodes/iptv_xtream_codes/start_services.sh
sudo chmod +x /home/xtreamcodes/iptv_xtream_codes/start_services.sh
/home/xtreamcodes/iptv_xtream_codes/permissions.sh
/home/xtreamcodes/iptv_xtream_codes/start_services.sh
sudo bash -c "echo 1 > /home/xtreamcodes/iptv_xtream_codes/php-7.4.33"
fi
echo "finish"