Simple Linux Panel
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.
mdserver-web/plugins/docker/install.sh

56 lines
1.2 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
Install_Docker()
{
echo '正在安装脚本文件...' > $install_tmp
mkdir -p $serverPath/source
curl -fsSL https://get.docker.com | bash
2 years ago
mkdir -p $serverPath/docker
if [ -d $serverPath/docker ];then
echo "${VERSION}" > $serverPath/docker/version.pl
2 years ago
echo '安装完成' > $install_tmp
cd ${rootPath} && python3 ${rootPath}/plugins/docker/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/docker/index.py initd_install
2 years ago
fi
}
Uninstall_Docker()
{
# if [ -f /usr/lib/systemd/system/docker.service ];then
# systemctl stop docker
# systemctl disable docker
# rm -rf /usr/lib/systemd/system/docker.service
# systemctl daemon-reload
# fi
# if [ -f $serverPath/docker/initd/docker ];then
# $serverPath/docker/initd/docker stop
# fi
rm -rf $serverPath/docker
echo "Uninstall_Docker" > $install_tmp
2 years ago
}
action=$1
if [ "${1}" == 'install' ];then
Install_Docker
else
Uninstall_Docker
fi