mirror of https://github.com/midoks/mdserver-web
commit
af32792bf1
@ -0,0 +1,17 @@ |
|||||||
|
# It's not recommended to modify this file in-place, because it |
||||||
|
# will be overwritten during upgrades. If you want to customize, |
||||||
|
# the best way is to use the "systemctl edit" command. |
||||||
|
|
||||||
|
[Unit] |
||||||
|
Description=The PHP {$VERSION} FastCGI Process Manager |
||||||
|
After=network.target |
||||||
|
|
||||||
|
[Service] |
||||||
|
Type=forking |
||||||
|
ExecStart={$SERVER_PATH}/php/{$VERSION}/sbin/php-fpm --daemonize --fpm-config {$SERVER_PATH}/php/{$VERSION}/etc/php-fpm.conf |
||||||
|
ExecStop=/bin/kill -INT $MAINPID |
||||||
|
ExecReload=/bin/kill -USR2 $MAINPID |
||||||
|
PrivateTmp=false |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
@ -1,21 +0,0 @@ |
|||||||
MIT License |
|
||||||
|
|
||||||
Copyright (c) 2019 Mr Chen |
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
|
||||||
of this software and associated documentation files (the "Software"), to deal |
|
||||||
in the Software without restriction, including without limitation the rights |
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
||||||
copies of the Software, and to permit persons to whom the Software is |
|
||||||
furnished to do so, subject to the following conditions: |
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all |
|
||||||
copies or substantial portions of the Software. |
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
||||||
SOFTWARE. |
|
Before Width: | Height: | Size: 1.0 KiB |
@ -1,20 +0,0 @@ |
|||||||
<div class="bt-form"> |
|
||||||
<div class="bt-w-main"> |
|
||||||
<div class="bt-w-menu"> |
|
||||||
<p class="bgw" onclick="pluginService('socket5');">服务</p> |
|
||||||
<p onclick="pluginInitD('socket5');">自启动</p> |
|
||||||
<p onclick="pluginConfig('socket5',null, 'conf');">配置</p> |
|
||||||
<p onclick="pluginConfig('socket5',null, 'conf_pwd');">用户</p> |
|
||||||
<p onclick="pluginConfig('socket5',null, 'conf_port');">端口</p> |
|
||||||
<p onclick="readme();">说明</p> |
|
||||||
</div> |
|
||||||
<div class="bt-w-con pd15"> |
|
||||||
<div class="soft-man-con"></div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<script type="text/javascript"> |
|
||||||
$.getScript( "/plugins/file?name=socket5&f=js/socket5.js", function(){ |
|
||||||
pluginService('socket5'); |
|
||||||
}); |
|
||||||
</script> |
|
@ -1,207 +0,0 @@ |
|||||||
# coding:utf-8 |
|
||||||
|
|
||||||
import sys |
|
||||||
import io |
|
||||||
import os |
|
||||||
import time |
|
||||||
import shutil |
|
||||||
|
|
||||||
sys.path.append(os.getcwd() + "/class/core") |
|
||||||
import mw |
|
||||||
|
|
||||||
app_debug = False |
|
||||||
if mw.isAppleSystem(): |
|
||||||
app_debug = True |
|
||||||
|
|
||||||
|
|
||||||
def getPluginName(): |
|
||||||
return 'socket5' |
|
||||||
|
|
||||||
|
|
||||||
def getPluginDir(): |
|
||||||
return mw.getPluginDir() + '/' + getPluginName() |
|
||||||
|
|
||||||
|
|
||||||
def getServerDir(): |
|
||||||
return mw.getServerDir() + '/' + getPluginName() |
|
||||||
|
|
||||||
|
|
||||||
def getInitDFile(): |
|
||||||
if app_debug: |
|
||||||
return '/tmp/' + getPluginName() |
|
||||||
return '/etc/init.d/ss5' |
|
||||||
|
|
||||||
|
|
||||||
def initDreplace(): |
|
||||||
return getPluginDir() + '/init.d/ss5' |
|
||||||
|
|
||||||
|
|
||||||
def getArgs(): |
|
||||||
args = sys.argv[2:] |
|
||||||
tmp = {} |
|
||||||
args_len = len(args) |
|
||||||
|
|
||||||
if args_len == 1: |
|
||||||
t = args[0].strip('{').strip('}') |
|
||||||
t = t.split(':') |
|
||||||
tmp[t[0]] = t[1] |
|
||||||
elif args_len > 1: |
|
||||||
for i in range(len(args)): |
|
||||||
t = args[i].split(':') |
|
||||||
tmp[t[0]] = t[1] |
|
||||||
|
|
||||||
return tmp |
|
||||||
|
|
||||||
|
|
||||||
def checkArgs(data, ck=[]): |
|
||||||
for i in range(len(ck)): |
|
||||||
if not ck[i] in data: |
|
||||||
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!')) |
|
||||||
return (True, mw.returnJson(True, 'ok')) |
|
||||||
|
|
||||||
|
|
||||||
def status(): |
|
||||||
cmd = "ps -ef|grep ss5 |grep -v grep | grep -v python | awk '{print $2}'" |
|
||||||
data = mw.execShell(cmd) |
|
||||||
if data[0] == '': |
|
||||||
return 'stop' |
|
||||||
return 'start' |
|
||||||
|
|
||||||
|
|
||||||
def initConf(): |
|
||||||
ss5_conf = getServerDir() + '/ss5.conf' |
|
||||||
if not os.path.exists(ss5_conf): |
|
||||||
tmp = getPluginDir() + '/tmp/ss5.conf' |
|
||||||
if not os.path.exists(tmp): |
|
||||||
mw.execShell('cp -rf ' + tmp + ' /etc/opt/ss5') |
|
||||||
mw.execShell('cp -rf ' + tmp + ' ' + getServerDir()) |
|
||||||
|
|
||||||
init_file = '/etc/init.d/ss5' |
|
||||||
if os.path.exists(init_file): |
|
||||||
mw.execShell('chmod +x ' + init_file) |
|
||||||
|
|
||||||
ss5_pwd = getServerDir() + '/ss5.passwd' |
|
||||||
if not os.path.exists(ss5_pwd): |
|
||||||
tmp = getPluginDir() + '/tmp/ss5.passwd' |
|
||||||
|
|
||||||
if not os.path.exists(tmp): |
|
||||||
mw.execShell('cp -rf ' + tmp + ' /etc/opt/ss5') |
|
||||||
mw.execShell('cp -rf ' + tmp + ' ' + getServerDir()) |
|
||||||
|
|
||||||
|
|
||||||
def start(): |
|
||||||
initConf() |
|
||||||
|
|
||||||
if mw.isAppleSystem(): |
|
||||||
return "Apple Computer does not support" |
|
||||||
|
|
||||||
data = mw.execShell('service ss5 start') |
|
||||||
if data[1] == '': |
|
||||||
return 'ok' |
|
||||||
return data[1] |
|
||||||
|
|
||||||
|
|
||||||
def stop(): |
|
||||||
if mw.isAppleSystem(): |
|
||||||
return "Apple Computer does not support" |
|
||||||
|
|
||||||
data = mw.execShell('service ss5 stop') |
|
||||||
if data[1] == '': |
|
||||||
return 'ok' |
|
||||||
return data[1] |
|
||||||
|
|
||||||
|
|
||||||
def restart(): |
|
||||||
if mw.isAppleSystem(): |
|
||||||
return "Apple Computer does not support" |
|
||||||
|
|
||||||
data = mw.execShell('service ss5 restart') |
|
||||||
if data[1] == '': |
|
||||||
return 'ok' |
|
||||||
return data[1] |
|
||||||
|
|
||||||
|
|
||||||
def reload(): |
|
||||||
data = mw.execShell('service ss5 reload') |
|
||||||
if data[1] == '': |
|
||||||
return 'ok' |
|
||||||
return data[1] |
|
||||||
|
|
||||||
|
|
||||||
def getPathFile(): |
|
||||||
if mw.isAppleSystem(): |
|
||||||
return getServerDir() + '/ss5.conf' |
|
||||||
return '/etc/opt/ss5/ss5.conf' |
|
||||||
|
|
||||||
|
|
||||||
def getPathFilePwd(): |
|
||||||
if mw.isAppleSystem(): |
|
||||||
return getServerDir() + '/ss5.passwd' |
|
||||||
return '/etc/opt/ss5/ss5.passwd' |
|
||||||
|
|
||||||
|
|
||||||
def getPathFilePort(): |
|
||||||
return '/etc/sysconfig/ss5' |
|
||||||
|
|
||||||
|
|
||||||
def initdStatus(): |
|
||||||
if not app_debug: |
|
||||||
if mw.isAppleSystem(): |
|
||||||
return "Apple Computer does not support" |
|
||||||
initd_bin = getInitDFile() |
|
||||||
if os.path.exists(initd_bin): |
|
||||||
return 'ok' |
|
||||||
return 'fail' |
|
||||||
|
|
||||||
|
|
||||||
def initdInstall(): |
|
||||||
import shutil |
|
||||||
if not app_debug: |
|
||||||
if mw.isAppleSystem(): |
|
||||||
return "Apple Computer does not support" |
|
||||||
|
|
||||||
source_bin = initDreplace() |
|
||||||
initd_bin = getInitDFile() |
|
||||||
shutil.copyfile(source_bin, initd_bin) |
|
||||||
mw.execShell('chmod +x ' + initd_bin) |
|
||||||
mw.execShell('chkconfig --add ' + getPluginName()) |
|
||||||
return 'ok' |
|
||||||
|
|
||||||
|
|
||||||
def initdUinstall(): |
|
||||||
if not app_debug: |
|
||||||
if mw.isAppleSystem(): |
|
||||||
return "Apple Computer does not support" |
|
||||||
|
|
||||||
mw.execShell('chkconfig --del ' + getPluginName()) |
|
||||||
initd_bin = getInitDFile() |
|
||||||
os.remove(initd_bin) |
|
||||||
return 'ok' |
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": |
|
||||||
func = sys.argv[1] |
|
||||||
if func == 'status': |
|
||||||
print(status()) |
|
||||||
elif func == 'start': |
|
||||||
print(start()) |
|
||||||
elif func == 'stop': |
|
||||||
print(stop()) |
|
||||||
elif func == 'restart': |
|
||||||
print(restart()) |
|
||||||
elif func == 'reload': |
|
||||||
print(reload()) |
|
||||||
elif func == 'conf': |
|
||||||
print(getPathFile()) |
|
||||||
elif func == 'conf_pwd': |
|
||||||
print(getPathFilePwd()) |
|
||||||
elif func == 'conf_port': |
|
||||||
print(getPathFilePort()) |
|
||||||
elif func == 'initd_status': |
|
||||||
print(initdStatus()) |
|
||||||
elif func == 'initd_install': |
|
||||||
print(initdInstall()) |
|
||||||
elif func == 'initd_uninstall': |
|
||||||
print(initdUinstall()) |
|
||||||
else: |
|
||||||
print('error') |
|
@ -1,14 +0,0 @@ |
|||||||
{ |
|
||||||
"title":"socket5", |
|
||||||
"tip":"soft", |
|
||||||
"name":"socket5", |
|
||||||
"type":"运行环境", |
|
||||||
"ps":"socket5", |
|
||||||
"versions":"1.0", |
|
||||||
"shell":"install.sh", |
|
||||||
"checks":"server/socket5", |
|
||||||
"author":"midoks", |
|
||||||
"home":"https://github.com/teddysun/across/blob/master/socket5.sh", |
|
||||||
"date":"2021-01-29", |
|
||||||
"pid": "5" |
|
||||||
} |
|
@ -1,83 +0,0 @@ |
|||||||
#!/bin/sh |
|
||||||
# |
|
||||||
# chkconfig: 345 20 80 |
|
||||||
# description: This script takes care of starting \ |
|
||||||
# and stopping ss5 |
|
||||||
# |
|
||||||
|
|
||||||
OS=`uname -s` |
|
||||||
if [ $OS = "Linux" ] || [ $OS = "SunOS" ]; then |
|
||||||
|
|
||||||
# Source function library. |
|
||||||
. /etc/rc.d/init.d/functions |
|
||||||
|
|
||||||
# Source networking configuration. |
|
||||||
. /etc/sysconfig/network |
|
||||||
|
|
||||||
# Check that networking is up. |
|
||||||
[ ${NETWORKING} = "no" ] && exit 0 |
|
||||||
|
|
||||||
[ -f /usr/sbin/ss5 ] || exit 0 |
|
||||||
fi |
|
||||||
|
|
||||||
# Test custom variables |
|
||||||
test -f /etc/sysconfig/ss5 && . /etc/sysconfig/ss5 |
|
||||||
|
|
||||||
# See how we were called. |
|
||||||
case "$1" in |
|
||||||
start) |
|
||||||
# Start daemon. |
|
||||||
echo -n "Starting ss5... " |
|
||||||
if [ $OS = "Linux" ]; then |
|
||||||
daemon /usr/sbin/ss5 -t $SS5_OPTS |
|
||||||
touch /var/lock/subsys/ss5 |
|
||||||
else |
|
||||||
if [ $OS = "SunOS" ]; then |
|
||||||
/usr/sbin/ss5 -t |
|
||||||
touch /var/lock/subsys/ss5 |
|
||||||
else |
|
||||||
/usr/local/sbin/ss5 -t |
|
||||||
fi |
|
||||||
fi |
|
||||||
echo "done" |
|
||||||
;; |
|
||||||
stop) |
|
||||||
# Stop daemon. |
|
||||||
echo "Shutting down ss5... " |
|
||||||
if [ $OS = "Linux" ] || [ $OS = "SunOS" ]; then |
|
||||||
killproc ss5 |
|
||||||
rm -f /var/lock/subsys/ss5 |
|
||||||
else |
|
||||||
killall ss5 |
|
||||||
fi |
|
||||||
rm -f /var/run/ss5/ss5.pid |
|
||||||
echo "done" |
|
||||||
;; |
|
||||||
reload) |
|
||||||
# Reload configuration |
|
||||||
if [ $OS = "Linux" ] || [ $OS = "SunOS" ]; then |
|
||||||
echo -n "Reloading ss5... " |
|
||||||
killproc ss5 -1 |
|
||||||
else |
|
||||||
pkill -HUP ss5 |
|
||||||
fi |
|
||||||
echo "done reload" |
|
||||||
;; |
|
||||||
restart) |
|
||||||
# Restart daemon |
|
||||||
echo -n "Restarting ss5... " |
|
||||||
$0 stop |
|
||||||
$0 start |
|
||||||
;; |
|
||||||
status) |
|
||||||
if [ $OS = "Linux" ] || [ $OS = "SunOS" ]; then |
|
||||||
status ss5 |
|
||||||
fi |
|
||||||
;; |
|
||||||
*) |
|
||||||
echo "Usage: ss5 {start|stop|status|restart|reload}" |
|
||||||
exit 1 |
|
||||||
;; |
|
||||||
esac |
|
||||||
|
|
||||||
exit 0 |
|
@ -1,49 +0,0 @@ |
|||||||
#!/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 |
|
||||||
SYSOS=`uname` |
|
||||||
|
|
||||||
Install_socket5() |
|
||||||
{ |
|
||||||
yum -y install gcc automake make pam-devel openldap-devel cyrus-sasl-devel |
|
||||||
|
|
||||||
isStart="" |
|
||||||
echo '正在安装脚本文件...' > $install_tmp |
|
||||||
mkdir -p $serverPath/source |
|
||||||
mkdir -p $serverPath/socket5 |
|
||||||
|
|
||||||
if [ ! -f $serverPath/source/ss5-3.8.9-8.tar.gz ];then |
|
||||||
wget -O $serverPath/source/ss5-3.8.9-8.tar.gz http://downloads.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz |
|
||||||
fi |
|
||||||
echo '1.0' > $serverPath/socket5/version.pl |
|
||||||
|
|
||||||
cd $serverPath/source && tar -xzvf ss5-3.8.9-8.tar.gz |
|
||||||
cd $serverPath/source/ss5-3.8.9 && ./configure && make && make install |
|
||||||
|
|
||||||
echo 'install complete' > $install_tmp |
|
||||||
} |
|
||||||
|
|
||||||
Uninstall_socket5() |
|
||||||
{ |
|
||||||
rm -rf $serverPath/socket5 |
|
||||||
rm -rf /usr/sbin/ss5 |
|
||||||
service ss5 stop |
|
||||||
rm -rf /etc/init.d/ss5 |
|
||||||
echo "Uninstall completed" > $install_tmp |
|
||||||
} |
|
||||||
|
|
||||||
action=$1 |
|
||||||
if [ "${1}" == 'install' ];then |
|
||||||
Install_socket5 |
|
||||||
else |
|
||||||
Uninstall_socket5 |
|
||||||
fi |
|
@ -1,57 +0,0 @@ |
|||||||
function str2Obj(str){ |
|
||||||
var data = {}; |
|
||||||
kv = str.split('&'); |
|
||||||
for(i in kv){ |
|
||||||
v = kv[i].split('='); |
|
||||||
data[v[0]] = v[1]; |
|
||||||
} |
|
||||||
return data; |
|
||||||
} |
|
||||||
|
|
||||||
function lpPost(method,args,callback, title){ |
|
||||||
|
|
||||||
var _args = null;
|
|
||||||
if (typeof(args) == 'string'){ |
|
||||||
_args = JSON.stringify(str2Obj(args)); |
|
||||||
} else { |
|
||||||
_args = JSON.stringify(args); |
|
||||||
} |
|
||||||
|
|
||||||
var _title = '正在获取...'; |
|
||||||
if (typeof(title) != 'undefined'){ |
|
||||||
_title = title; |
|
||||||
} |
|
||||||
|
|
||||||
var loadT = layer.msg(_title, { icon: 16, time: 0, shade: 0.3 }); |
|
||||||
$.post('/plugins/run', {name:'l2tp', func:method, args:_args}, function(data) { |
|
||||||
layer.close(loadT); |
|
||||||
if (!data.status){ |
|
||||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
if(typeof(callback) == 'function'){ |
|
||||||
callback(data); |
|
||||||
} |
|
||||||
},'json');
|
|
||||||
} |
|
||||||
|
|
||||||
function lpAsyncPost(method,args){ |
|
||||||
var _args = null;
|
|
||||||
if (typeof(args) == 'string'){ |
|
||||||
_args = JSON.stringify(str2Obj(args)); |
|
||||||
} else { |
|
||||||
_args = JSON.stringify(args); |
|
||||||
} |
|
||||||
|
|
||||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); |
|
||||||
return syncPost('/plugins/run', {name:'l2tp', func:method, args:_args}); |
|
||||||
} |
|
||||||
|
|
||||||
function readme(){ |
|
||||||
var readme = '<ul class="help-info-text c7">'; |
|
||||||
readme += '<li>默认需开放端口:UDP:1080</li>'; |
|
||||||
readme += '<li><a href="https://github.com/midoks/mdserver-web/wiki/%E6%8F%92%E4%BB%B6%E7%AE%A1%E7%90%86%5BSOCK5%5D">参考</a></li>'; |
|
||||||
readme += '</ul>'; |
|
||||||
$('.soft-man-con').html(readme);
|
|
||||||
} |
|
@ -1,8 +0,0 @@ |
|||||||
# 无用户配置 |
|
||||||
auth 0.0.0.0/0 - - |
|
||||||
permit - 0.0.0.0/0 - 0.0.0.0/0 - - - - - |
|
||||||
|
|
||||||
|
|
||||||
# 用户配置 |
|
||||||
#auth 0.0.0.0/0 - u |
|
||||||
#permit - 0.0.0.0/0 - 0.0.0.0/0 - - - - - |
|
@ -1 +0,0 @@ |
|||||||
test test |
|
Before Width: | Height: | Size: 439 B |
@ -1,20 +0,0 @@ |
|||||||
<div class="bt-form"> |
|
||||||
<div class="bt-w-main"> |
|
||||||
<div class="bt-w-menu"> |
|
||||||
<p class="bgw" onclick="pluginService('v2ray');">服务</p> |
|
||||||
<p onclick="pluginInitD('v2ray');">自启动</p> |
|
||||||
<p onclick="pluginConfig('v2ray');">配置修改</p> |
|
||||||
<p onclick="pluginLogs('v2ray','','run_log');">运行日志</p> |
|
||||||
<p onclick="pluginLogs('v2ray','','error_log');">错误日志</p> |
|
||||||
<p onclick="readme();">说明</p> |
|
||||||
</div> |
|
||||||
<div class="bt-w-con pd15"> |
|
||||||
<div class="soft-man-con"></div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<script type="text/javascript"> |
|
||||||
$.getScript( "/plugins/file?name=v2ray&f=js/v2ray.js", function(){ |
|
||||||
pluginService('v2ray'); |
|
||||||
}); |
|
||||||
</script> |
|
@ -1,173 +0,0 @@ |
|||||||
# coding:utf-8 |
|
||||||
|
|
||||||
import sys |
|
||||||
import io |
|
||||||
import os |
|
||||||
import time |
|
||||||
import shutil |
|
||||||
|
|
||||||
sys.path.append(os.getcwd() + "/class/core") |
|
||||||
import mw |
|
||||||
|
|
||||||
app_debug = False |
|
||||||
if mw.isAppleSystem(): |
|
||||||
app_debug = True |
|
||||||
|
|
||||||
|
|
||||||
def getPluginName(): |
|
||||||
return 'v2ray' |
|
||||||
|
|
||||||
|
|
||||||
def getPluginDir(): |
|
||||||
return mw.getPluginDir() + '/' + getPluginName() |
|
||||||
|
|
||||||
|
|
||||||
def getServerDir(): |
|
||||||
return mw.getServerDir() + '/' + getPluginName() |
|
||||||
|
|
||||||
|
|
||||||
def getArgs(): |
|
||||||
args = sys.argv[2:] |
|
||||||
tmp = {} |
|
||||||
args_len = len(args) |
|
||||||
|
|
||||||
if args_len == 1: |
|
||||||
t = args[0].strip('{').strip('}') |
|
||||||
t = t.split(':') |
|
||||||
tmp[t[0]] = t[1] |
|
||||||
elif args_len > 1: |
|
||||||
for i in range(len(args)): |
|
||||||
t = args[i].split(':') |
|
||||||
tmp[t[0]] = t[1] |
|
||||||
|
|
||||||
return tmp |
|
||||||
|
|
||||||
|
|
||||||
def checkArgs(data, ck=[]): |
|
||||||
for i in range(len(ck)): |
|
||||||
if not ck[i] in data: |
|
||||||
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!')) |
|
||||||
return (True, mw.returnJson(True, 'ok')) |
|
||||||
|
|
||||||
|
|
||||||
def status(): |
|
||||||
cmd = "ps -ef|grep v2ray |grep -v grep | grep -v 'mdserver-web'| awk '{print $2}'" |
|
||||||
data = mw.execShell(cmd) |
|
||||||
if data[0] == '': |
|
||||||
return 'stop' |
|
||||||
return 'start' |
|
||||||
|
|
||||||
|
|
||||||
def start(): |
|
||||||
|
|
||||||
shell_cmd = 'service ' + getPluginName() + ' start' |
|
||||||
data = mw.execShell(shell_cmd) |
|
||||||
|
|
||||||
if data[0] == '': |
|
||||||
return 'ok' |
|
||||||
return data[1] |
|
||||||
|
|
||||||
|
|
||||||
def stop(): |
|
||||||
shell_cmd = 'service ' + getPluginName() + ' stop' |
|
||||||
|
|
||||||
data = mw.execShell(shell_cmd) |
|
||||||
if data[0] == '': |
|
||||||
return 'ok' |
|
||||||
return data[1] |
|
||||||
|
|
||||||
|
|
||||||
def restart(): |
|
||||||
shell_cmd = 'service ' + getPluginName() + ' restart' |
|
||||||
data = mw.execShell(shell_cmd) |
|
||||||
|
|
||||||
log_file = getLog() |
|
||||||
if os.path.exists(log_file): |
|
||||||
clear_log_cmd = "echo '' > " + log_file |
|
||||||
mw.execShell(clear_log_cmd) |
|
||||||
|
|
||||||
if data[0] == '': |
|
||||||
return 'ok' |
|
||||||
return data[1] |
|
||||||
|
|
||||||
|
|
||||||
def reload(): |
|
||||||
shell_cmd = 'service ' + getPluginName() + ' reload' |
|
||||||
data = mw.execShell(shell_cmd) |
|
||||||
if data[0] == '': |
|
||||||
return 'ok' |
|
||||||
return data[1] |
|
||||||
|
|
||||||
|
|
||||||
def getPathFile(): |
|
||||||
if mw.isAppleSystem(): |
|
||||||
return getServerDir() + '/config.json' |
|
||||||
return '/usr/local/etc/v2ray/config.json' |
|
||||||
|
|
||||||
|
|
||||||
def getInitDFile(): |
|
||||||
if app_debug: |
|
||||||
return '/tmp/' + getPluginName() |
|
||||||
return '/etc/init.d/' + getPluginName() |
|
||||||
|
|
||||||
|
|
||||||
def initdStatus(): |
|
||||||
shell_cmd = 'systemctl status v2ray.service | grep loaded | grep "enabled;"' |
|
||||||
data = mw.execShell(shell_cmd) |
|
||||||
if data[0] == '': |
|
||||||
return 'fail' |
|
||||||
return 'ok' |
|
||||||
|
|
||||||
|
|
||||||
def initdInstall(): |
|
||||||
import shutil |
|
||||||
if not app_debug: |
|
||||||
if mw.isAppleSystem(): |
|
||||||
return "Apple Computer does not support" |
|
||||||
|
|
||||||
mw.execShell('systemctl enable ' + getPluginName()) |
|
||||||
return 'ok' |
|
||||||
|
|
||||||
|
|
||||||
def initdUinstall(): |
|
||||||
if not app_debug: |
|
||||||
if mw.isAppleSystem(): |
|
||||||
return "Apple Computer does not support" |
|
||||||
|
|
||||||
mw.execShell('systemctl disable ' + getPluginName()) |
|
||||||
return 'ok' |
|
||||||
|
|
||||||
|
|
||||||
def getLog(): |
|
||||||
return '/var/log/v2ray/access.log' |
|
||||||
|
|
||||||
|
|
||||||
def getErrLog(): |
|
||||||
return '/var/log/v2ray/error.log' |
|
||||||
|
|
||||||
if __name__ == "__main__": |
|
||||||
func = sys.argv[1] |
|
||||||
if func == 'status': |
|
||||||
print(status()) |
|
||||||
elif func == 'start': |
|
||||||
print(start()) |
|
||||||
elif func == 'stop': |
|
||||||
print(stop()) |
|
||||||
elif func == 'restart': |
|
||||||
print(restart()) |
|
||||||
elif func == 'reload': |
|
||||||
print(reload()) |
|
||||||
elif func == 'conf': |
|
||||||
print(getPathFile()) |
|
||||||
elif func == 'initd_status': |
|
||||||
print(initdStatus()) |
|
||||||
elif func == 'initd_install': |
|
||||||
print(initdInstall()) |
|
||||||
elif func == 'initd_uninstall': |
|
||||||
print(initdUinstall()) |
|
||||||
elif func == 'run_log': |
|
||||||
print(getLog()) |
|
||||||
elif func == 'error_log': |
|
||||||
print(getErrLog()) |
|
||||||
else: |
|
||||||
print('error') |
|
@ -1,15 +0,0 @@ |
|||||||
{ |
|
||||||
"title":"v2ray", |
|
||||||
"tip":"soft", |
|
||||||
"name":"v2ray", |
|
||||||
"type":"运行环境", |
|
||||||
"ps":"v2ray", |
|
||||||
"versions":"1.0", |
|
||||||
"shell":"install.sh", |
|
||||||
"checks":"server/v2ray", |
|
||||||
"path": "server/v2ray", |
|
||||||
"author":"midoks", |
|
||||||
"home":"https://github.com/v2ray/v2ray-core", |
|
||||||
"date":"2020-06-08", |
|
||||||
"pid": "5" |
|
||||||
} |
|
@ -1,48 +0,0 @@ |
|||||||
#!/bin/bash |
|
||||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
|
||||||
export PATH |
|
||||||
|
|
||||||
# case1 https://toutyrater.github.io/advanced/wss_and_web.html |
|
||||||
|
|
||||||
|
|
||||||
curPath=`pwd` |
|
||||||
rootPath=$(dirname "$curPath") |
|
||||||
rootPath=$(dirname "$rootPath") |
|
||||||
serverPath=$(dirname "$rootPath") |
|
||||||
|
|
||||||
|
|
||||||
install_tmp=${rootPath}/tmp/mw_install.pl |
|
||||||
|
|
||||||
SYSOS=`uname` |
|
||||||
|
|
||||||
Install_v2ray() |
|
||||||
{ |
|
||||||
isStart="" |
|
||||||
echo '正在安装脚本文件...' > $install_tmp |
|
||||||
mkdir -p $serverPath/v2ray |
|
||||||
echo '1.0' > $serverPath/v2ray/version.pl |
|
||||||
|
|
||||||
if [ "Darwin" == "$SYSOS" ];then |
|
||||||
echo 'macosx unavailable' > $install_tmp |
|
||||||
cat $curPath/tmp/v2ray.json > /usr/local/etc/v2ray/config.json |
|
||||||
exit 0 |
|
||||||
fi |
|
||||||
|
|
||||||
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) |
|
||||||
cat $curPath/tmp/v2ray.json > /usr/local/etc/v2ray/config.json |
|
||||||
|
|
||||||
echo 'install complete' > $install_tmp |
|
||||||
} |
|
||||||
|
|
||||||
Uninstall_v2ray() |
|
||||||
{ |
|
||||||
rm -rf $serverPath/v2ray |
|
||||||
echo "Uninstall completed" > $install_tmp |
|
||||||
} |
|
||||||
|
|
||||||
action=$1 |
|
||||||
if [ "${1}" == 'install' ];then |
|
||||||
Install_v2ray |
|
||||||
else |
|
||||||
Uninstall_v2ray |
|
||||||
fi |
|
@ -1,92 +0,0 @@ |
|||||||
function str2Obj(str){ |
|
||||||
var data = {}; |
|
||||||
kv = str.split('&'); |
|
||||||
for(i in kv){ |
|
||||||
v = kv[i].split('='); |
|
||||||
data[v[0]] = v[1]; |
|
||||||
} |
|
||||||
return data; |
|
||||||
} |
|
||||||
|
|
||||||
function lpPost(method,args,callback, title){ |
|
||||||
|
|
||||||
var _args = null;
|
|
||||||
if (typeof(args) == 'string'){ |
|
||||||
_args = JSON.stringify(str2Obj(args)); |
|
||||||
} else { |
|
||||||
_args = JSON.stringify(args); |
|
||||||
} |
|
||||||
|
|
||||||
var _title = '正在获取...'; |
|
||||||
if (typeof(title) != 'undefined'){ |
|
||||||
_title = title; |
|
||||||
} |
|
||||||
|
|
||||||
var loadT = layer.msg(_title, { icon: 16, time: 0, shade: 0.3 }); |
|
||||||
$.post('/plugins/run', {name:'shadowsocks', func:method, args:_args}, function(data) { |
|
||||||
layer.close(loadT); |
|
||||||
if (!data.status){ |
|
||||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
if(typeof(callback) == 'function'){ |
|
||||||
callback(data); |
|
||||||
} |
|
||||||
},'json');
|
|
||||||
} |
|
||||||
|
|
||||||
function lpAsyncPost(method,args){ |
|
||||||
var _args = null;
|
|
||||||
if (typeof(args) == 'string'){ |
|
||||||
_args = JSON.stringify(str2Obj(args)); |
|
||||||
} else { |
|
||||||
_args = JSON.stringify(args); |
|
||||||
} |
|
||||||
|
|
||||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); |
|
||||||
return syncPost('/plugins/run', {name:'l2tp', func:method, args:_args}); |
|
||||||
} |
|
||||||
|
|
||||||
function userList(){ |
|
||||||
lpPost('user_list', '' ,function(data){ |
|
||||||
var rdata = $.parseJSON(data['data']); |
|
||||||
|
|
||||||
if (!rdata['status']){ |
|
||||||
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']}); |
|
||||||
return; |
|
||||||
} |
|
||||||
var list = rdata['data']; |
|
||||||
|
|
||||||
var con = ''; |
|
||||||
con += '<div class="divtable" style="margin-top:5px;"><table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">'; |
|
||||||
con += '<thead><tr>'; |
|
||||||
con += '<th>用户</th>'; |
|
||||||
con += '<th>密码</th>'; |
|
||||||
con += '<th>操作(<a class="btlink" onclick="addUser()">添加</a>)</th>'; |
|
||||||
con += '</tr></thead>'; |
|
||||||
|
|
||||||
con += '<tbody>'; |
|
||||||
|
|
||||||
for (var i = 0; i < list.length; i++) { |
|
||||||
con += '<tr>'+ |
|
||||||
'<td>' + list[i]['user']+'</td>' + |
|
||||||
'<td>' + list[i]['pwd']+'</td>' + |
|
||||||
'<td><a class="btlink" onclick="modUser(\''+list[i]['user']+'\')">改密</a>|<a class="btlink" onclick="delUser(\''+list[i]['user']+'\')">删除</a></td></tr>'; |
|
||||||
} |
|
||||||
|
|
||||||
con += '</tbody>'; |
|
||||||
con += '</table></div>'; |
|
||||||
|
|
||||||
$(".soft-man-con").html(con); |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function readme(){ |
|
||||||
var readme = '<ul class="help-info-text c7">'; |
|
||||||
readme += '<li>需开放配置文件[port_password]端口</li>'; |
|
||||||
readme += '</ul>'; |
|
||||||
$('.soft-man-con').html(readme); |
|
||||||
} |
|
@ -1,54 +0,0 @@ |
|||||||
{ |
|
||||||
"log" : { |
|
||||||
"access" : "/var/log/v2ray/access.log", |
|
||||||
"error" : "/var/log/v2ray/error.log", |
|
||||||
"loglevel":"warning" |
|
||||||
}, |
|
||||||
"inbounds": [{ |
|
||||||
"port": 34861, |
|
||||||
"listen": "127.0.0.1", |
|
||||||
"protocol": "vmess", |
|
||||||
"settings": { |
|
||||||
"clients": [ |
|
||||||
{ |
|
||||||
"id": "6e1e5234-05ee-45fe-b28d-80e91edb7f30", |
|
||||||
"alterId": 64 |
|
||||||
} |
|
||||||
] |
|
||||||
}, |
|
||||||
"streamSettings":{ |
|
||||||
"network": "ws", |
|
||||||
"wsSettings": { |
|
||||||
"path": "/ws" |
|
||||||
} |
|
||||||
} |
|
||||||
}], |
|
||||||
"outbounds": [{ |
|
||||||
"protocol": "freedom", |
|
||||||
"settings": {} |
|
||||||
},{ |
|
||||||
"protocol": "blackhole", |
|
||||||
"settings": {}, |
|
||||||
"tag": "blocked" |
|
||||||
}], |
|
||||||
"routing": { |
|
||||||
"rules": [ |
|
||||||
{ |
|
||||||
"type": "field", |
|
||||||
"ip": ["geoip:private"], |
|
||||||
"outboundTag": "blocked" |
|
||||||
} |
|
||||||
] |
|
||||||
}, |
|
||||||
"inboundDetour": [ |
|
||||||
{ |
|
||||||
"protocol": "shadowsocks", |
|
||||||
"port": 30008, |
|
||||||
"settings": { |
|
||||||
"method": "aes-128-gcm", |
|
||||||
"password": "123123123", |
|
||||||
"udp": false |
|
||||||
} |
|
||||||
} |
|
||||||
] |
|
||||||
} |
|
@ -0,0 +1,80 @@ |
|||||||
|
#!/bin/bash |
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
LANG=en_US.UTF-8 |
||||||
|
is64bit=`getconf LONG_BIT` |
||||||
|
|
||||||
|
if [ -f /etc/motd ];then |
||||||
|
echo "welcome to mdserver-web panel" > /etc/motd |
||||||
|
fi |
||||||
|
|
||||||
|
startTime=`date +%s` |
||||||
|
|
||||||
|
_os=`uname` |
||||||
|
echo "use system: ${_os}" |
||||||
|
|
||||||
|
if [ "$EUID" -ne 0 ] |
||||||
|
then echo "Please run as root!" |
||||||
|
exit |
||||||
|
fi |
||||||
|
|
||||||
|
if grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then |
||||||
|
ln -sf /bin/bash /bin/sh |
||||||
|
#sudo dpkg-reconfigure dash |
||||||
|
fi |
||||||
|
|
||||||
|
if grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then |
||||||
|
ln -sf /bin/bash /bin/sh |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
if [ ${_os} == "Darwin" ]; then |
||||||
|
OSNAME='macos' |
||||||
|
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then |
||||||
|
OSNAME='centos' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then |
||||||
|
OSNAME='fedora' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then |
||||||
|
OSNAME='rocky' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then |
||||||
|
OSNAME='alma' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then |
||||||
|
OSNAME='debian' |
||||||
|
apt install -y wget zip unzip |
||||||
|
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then |
||||||
|
OSNAME='ubuntu' |
||||||
|
apt install -y wget zip unzip |
||||||
|
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then |
||||||
|
OSNAME='raspbian' |
||||||
|
else |
||||||
|
OSNAME='unknow' |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
if [ $OSNAME != "macos" ];then |
||||||
|
mkdir -p /www/server |
||||||
|
mkdir -p /www/wwwroot |
||||||
|
mkdir -p /www/wwwlogs |
||||||
|
mkdir -p /www/backup/database |
||||||
|
mkdir -p /www/backup/site |
||||||
|
|
||||||
|
if [ ! -d /www/server/mdserver-web ];then |
||||||
|
wget -O /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip |
||||||
|
cd /tmp && unzip /tmp/master.zip |
||||||
|
mv /tmp/mdserver-web-master /www/server/mdserver-web |
||||||
|
rm -rf /tmp/master.zip |
||||||
|
rm -rf /tmp/mdserver-web-master |
||||||
|
fi |
||||||
|
fi |
||||||
|
|
||||||
|
echo "use system version: ${OSNAME}" |
||||||
|
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install/${OSNAME}.sh | bash |
||||||
|
|
||||||
|
|
||||||
|
endTime=`date +%s` |
||||||
|
((outTime=(${endTime}-${startTime})/60)) |
||||||
|
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" |
@ -0,0 +1,80 @@ |
|||||||
|
#!/bin/bash |
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
LANG=en_US.UTF-8 |
||||||
|
is64bit=`getconf LONG_BIT` |
||||||
|
|
||||||
|
if [ -f /etc/motd ];then |
||||||
|
echo "welcome to mdserver-web panel" > /etc/motd |
||||||
|
fi |
||||||
|
|
||||||
|
startTime=`date +%s` |
||||||
|
|
||||||
|
_os=`uname` |
||||||
|
echo "use system: ${_os}" |
||||||
|
|
||||||
|
if [ "$EUID" -ne 0 ] |
||||||
|
then echo "Please run as root!" |
||||||
|
exit |
||||||
|
fi |
||||||
|
|
||||||
|
if grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then |
||||||
|
ln -sf /bin/bash /bin/sh |
||||||
|
#sudo dpkg-reconfigure dash |
||||||
|
fi |
||||||
|
|
||||||
|
if grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then |
||||||
|
ln -sf /bin/bash /bin/sh |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
if [ ${_os} == "Darwin" ]; then |
||||||
|
OSNAME='macos' |
||||||
|
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then |
||||||
|
OSNAME='centos' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then |
||||||
|
OSNAME='fedora' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then |
||||||
|
OSNAME='rocky' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then |
||||||
|
OSNAME='alma' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then |
||||||
|
OSNAME='debian' |
||||||
|
apt install -y wget zip unzip |
||||||
|
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then |
||||||
|
OSNAME='ubuntu' |
||||||
|
apt install -y wget zip unzip |
||||||
|
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then |
||||||
|
OSNAME='raspbian' |
||||||
|
else |
||||||
|
OSNAME='unknow' |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
if [ $OSNAME != "macos" ];then |
||||||
|
mkdir -p /www/server |
||||||
|
mkdir -p /www/wwwroot |
||||||
|
mkdir -p /www/wwwlogs |
||||||
|
mkdir -p /www/backup/database |
||||||
|
mkdir -p /www/backup/site |
||||||
|
|
||||||
|
if [ ! -d /www/server/mdserver-web ];then |
||||||
|
wget -O /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip |
||||||
|
cd /tmp && unzip /tmp/dev.zip |
||||||
|
mv /tmp/mdserver-web-dev /www/server/mdserver-web |
||||||
|
rm -rf /tmp/dev.zip |
||||||
|
rm -rf /tmp/mdserver-web-dev |
||||||
|
fi |
||||||
|
fi |
||||||
|
|
||||||
|
echo "use system version: ${OSNAME}" |
||||||
|
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install/${OSNAME}.sh | bash |
||||||
|
|
||||||
|
|
||||||
|
endTime=`date +%s` |
||||||
|
((outTime=(${endTime}-${startTime})/60)) |
||||||
|
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" |
@ -0,0 +1,59 @@ |
|||||||
|
#!/bin/bash |
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
LANG=en_US.UTF-8 |
||||||
|
is64bit=`getconf LONG_BIT` |
||||||
|
|
||||||
|
startTime=`date +%s` |
||||||
|
|
||||||
|
_os=`uname` |
||||||
|
echo "use system: ${_os}" |
||||||
|
|
||||||
|
if grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then |
||||||
|
sudo ln -sf /bin/bash /bin/sh |
||||||
|
#sudo dpkg-reconfigure dash |
||||||
|
fi |
||||||
|
|
||||||
|
if grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then |
||||||
|
sudo ln -sf /bin/bash /bin/sh |
||||||
|
fi |
||||||
|
|
||||||
|
if [ ${_os} == "Darwin" ]; then |
||||||
|
OSNAME='macos' |
||||||
|
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then |
||||||
|
OSNAME='centos' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then |
||||||
|
OSNAME='fedora' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then |
||||||
|
OSNAME='rocky' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then |
||||||
|
OSNAME='alma' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then |
||||||
|
OSNAME='debian' |
||||||
|
apt install -y wget zip unzip |
||||||
|
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then |
||||||
|
OSNAME='ubuntu' |
||||||
|
apt install -y wget zip unzip |
||||||
|
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then |
||||||
|
OSNAME='raspbian' |
||||||
|
else |
||||||
|
OSNAME='unknow' |
||||||
|
fi |
||||||
|
|
||||||
|
wget -O /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip |
||||||
|
cd /tmp && unzip /tmp/master.zip |
||||||
|
mv /tmp/mdserver-web-master /www/server/mdserver-web |
||||||
|
rm -rf /tmp/master.zip |
||||||
|
rm -rf /tmp/mdserver-web-master |
||||||
|
|
||||||
|
#pip uninstall public |
||||||
|
echo "use system version: ${OSNAME}" |
||||||
|
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update/${OSNAME}.sh | bash |
||||||
|
|
||||||
|
endTime=`date +%s` |
||||||
|
((outTime=($endTime-$startTime)/60)) |
||||||
|
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" |
@ -0,0 +1,59 @@ |
|||||||
|
#!/bin/bash |
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
LANG=en_US.UTF-8 |
||||||
|
is64bit=`getconf LONG_BIT` |
||||||
|
|
||||||
|
startTime=`date +%s` |
||||||
|
|
||||||
|
_os=`uname` |
||||||
|
echo "use system: ${_os}" |
||||||
|
|
||||||
|
if grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then |
||||||
|
sudo ln -sf /bin/bash /bin/sh |
||||||
|
#sudo dpkg-reconfigure dash |
||||||
|
fi |
||||||
|
|
||||||
|
if grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then |
||||||
|
sudo ln -sf /bin/bash /bin/sh |
||||||
|
fi |
||||||
|
|
||||||
|
if [ ${_os} == "Darwin" ]; then |
||||||
|
OSNAME='macos' |
||||||
|
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then |
||||||
|
OSNAME='centos' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then |
||||||
|
OSNAME='fedora' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then |
||||||
|
OSNAME='rocky' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then |
||||||
|
OSNAME='alma' |
||||||
|
yum install -y wget zip unzip |
||||||
|
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then |
||||||
|
OSNAME='debian' |
||||||
|
apt install -y wget zip unzip |
||||||
|
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then |
||||||
|
OSNAME='ubuntu' |
||||||
|
apt install -y wget zip unzip |
||||||
|
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then |
||||||
|
OSNAME='raspbian' |
||||||
|
else |
||||||
|
OSNAME='unknow' |
||||||
|
fi |
||||||
|
|
||||||
|
wget -O /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip |
||||||
|
cd /tmp && unzip /tmp/dev.zip |
||||||
|
mv /tmp/mdserver-web-dev /www/server/mdserver-web |
||||||
|
rm -rf /tmp/dev.zip |
||||||
|
rm -rf /tmp/mdserver-web-dev |
||||||
|
|
||||||
|
#pip uninstall public |
||||||
|
echo "use system version: ${OSNAME}" |
||||||
|
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update/${OSNAME}.sh | bash |
||||||
|
|
||||||
|
endTime=`date +%s` |
||||||
|
((outTime=($endTime-$startTime)/60)) |
||||||
|
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" |
Loading…
Reference in new issue