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

50 lines
1.5 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
2023-11-08 12:32:59 -05:00
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
2023-11-19 07:50:16 -05:00
# cd /www/server/mdserver-web/plugins/php/lib && bash libiconv.sh
# echo $rootPath
SERVER_ROOT=$rootPath/lib
SOURCE_ROOT=$rootPath/source/lib
2022-12-19 07:28:12 -05:00
HTTP_PREFIX="https://"
2023-11-10 05:47:32 -05:00
LOCAL_ADDR=common
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
2023-11-10 05:47:32 -05:00
LOCAL_ADDR=cn
2024-02-08 03:46:43 -05:00
HTTP_PREFIX="https://mirror.ghproxy.com/"
2022-12-19 07:28:12 -05:00
fi
if [ ! -d ${SERVER_ROOT}/libiconv ];then
cd $SOURCE_ROOT
2023-11-10 05:47:32 -05:00
if [ "$LOCAL_ADDR" == 'cn' ];then
if [ ! -f ${SOURCE_ROOT}/libiconv-1.15.tar.gz ];then
2023-11-30 22:43:31 -05:00
wget --no-check-certificate -O ${SOURCE_ROOT}/libiconv-1.15.tar.gz https://dl.midoks.icu/lib/libiconv-1.15.tar.gz -T 20
2023-11-10 05:47:32 -05:00
fi
fi
if [ ! -f ${SOURCE_ROOT}/libiconv-1.15.tar.gz ];then
2023-11-19 07:50:16 -05:00
wget --no-check-certificate -O ${SOURCE_ROOT}/libiconv-1.15.tar.gz https://github.com/midoks/mdserver-web/releases/download/init/libiconv-1.15.tar.gz -T 5
2023-11-10 05:47:32 -05:00
fi
if [ ! -d ${SOURCE_ROOT}/libiconv-1.15 ];then
cd $SOURCE_ROOT && tar -zxvf libiconv-1.15.tar.gz
fi
cd ${SOURCE_ROOT}/libiconv-1.15
2022-06-14 14:23:59 -04:00
./configure --prefix=${SERVER_ROOT}/libiconv --enable-static && make && make install
2023-11-10 05:47:32 -05:00
if [ -d $SOURCE_ROOT/libiconv-1.15 ];then
cd $SOURCE_ROOT && rm -rf $SOURCE_ROOT/libiconv-1.15
fi
fi