mdserver-web/plugins/score/install.sh

39 lines
746 B
Bash
Raw Normal View History

2018-10-02 09:50:10 -04:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
2018-11-05 03:49:37 -05:00
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
2018-11-26 02:54:42 -05:00
serverPath=$(dirname "$rootPath")
2018-11-05 03:49:37 -05:00
2018-11-05 06:05:33 -05:00
install_tmp=${rootPath}/tmp/bt_install.pl
2018-11-05 03:49:37 -05:00
2018-10-02 09:50:10 -04:00
Install_score()
{
echo '正在安装脚本文件...' > $install_tmp
2018-11-26 02:54:42 -05:00
mkdir -p $serverPath/score
2018-10-02 09:50:10 -04:00
2018-11-26 02:54:42 -05:00
gcc $curPath/testcpu.c -o $serverPath/score/testcpu -lpthread
if [ ! -f $serverPath/score/testcpu ];then
2018-11-05 04:19:02 -05:00
sleep 0.1
2018-11-26 02:54:42 -05:00
gcc $curPath/testcpu.c -o $serverPath/score/testcpu -lpthread
2018-11-05 04:19:02 -05:00
fi
2018-11-26 03:08:19 -05:00
2018-10-02 09:50:10 -04:00
echo '安装完成' > $install_tmp
}
Uninstall_score()
{
2018-11-26 03:08:19 -05:00
rm -rf $serverPath/score
2018-10-02 09:50:10 -04:00
echo '卸载完成' > $install_tmp
}
2018-11-05 03:49:37 -05:00
action=$1
if [ "${1}" == 'install' ];then
Install_score
else
Uninstall_score
fi