代码拉取完成,页面将自动刷新
同步操作将从 java110/HCDoc 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
public_file=/hcdemo/shellinstall/dlurl.sh
if [ ! -f $public_file ];then
mkdir -p /hcdemo/shellinstall/
wget -O $public_file https://dl.winqi.cn/install/install/dlurl.sh -T 20;
fi
. $public_file
download_Url=${NODE_URL}/install
Root_Path=`cat /var/hc_setupPath.conf`
Setup_Path=$Root_Path/server/pure-ftpd
run_path='/root'
pure_ftpd_version='1.0.49'
[ -z "${cpuCore}" ] && cpuCore="1"
#Install_Yum为临时依赖模块,正式一键标本会移除!!!!
Install_Yum(){
Run_User="www"
wwwUser=$(cat /etc/passwd|grep www)
if [ "${wwwUser}" == "" ];then
groupadd ${Run_User}
useradd -s /sbin/nologin -g ${Run_User} ${Run_User}
fi
yumPacks="wget tar zip unzip openssl openssl-devel gcc libxml2 libxml2-devel libxslt* zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs icu libicu-devel c-ares"
yum install -y ${yumPacks}
}
Service_Add(){
if [ "${PM}" == "yum" ] || [ "${PM}" == "dnf" ]; then
chkconfig --add pure-ftpd
chkconfig --level 2345 pure-ftpd on
elif [ "${PM}" == "apt-get" ]; then
update-rc.d pure-ftpd defaults
fi
}
Service_Del(){
if [ "${PM}" == "yum" ] || [ "${PM}" == "dnf" ]; then
chkconfig --del pure-ftpd
chkconfig --level 2345 pure-ftpd off
elif [ "${PM}" == "apt-get" ]; then
update-rc.d pure-ftpd remove
fi
}
Install_Pureftpd()
{
cd ${run_path}
rm -rf ${Setup_Path}
rm -f /etc/init.d/pure-ftpd
if [ ! -f "pure-ftpd-${pure_ftpd_version}.tar.gz" ];then
wget ${download_Url}/src/pure-ftpd-${pure_ftpd_version}.tar.gz -T 20
fi
tar -zxf pure-ftpd-${pure_ftpd_version}.tar.gz
cd pure-ftpd-${pure_ftpd_version}
echo "Installing pure-ftpd..."
./configure --prefix=${Setup_Path} CFLAGS=-O2 --with-puredb --with-quotas --with-cookie --with-virtualhosts --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 --with-ftpwho --with-tls
make && make install
if [ ! -f "${Setup_Path}/bin/pure-pw" ];then
echo '========================================================'
GetSysInfo
echo -e "ERROR: pure-ftpd installation failed.";
rm -rf ${Setup_Path}
exit 0;
fi
echo "Copy configure files..."
wget ${download_Url}/install/src/pure-config.pl -T20
\cp pure-config.pl ${Setup_Path}/sbin/
chmod 755 ${Setup_Path}/sbin/pure-config.pl
sed -i "s@/usr/local@$Root_Path/server@g" ${Setup_Path}/sbin/pure-config.pl
mkdir ${Setup_Path}/etc
wget -O ${Setup_Path}/etc/pure-ftpd.conf ${download_Url}/conf/pure-ftpd.conf -T20
wget -O /etc/init.d/pure-ftpd ${download_Url}/init/pureftpd.init -T20
chmod +x /etc/init.d/pure-ftpd
touch ${Setup_Path}/etc/pureftpd.passwd
touch ${Setup_Path}/etc/pureftpd.pdb
StartUp pureftpd
cd ${run_path}
rm -rf pure-ftpd*
if [[ -s ${Setup_Path}/sbin/pure-config.pl && -s ${Setup_Path}/etc/pure-ftpd.conf && -s /etc/init.d/pure-ftpd ]]; then
echo "Starting pureftpd..."
if [ -f "/hcdemo/backup/ftpd_backup.pdb" ];then
\cp -a -r /hcdemo/backup/ftpd_backup.pdb ${Setup_Path}/etc/pureftpd.pdb
fi
if [ -f "/hcdemo/backup/ftpd_backup.passwd" ];then
\cp -a -r /hcdemo/backup/ftpd_backup.passwd ${Setup_Path}/etc/pureftpd.passwd
fi
if [ -f "/hcdemo/backup/ftpd_backup.conf" ];then
\cp -a -r /hcdemo/backup/ftpd_backup.conf ${Setup_Path}/etc/pure-ftpd.conf
fi
address=`curl https://dl.winqi.cn/api/getIpAddress`
if [ "$address" == "" ];then
address='hc.demo.winqi.cn';
fi
mkdir -p /etc/ssl/private
openssl req -x509 -nodes -days 3560 -newkey rsa:1024 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem<<EOF
CN
Chongqing
Changshou
HC-DEMO
HC:
$address
hcdemo@winqi.cn
EOF
if [ -f '/etc/ssl/private/pure-ftpd.pem' ];then
chmod 600 /etc/ssl/private/pure-ftpd.pem
Centos8Check=$(cat /etc/redhat-release | grep ' 8.' | grep -i centos)
DEBIAN_CHECK=$(cat /etc/issue|grep Debian|grep 10)
if [ "${DEBIAN_CHECK}" == "${Centos8Check}" ];then
sed -i "s/# TLS/TLS/" /hcdemo/server/pure-ftpd/etc/pure-ftpd.conf
fi
fi
/etc/init.d/pure-ftpd start
echo "${pure_ftpd_version}" > ${Setup_Path}/version.pl
else
echo "Pureftpd install failed!"
fi
}
Update_Pureftpd(){
cd ${run_path}
mkdir -p ${Setup_Path}/src
rm -rf ${Setup_Path}/src/*
cd ${Setup_Path}/src
\cp -a -r ${Setup_Path}/etc/pureftpd.pdb /hcdemo/backup/ftpd_backup.pdb
\cp -a -r ${Setup_Path}/etc/pureftpd.passwd /hcdemo/backup/ftpd_backup.passwd
\cp -a -r ${Setup_Path}/etc/pure-ftpd.conf /hcdemo/backup/ftpd_backup.conf
if [ ! -f "pure-ftpd-${pure_ftpd_version}.tar.gz" ];then
wget ${download_Url}/src/pure-ftpd-${pure_ftpd_version}.tar.gz -T 20
fi
tar -zxf pure-ftpd-${pure_ftpd_version}.tar.gz
cd pure-ftpd-${pure_ftpd_version}
echo "Installing pure-ftpd..."
./configure --prefix=${Setup_Path} CFLAGS=-O2 --with-puredb --with-quotas --with-cookie --with-virtualhosts --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 --with-ftpwho --with-tls
make && make install
\cp -a -r /hcdemo/backup/ftpd_backup.pdb ${Setup_Path}/etc/pureftpd.pdb
\cp -a -r /hcdemo/backup/ftpd_backup.passwd ${Setup_Path}/etc/pureftpd.passwd
\cp -a -r /hcdemo/backup/ftpd_backup.conf ${Setup_Path}/etc/pure-ftpd.conf
/etc/init.d/pure-ftpd restart
echo "${pure_ftpd_version}" > ${Setup_Path}/version.pl
rm -f ${Setup_Path}/version_check.pl
}
Uninstall_Pureftpd()
{
if [ -f "/hcdemo/server/pure-ftpd/sbin/pure-ftpd" ];then
\cp -a -r ${Setup_Path}/etc/pureftpd.pdb /hcdemo/backup/ftpd_backup.pdb
\cp -a -r ${Setup_Path}/etc/pureftpd.passwd /hcdemo/backup/ftpd_backup.passwd
\cp -a -r ${Setup_Path}/etc/pure-ftpd.conf /hcdemo/backup/ftpd_backup.conf
/etc/init.d/pure-ftpd stop
pkill -9 pure-ftpd
chkconfig --del pure-ftpd
rm -f /etc/init.d/pure-ftpd
rm -rf $Setup_Path
fi
}
actionType=$1
if [ "$actionType" == 'install' ];then
Install_Yum #正式版会移除该模块
Install_Pureftpd
Service_Add
elif [ "$actionType" == 'uninstall' ];then
Service_Del
Uninstall_Pureftpd
elif [ "$actionType" == 'update' ]; then
Update_Pureftpd
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。