diff --git a/plugins/csvn/install.sh b/plugins/csvn/install.sh index fe010fa00..6dc9025f8 100755 --- a/plugins/csvn/install.sh +++ b/plugins/csvn/install.sh @@ -14,14 +14,15 @@ Install_csvn() mkdir -p $serverPath/tmp echo '正在安装脚本文件...' > $install_tmp - wget -O $serverPath/tmp/csvn.tar.xz https://github.com/midoks/mdserver-web/releases/download/init/CollabNetSubversionEdge-5.1.4_linux-x86_64.tar.xz + + if [ ! -d $serverPath/tmp/csvn.tar.xz ];then + wget -O $serverPath/tmp/csvn.tar.xz https://github.com/midoks/mdserver-web/releases/download/init/CollabNetSubversionEdge-5.1.4_linux-x86_64.tar.xz + fi cd $serverPath/tmp && tar -Jxf $serverPath/tmp/csvn.tar.xz mv $serverPath/tmp/csvn $serverPath/csvn echo '安装完成' > $install_tmp - - rm -rf $serverPath/tmp } Uninstall_csvn() diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index 50ee7d0b2..e2e4ce6c3 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -15,19 +15,22 @@ Install_openresty() mkdir -p $serverPath/tmp echo '正在安装脚本文件...' > $install_tmp - #wget -O $serverPath/tmp/openresty.tar.gz https://openresty.org/download/openresty-1.13.6.2.tar.gz - #cd $serverPath/tmp && tar -zxvf openresty.tar.gz + if [ ! -d $serverPath/tmp/openresty.tar.gz ];then + wget -O $serverPath/tmp/openresty.tar.gz https://openresty.org/download/openresty-1.13.6.2.tar.gz + fi + cd $serverPath/tmp && tar -zxvf openresty.tar.gz mkdir -p $serverPath/openresty - cd $serverPath/tmp/openresty* && ./configure --prefix=$serverPath/openresty && make && make install + cd $serverPath/tmp/openresty* && ./configure --prefix=$serverPath/openresty \ + --with-openssl=$serverPath/tmp/openssl-1.0.2q && make && make install echo '安装完成' > $install_tmp - #rm -rf $serverPath/tmp } Uninstall_openresty() { - echo "Uninstall_safelogin" + rm -f $serverPath/openresty + echo '卸载完成' > $install_tmp } action=$1 diff --git a/route/plugins.py b/route/plugins.py index 305ea9dc6..f2a36328e 100644 --- a/route/plugins.py +++ b/route/plugins.py @@ -84,7 +84,31 @@ def install(): @plugins.route('/uninstall', methods=['POST']) def uninstall(): - pass + rundir = public.getRunDir() + name = request.form.get('name', '') + version = request.form.get('version', '') + if name.strip() == '': + return public.returnJson(False, "缺少插件名称!", ()) + + if version.strip() == '': + return public.returnJson(False, "缺少版本信息!", ()) + + infoJsonPos = __plugin_name + '/' + name + '/' + 'info.json' + + if not os.path.exists(infoJsonPos): + return public.retJson(False, "配置文件不存在!", ()) + + pluginInfo = json.loads(public.readFile(infoJsonPos)) + + execstr = "cd " + os.getcwd() + "/plugins/" + \ + name + " && /bin/bash " + pluginInfo["shell"] \ + + " uninstall " + version + + taskAdd = (None, '卸载[' + name + '-' + version + ']', + 'execshell', '0', time.strftime('%Y-%m-%d %H:%M:%S'), execstr) + + public.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd) + return public.returnJson(True, '已将卸载任务添加到队列!') @plugins.route('/installed', methods=['POST']) diff --git a/scripts/lib.sh b/scripts/lib.sh index d822a525d..02d154691 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -1,7 +1,13 @@ #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +curPath=`pwd` +rootPath=$(dirname "$curPath") +serverPath=$(dirname "$rootPath") +tmpPath=$serverPath/tmp +libPath=$serverPath/lib +mkdir -p $libPath Install_Curl() @@ -168,21 +174,15 @@ Install_Pcre() Install_OpenSSL() { - if [ ! -d "/usr/local/openssl" ];then - cd ${run_path} - wget ${download_Url}/src/openssl-1.0.2l.tar.gz -T 20 - tar -zxf openssl-1.0.2l.tar.gz - rm -f openssl-1.0.2l.tar.gz - cd openssl-1.0.2l - ./config --openssldir=/usr/local/openssl zlib-dynamic shared + if [ ! -d ${libPath}/openssl ];then + cd ${tmpPath} + if [ ! -d ${tmpPath}openssl-1.0.2q.tar.gz ];then + wget https://github.com/midoks/mdserver-web/releases/download/init/openssl-1.0.2q.tar.gz -T 20 + fi + tar -zxf openssl-1.0.2q.tar.gz + cd openssl-1.0.2q + ./config --openssldir=${libPath}/openssl zlib-dynamic shared make && make install - echo '1.0.2l_shared' > /usr/local/openssl/version.pl - cd .. - rm -rf openssl-1.0.2l - cat > /etc/ld.so.conf.d/openssl.conf <'+shortwebname+'\ '+shortpath+'\ - '+ToSize(rdata.dirs[i].size)+'\ + '+toSize(rdata.dirs[i].size)+'\ '+getLocalTime(rdata.dirs[i].time)+'\ \ '+lan.files.recycle_bin_re+'\ @@ -58,7 +58,7 @@ function Recycle_bin(type){ body += '\ '+shortwebname+'\ '+shortpath+'\ - '+ToSize(rdata.files[i].size)+'\ + '+toSize(rdata.files[i].size)+'\ '+getLocalTime(rdata.files[i].time)+'\ \ '+lan.files.recycle_bin_re+'\ @@ -78,7 +78,7 @@ function Recycle_bin(type){ body += '\ '+shortwebname+'\ '+shortpath+'\ - '+ToSize(rdata.dirs[i].size)+'\ + '+toSize(rdata.dirs[i].size)+'\ '+getLocalTime(rdata.dirs[i].time)+'\ \ '+lan.files.recycle_bin_re+'\ @@ -99,7 +99,7 @@ function Recycle_bin(type){ body += '\ '+shortwebname+'\ '+shortpath+'\ - '+ToSize(rdata.files[i].size)+'\ + '+toSize(rdata.files[i].size)+'\ '+getLocalTime(rdata.files[i].time)+'\ \ '+lan.files.recycle_bin_re+'\ @@ -120,7 +120,7 @@ function Recycle_bin(type){ body += '\ '+shortwebname+'\ '+shortpath+'\ - '+ToSize(rdata.files[i].size)+'\ + '+toSize(rdata.files[i].size)+'\ '+getLocalTime(rdata.files[i].time)+'\ \ '+lan.files.recycle_bin_re+'\ @@ -143,7 +143,7 @@ function Recycle_bin(type){ body += '\ '+shortwebname+'\ '+shortpath+'\ - '+ToSize(rdata.files[i].size)+'\ + '+toSize(rdata.files[i].size)+'\ '+getLocalTime(rdata.files[i].time)+'\ \ '+lan.files.recycle_bin_re+'\ @@ -368,7 +368,7 @@ function GetFiles(Path) { Body += "\ \ " + cnametext + "\ - "+ToSize(fmp[1])+"\ + "+toSize(fmp[1])+"\ "+getLocalTime(fmp[2])+"\ "+fmp[3]+"\ "+fmp[4]+"\ @@ -384,7 +384,7 @@ function GetFiles(Path) { else{ $("#set_icon").addClass("active"); $("#set_list").removeClass("active"); - Body += "