mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.3 KiB
59 lines
1.3 KiB
2 years ago
|
#!/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
|
||
|
|
||
|
VERSION=$2
|
||
|
|
||
|
# pip3 install ccxt
|
||
|
if [ -f ${rootPath}/bin/activate ];then
|
||
|
source ${rootPath}/bin/activate
|
||
|
fi
|
||
|
|
||
|
pip3 install telethon
|
||
|
|
||
|
Install_App()
|
||
|
{
|
||
|
echo '正在安装脚本文件...' > $install_tmp
|
||
|
mkdir -p $serverPath/source
|
||
|
mkdir -p $serverPath/tgclient
|
||
|
echo "${VERSION}" > $serverPath/tgclient/version.pl
|
||
|
|
||
|
cp -rf ${rootPath}/plugins/tgclient/startup/* $serverPath/tgclient
|
||
|
|
||
|
cd ${rootPath} && python3 ${rootPath}/plugins/tgclient/index.py start
|
||
|
cd ${rootPath} && python3 ${rootPath}/plugins/tgclient/index.py initd_install
|
||
|
echo '安装完成' > $install_tmp
|
||
|
}
|
||
|
|
||
|
Uninstall_App()
|
||
|
{
|
||
|
if [ -f /usr/lib/systemd/system/tgclient.service ];then
|
||
|
systemctl stop tgclient
|
||
|
systemctl disable tgclient
|
||
|
rm -rf /usr/lib/systemd/system/tgclient.service
|
||
|
systemctl daemon-reload
|
||
|
fi
|
||
|
|
||
|
if [ -f $serverPath/tgclient/initd/tgclient ];then
|
||
|
$serverPath/tgclient/initd/tgclient stop
|
||
|
fi
|
||
|
|
||
|
rm -rf $serverPath/tgclient
|
||
|
echo "Uninstall_redis" > $install_tmp
|
||
|
}
|
||
|
|
||
|
action=$1
|
||
|
if [ "${1}" == 'install' ];then
|
||
|
Install_App
|
||
|
else
|
||
|
Uninstall_App
|
||
|
fi
|