mdserver-web/plugins/pureftp/install.sh

53 lines
1.1 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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")
install_tmp=${rootPath}/tmp/mw_install.pl
Install_pureftp()
{
mkdir -p ${serverPath}/pureftp
mkdir -p ${serverPath}/source/pureftp
VER=$1
FILE=pure-ftpd-${VER}.tar.gz
FDIR=pure-ftpd-${VER}
DOWNLOAD=https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${VER}.tar.gz
if [ ! -f $serverPath/source/pureftp/$FILE ];then
wget -O $serverPath/source/pureftp/$FILE $DOWNLOAD
fi
if [ ! -d $serverPath/source/pureftp/$FDIR ];then
cd $serverPath/source/pureftp && tar zxvf $FILE
fi
cd $serverPath/source/pureftp/$FDIR && ./configure --prefix=${serverPath}/pureftp \
   --with-everything && make && make install && make clean
echo "${1}" > ${serverPath}/pureftp/version.pl
echo '安装完成' > $install_tmp
}
Uninstall_pureftp()
{
rm -rf ${serverPath}/pureftp
echo '卸载完成' > $install_tmp
}
action=$1
if [ "${1}" == 'install' ];then
Install_pureftp $2
else
Uninstall_pureftp $2
fi