mdserver-web/plugins/php/lib/zlib.sh

37 lines
980 B
Bash
Raw Normal View History

2022-06-14 14:12:21 -04:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
# echo $rootPath
SERVER_ROOT=$rootPath/lib
SOURCE_ROOT=$rootPath/source/lib
2022-12-19 07:28:12 -05:00
HTTP_PREFIX="https://"
2023-09-09 00:13:16 -04:00
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
2023-09-15 01:28:19 -04:00
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
2022-12-19 07:28:12 -05:00
HTTP_PREFIX="https://ghproxy.com/"
fi
2022-06-22 08:24:23 -04:00
if [ ! -d ${SERVER_ROOT}/zlib ];then
2022-06-14 14:12:21 -04:00
cd $SOURCE_ROOT
if [ ! -f ${SOURCE_ROOT}/zlib-1.2.11.tar.gz ];then
2022-12-19 22:18:21 -05:00
wget --no-check-certificate -O zlib-1.2.11.tar.gz ${HTTP_PREFIX}github.com/madler/zlib/archive/v1.2.11.tar.gz -T 20
2022-06-14 14:12:21 -04:00
fi
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=${SERVER_ROOT}/zlib && make && make install
2023-10-30 14:08:29 -04:00
cd $SOURCE_ROOT && rm -rf $SOURCE_ROOT/zlib-1.2.11
2022-06-14 14:12:21 -04:00
#rm -rf zlib-1.2.11
#rm -rf zlib-1.2.11.tar.gz
fi