mdserver-web/plugins/openresty/install.sh

63 lines
1.4 KiB
Bash
Raw Normal View History

2018-11-25 04:48:48 -05: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")
serverPath=$(dirname "$rootPath")
2018-12-04 22:01:25 -05:00
action=$1
type=$2
2018-11-25 04:48:48 -05:00
2020-06-28 01:44:38 -04:00
VERSION=$2
install_tmp=${rootPath}/tmp/mw_install.pl
openrestyDir=${serverPath}/source/openresty
2019-02-02 09:13:51 -05:00
if id www &> /dev/null ;then
echo "www UID is `id -u www`"
echo "www Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
else
groupadd www
2020-09-28 00:52:11 -04:00
# useradd -g www -s /sbin/nologin www
useradd -g www -s /bin/bash www
2019-02-02 09:13:51 -05:00
fi
2020-06-28 01:44:38 -04:00
Install_openresty()
{
mkdir -p ${openrestyDir}
echo '正在安装脚本文件...' > $install_tmp
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
wget -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz
fi
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
2020-07-13 20:38:10 -04:00
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
2020-06-28 01:44:38 -04:00
cd ${openrestyDir}/openresty-${VERSION} && ./configure --prefix=$serverPath/openresty \
--with-http_v2_module \
2020-07-13 20:38:10 -04:00
--with-http_ssl_module \
2021-01-12 00:13:30 -05:00
--with-http_slice_module \
2020-06-28 01:44:38 -04:00
--with-http_stub_status_module && make && make install && \
echo "${VERSION}" > $serverPath/openresty/version.pl
echo '安装完成' > $install_tmp
}
Uninstall_openresty()
{
rm -rf $serverPath/openresty
echo '卸载完成' > $install_tmp
}
action=$1
if [ "${1}" == 'install' ];then
Install_openresty
else
Uninstall_openresty
fi