diff --git a/scripts/init.d/mw.tpl b/scripts/init.d/mw.tpl index 8563e9341..df632147a 100755 --- a/scripts/init.d/mw.tpl +++ b/scripts/init.d/mw.tpl @@ -215,6 +215,17 @@ mw_update_dev() cd /www/server/mdserver-web } +mw_mirror() +{ + cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"") + if [ ! -z "$cn" ];then + bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) + else + bash <(curl -sSL https://raw.githubusercontent.com/midoks/change-linux-mirrors/main/change-mirrors.sh) + fi + cd /www/server/mdserver-web +} + mw_install_app() { bash $mw_path/scripts/quick/app.sh diff --git a/tools.py b/tools.py index aaf879820..0cb7b43c7 100755 --- a/tools.py +++ b/tools.py @@ -47,20 +47,21 @@ def mwcli(mw_input=0): raw_tip = "======================================================" if not mw_input: print("===============mdserver-web cli tools=================") - print("(1) 重启面板服务") - print("(2) 停止面板服务") - print("(3) 启动面板服务") - print("(4) 重载面板服务") - print("(5) 修改面板端口") - print("(10) 查看面板默认信息") - print("(11) 修改面板密码") - print("(12) 修改面板用户名") - print("(13) 显示面板错误日志") - print("(20) 关闭BasicAuth认证") - print("(21) 解除域名绑定") - print("(100) 开启PHP52显示") - print("(101) 关闭PHP52显示") - print("(0) 取消") + print("(1) 重启面板服务") + print("(2) 停止面板服务") + print("(3) 启动面板服务") + print("(4) 重载面板服务") + print("(5) 修改面板端口") + print("(10) 查看面板默认信息") + print("(11) 修改面板密码") + print("(12) 修改面板用户名") + print("(13) 显示面板错误日志") + print("(20) 关闭BasicAuth认证") + print("(21) 解除域名绑定") + print("(100) 开启PHP52显示") + print("(101) 关闭PHP52显示") + print("(200) 切换Linux系统软件源") + print("(0) 取消") print(raw_tip) try: mw_input = input("请输入命令编号:") @@ -69,7 +70,7 @@ def mwcli(mw_input=0): except: mw_input = 0 - nums = [1, 2, 3, 4, 5, 10, 11, 12, 13, 20, 21, 100, 101] + nums = [1, 2, 3, 4, 5, 10, 11, 12, 13, 20, 21, 100, 101, 200] if not mw_input in nums: print(raw_tip) print("已取消!") @@ -135,6 +136,8 @@ def mwcli(mw_input=0): cont = re.sub("\"5.2.17\",", cont) mw.writeFile(php_conf, cont) print("|-执行PHP52隐藏成功!") + elif mw_input == 200: + os.system(INIT_CMD + " mirror") def set_panel_pwd(password, ncli=False):