This commit is contained in:
2026-09-11 22:48:34 +08:00
parent a61644861b
commit 4efdf7606c
23 changed files with 72 additions and 72 deletions

4
cli.sh
View File

@@ -19,12 +19,12 @@ fi
mw_start_task() mw_start_task()
{ {
isStart=$(ps aux |grep 'panel_task.py'|grep -v grep|awk '{print $2}') isStart=$(ps aux |grep 'panel_task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then if [ "$isStart" = '' ];then
echo -e "starting mw-tasks... \c" echo -e "starting mw-tasks... \c"
cd $DIR && python3 panel_task.py >> ${DIR}/logs/panel_task.log 2>&1 & cd $DIR && python3 panel_task.py >> ${DIR}/logs/panel_task.log 2>&1 &
sleep 0.3 sleep 0.3
isStart=$(ps aux |grep 'panel_task.py'|grep -v grep|awk '{print $2}') isStart=$(ps aux |grep 'panel_task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then if [ "$isStart" = '' ];then
echo -e "\033[31mfailed\033[0m" echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------' echo '------------------------------------------------------'
tail -n 20 $DIR/logs/panel_task.log tail -n 20 $DIR/logs/panel_task.log

View File

@@ -4,7 +4,7 @@ export PATH
#获取信息和版本 #获取信息和版本
_os=`uname` _os=`uname`
if [ ${_os} == "Darwin" ]; then if [ ${_os} = "Darwin" ]; then
OSNAME='macos' OSNAME='macos'
elif grep -Eq "openSUSE" /etc/*-release; then elif grep -Eq "openSUSE" /etc/*-release; then
OSNAME='opensuse' OSNAME='opensuse'
@@ -44,6 +44,6 @@ if [ -d /www/server/mdserver-web ];then
echo "$OSNAME" > /www/server/mdserver-web/data/osname.pl echo "$OSNAME" > /www/server/mdserver-web/data/osname.pl
fi fi
if [ "$OSNAME" == "macos" ];then if [ "$OSNAME" = "macos" ];then
echo "$OSNAME" echo "$OSNAME"
fi fi

View File

@@ -31,7 +31,7 @@ LOG_FILE=/var/log/mw-install.log
HTTP_PREFIX="https://" HTTP_PREFIX="https://"
LOCAL_ADDR=common LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn LOCAL_ADDR=cn
fi fi
@@ -106,7 +106,7 @@ function ChooseProxyURL(){
read -p "${CHOICE_A}" INPUT read -p "${CHOICE_A}" INPUT
# echo $INPUT # echo $INPUT
if [ "$INPUT" == "" ];then if [ "$INPUT" = "" ];then
INPUT=1 INPUT=1
TMP_INPUT=`expr $INPUT - 1` TMP_INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]} INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
@@ -157,7 +157,7 @@ startTime=`date +%s`
_os=`uname` _os=`uname`
echo "use system: ${_os}" echo "use system: ${_os}"
if [ ${_os} == "Darwin" ]; then if [ ${_os} = "Darwin" ]; then
OSNAME='macos' OSNAME='macos'
elif grep -Eqi "openSUSE" /etc/*-release; then elif grep -Eqi "openSUSE" /etc/*-release; then
OSNAME='opensuse' OSNAME='opensuse'
@@ -248,13 +248,13 @@ if [ $OSNAME != "macos" ];then
fi fi
echo "use system version: ${OSNAME}" echo "use system version: ${OSNAME}"
if [ "${OSNAME}" == "macos" ];then if [ "${OSNAME}" = "macos" ];then
curl --insecure -fsSL ${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/refs/heads/dev/scripts/install/macos.sh | bash curl --insecure -fsSL ${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/refs/heads/dev/scripts/install/macos.sh | bash
else else
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
fi fi
if [ "${OSNAME}" == "macos" ];then if [ "${OSNAME}" = "macos" ];then
echo "macos end" echo "macos end"
exit 0 exit 0
fi fi

View File

@@ -26,7 +26,7 @@ yum install -y brotli-devel
yum install -y vim-common yum install -y vim-common
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi
@@ -41,7 +41,7 @@ echo "SSH PORT:${SSH_PORT}"
# service iptables save # service iptables save
# iptables_status=`service iptables status | grep 'not running'` # iptables_status=`service iptables status | grep 'not running'`
# if [ "${iptables_status}" == '' ];then # if [ "${iptables_status}" = '' ];then
# service iptables restart # service iptables restart
# fi # fi

View File

@@ -61,7 +61,7 @@ apk add zstd-dev --force-broken-world
# apk add php-config # apk add php-config
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi

View File

@@ -33,7 +33,7 @@ yum install -y brotli-devel
yum install -y vim-common yum install -y vim-common
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi
@@ -48,7 +48,7 @@ echo "SSH PORT:${SSH_PORT}"
# service iptables save # service iptables save
# iptables_status=`service iptables status | grep 'not running'` # iptables_status=`service iptables status | grep 'not running'`
# if [ "${iptables_status}" == '' ];then # if [ "${iptables_status}" = '' ];then
# service iptables restart # service iptables restart
# fi # fi

View File

@@ -62,7 +62,7 @@ echo y | pacman -Syu icu
hwclock --systohc hwclock --systohc
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi
@@ -77,7 +77,7 @@ echo "SSH PORT:${SSH_PORT}"
# service iptables save # service iptables save
# iptables_status=`service iptables status | grep 'not running'` # iptables_status=`service iptables status | grep 'not running'`
# if [ "${iptables_status}" == '' ];then # if [ "${iptables_status}" = '' ];then
# service iptables restart # service iptables restart
# fi # fi

View File

@@ -14,7 +14,7 @@ setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi
@@ -52,7 +52,7 @@ yum install -y vim-common
# service iptables save # service iptables save
# iptables_status=`service iptables status | grep 'not running'` # iptables_status=`service iptables status | grep 'not running'`
# if [ "${iptables_status}" == '' ];then # if [ "${iptables_status}" = '' ];then
# service iptables restart # service iptables restart
# fi # fi

View File

@@ -5,9 +5,9 @@ export LANG=en_US.UTF-8
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; } function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" == "$1"; } function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" = "$1"; }
function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; } function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; }
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; } function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" = "$1"; }
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
@@ -16,13 +16,13 @@ cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
ln -sf /bin/bash /bin/sh ln -sf /bin/bash /bin/sh
__GET_BIT=`getconf LONG_BIT` __GET_BIT=`getconf LONG_BIT`
if [ "$__GET_BIT" == "32" ];then if [ "$__GET_BIT" = "32" ];then
# install rust | 32bit need # install rust | 32bit need
# curl https://sh.rustup.rs -sSf | sh # curl https://sh.rustup.rs -sSf | sh
apt install -y rustc apt install -y rustc
fi fi
if [ "$VERSION_ID" == "10" ];then if [ "$VERSION_ID" = "10" ];then
apt install -y rustc apt install -y rustc
fi fi
@@ -42,7 +42,7 @@ apt install ntpdate -y
apt install -y net-tools apt install -y net-tools
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi

View File

@@ -14,7 +14,7 @@ setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi
@@ -53,7 +53,7 @@ yum install -y vim-common
# service iptables save # service iptables save
# iptables_status=`service iptables status | grep 'not running'` # iptables_status=`service iptables status | grep 'not running'`
# if [ "${iptables_status}" == '' ];then # if [ "${iptables_status}" = '' ];then
# service iptables restart # service iptables restart
# fi # fi

View File

@@ -25,7 +25,7 @@ yum install -y vim-common
dnf install crontabs -y dnf install crontabs -y
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi
@@ -43,7 +43,7 @@ echo "SSH PORT:${SSH_PORT}"
# service iptables save # service iptables save
# iptables_status=`service iptables status | grep 'not running'` # iptables_status=`service iptables status | grep 'not running'`
# if [ "${iptables_status}" == '' ];then # if [ "${iptables_status}" = '' ];then
# service iptables restart # service iptables restart
# fi # fi

View File

@@ -81,7 +81,7 @@ echo "SSH PORT:${SSH_PORT}"
# 检测防火墙是否开启 # 检测防火墙是否开启
FW_ENABLE=`cat /etc/rc.conf | grep firewall_enable` FW_ENABLE=`cat /etc/rc.conf | grep firewall_enable`
if [ "$FW_ENABLE" == "" ];then if [ "$FW_ENABLE" = "" ];then
sysrc firewall_enable="YES" sysrc firewall_enable="YES"
sysrc firewall_type="open" sysrc firewall_type="open"
sysrc firewall_script="/etc/ipfw.rules" sysrc firewall_script="/etc/ipfw.rules"

View File

@@ -66,7 +66,7 @@ zypper install -y brotli-devel
# zypper install -y php-config # zypper install -y php-config
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi

View File

@@ -50,7 +50,7 @@ $PKGMGR install -y brotli-devel
$PKGMGR install -y vim-common $PKGMGR install -y vim-common
echo "install remi source" echo "install remi source"
if [ "$VERSION_ID" == "9" ];then if [ "$VERSION_ID" = "9" ];then
# dnf upgrade --refresh -y # dnf upgrade --refresh -y
dnf config-manager --set-enabled crb dnf config-manager --set-enabled crb
@@ -70,7 +70,7 @@ fi
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi
@@ -182,7 +182,7 @@ if [ "$VERSION_ID" -ge "8" ];then
fi fi
done done
if [ "$REPOS" == "--enablerepo=" ];then if [ "$REPOS" = "--enablerepo=" ];then
# if not find, reset emtpy # if not find, reset emtpy
REPOS='' REPOS=''
fi fi

View File

@@ -45,7 +45,7 @@ if [ -f /usr/sbin/iptables ];then
service iptables save service iptables save
iptables_status=`service iptables status | grep 'not running'` iptables_status=`service iptables status | grep 'not running'`
if [ "${iptables_status}" == '' ];then if [ "${iptables_status}" = '' ];then
service iptables restart service iptables restart
fi fi

View File

@@ -5,9 +5,9 @@ export LANG=en_US.UTF-8
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; } function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" == "$1"; } function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" = "$1"; }
function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; } function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; }
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; } function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" = "$1"; }
if grep -Eq "Ubuntu" /etc/*-release; then if grep -Eq "Ubuntu" /etc/*-release; then
@@ -86,7 +86,7 @@ else
fi fi
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
if [ "$SSH_PORT" == "" ];then if [ "$SSH_PORT" = "" ];then
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1` SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
SSH_PORT=${SSH_PORT_LINE/"Port "/""} SSH_PORT=${SSH_PORT_LINE/"Port "/""}
fi fi
@@ -223,7 +223,7 @@ apt install -y libmariadb-dev-compat
apt install -y patchelf apt install -y patchelf
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
if [ "${VERSION_ID}" == "22.04" ];then if [ "${VERSION_ID}" = "22.04" ];then
apt install -y python3-cffi apt install -y python3-cffi
pip3 install -U --force-reinstall --no-binary :all: gevent pip3 install -U --force-reinstall --no-binary :all: gevent
fi fi
@@ -239,7 +239,7 @@ cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data chmod 755 /www/server/mdserver-web/data
if [ "${VERSION_ID}" == "22.04" ];then if [ "${VERSION_ID}" = "22.04" ];then
apt install -y python3-cffi apt install -y python3-cffi
pip3 install -U --force-reinstall --no-binary :all: gevent pip3 install -U --force-reinstall --no-binary :all: gevent
fi fi

View File

@@ -36,7 +36,7 @@ LOG_FILE=/var/log/mw-install.log
HTTP_PREFIX="https://" HTTP_PREFIX="https://"
LOCAL_ADDR=common LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn LOCAL_ADDR=cn
fi fi
@@ -110,7 +110,7 @@ function ChooseProxyURL(){
read -p "${CHOICE_A}" INPUT read -p "${CHOICE_A}" INPUT
# echo $INPUT # echo $INPUT
if [ "$INPUT" == "" ];then if [ "$INPUT" = "" ];then
INPUT=1 INPUT=1
TMP_INPUT=`expr $INPUT - 1` TMP_INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]} INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
@@ -162,7 +162,7 @@ _os=`uname`
echo "use system: ${_os}" echo "use system: ${_os}"
if [ ${_os} == "Darwin" ]; then if [ ${_os} = "Darwin" ]; then
OSNAME='macos' OSNAME='macos'
elif grep -Eq "openSUSE" /etc/*-release; then elif grep -Eq "openSUSE" /etc/*-release; then
OSNAME='opensuse' OSNAME='opensuse'
@@ -257,13 +257,13 @@ fi
echo "use system version: ${OSNAME}" echo "use system version: ${OSNAME}"
if [ "${OSNAME}" == "macos" ];then if [ "${OSNAME}" = "macos" ];then
curl --insecure -fsSL ${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/refs/heads/dev/scripts/install/macos.sh | bash curl --insecure -fsSL ${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/refs/heads/dev/scripts/install/macos.sh | bash
else else
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
fi fi
if [ "${OSNAME}" == "macos" ];then if [ "${OSNAME}" = "macos" ];then
echo "macos end" echo "macos end"
exit 0 exit 0
fi fi

View File

@@ -2,9 +2,9 @@
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; } function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" == "$1"; } function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" = "$1"; }
function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; } function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; }
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; } function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" = "$1"; }
P_VER=`python3 -V | awk '{print $2}'` P_VER=`python3 -V | awk '{print $2}'`
echo "python:$P_VER" echo "python:$P_VER"
@@ -26,30 +26,30 @@ OSNAME=`cat ${rootPath}/data/osname.pl`
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
# system judge # system judge
if [ "$OSNAME" == "macos" ]; then if [ "$OSNAME" = "macos" ]; then
brew install libmemcached brew install libmemcached
brew install curl brew install curl
brew install zlib brew install zlib
brew install freetype brew install freetype
brew install openssl brew install openssl
brew install libzip brew install libzip
elif [ "$OSNAME" == "opensuse" ];then elif [ "$OSNAME" = "opensuse" ];then
echo "opensuse lib" echo "opensuse lib"
elif [ "$OSNAME" == "arch" ];then elif [ "$OSNAME" = "arch" ];then
echo "arch lib" echo "arch lib"
elif [ "$OSNAME" == "freebsd" ];then elif [ "$OSNAME" = "freebsd" ];then
echo "freebsd lib" echo "freebsd lib"
elif [ "$OSNAME" == "centos" ];then elif [ "$OSNAME" = "centos" ];then
echo "centos lib" echo "centos lib"
elif [ "$OSNAME" == "rocky" ]; then elif [ "$OSNAME" = "rocky" ]; then
echo "rocky lib" echo "rocky lib"
elif [ "$OSNAME" == "fedora" ];then elif [ "$OSNAME" = "fedora" ];then
echo "fedora lib" echo "fedora lib"
elif [ "$OSNAME" == "alma" ];then elif [ "$OSNAME" = "alma" ];then
echo "alma lib" echo "alma lib"
elif [ "$OSNAME" == "ubuntu" ];then elif [ "$OSNAME" = "ubuntu" ];then
echo "ubuntu lib" echo "ubuntu lib"
elif [ "$OSNAME" == "debian" ]; then elif [ "$OSNAME" = "debian" ]; then
echo "debian lib" echo "debian lib"
else else
echo "OK" echo "OK"
@@ -60,7 +60,7 @@ echo "system:${OSNAME}:${VERSION_ID}"
HTTP_PREFIX="https://" HTTP_PREFIX="https://"
LOCAL_ADDR=common LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn LOCAL_ADDR=cn
fi fi

View File

@@ -19,7 +19,7 @@ startTime=`date +%s`
_os=`uname` _os=`uname`
echo "use system: ${_os}" echo "use system: ${_os}"
if [ ${_os} == "Darwin" ]; then if [ ${_os} = "Darwin" ]; then
OSNAME='macos' OSNAME='macos'
elif grep -Eqi "openSUSE" /etc/*-release; then elif grep -Eqi "openSUSE" /etc/*-release; then
OSNAME='opensuse' OSNAME='opensuse'
@@ -75,7 +75,7 @@ fi
HTTP_PREFIX="https://" HTTP_PREFIX="https://"
LOCAL_ADDR=common LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn LOCAL_ADDR=cn
HTTP_PREFIX="https://mirror.ghproxy.com/" HTTP_PREFIX="https://mirror.ghproxy.com/"
fi fi
@@ -98,7 +98,7 @@ if [ $OSNAME != "macos" ];then
# https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh # https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh
if [ ! -d /www/server/mdserver-web ];then if [ ! -d /www/server/mdserver-web ];then
if [ "$LOCAL_ADDR" == "common" ];then if [ "$LOCAL_ADDR" = "common" ];then
curl --insecure -sSLo /tmp/master.zip ${HTTP_PREFIX}github.com/midoks/mdserver-web/archive/refs/tags/${VERSION}.zip curl --insecure -sSLo /tmp/master.zip ${HTTP_PREFIX}github.com/midoks/mdserver-web/archive/refs/tags/${VERSION}.zip
cd /tmp && unzip /tmp/master.zip cd /tmp && unzip /tmp/master.zip
mv -f /tmp/mdserver-web-${VERSION} /www/server/mdserver-web mv -f /tmp/mdserver-web-${VERSION} /www/server/mdserver-web
@@ -132,13 +132,13 @@ if [ $OSNAME != "macos" ];then
fi fi
echo "use system version: ${OSNAME}" echo "use system version: ${OSNAME}"
if [ "${OSNAME}" == "macos" ];then if [ "${OSNAME}" = "macos" ];then
curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/master/scripts/install/macos.sh | bash curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/master/scripts/install/macos.sh | bash
else else
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
fi fi
if [ "${OSNAME}" == "macos" ];then if [ "${OSNAME}" = "macos" ];then
echo "macos end" echo "macos end"
exit 0 exit 0
fi fi

View File

@@ -24,7 +24,7 @@ LOG_FILE=/var/log/mw-update.log
{ {
if [ ${_os} == "Darwin" ]; then if [ ${_os} = "Darwin" ]; then
OSNAME='macos' OSNAME='macos'
elif grep -Eqi "openSUSE" /etc/*-release; then elif grep -Eqi "openSUSE" /etc/*-release; then
OSNAME='opensuse' OSNAME='opensuse'
@@ -64,7 +64,7 @@ fi
HTTP_PREFIX="https://" HTTP_PREFIX="https://"
LOCAL_ADDR=common LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn LOCAL_ADDR=cn
HTTP_PREFIX="https://mirror.ghproxy.com/" HTTP_PREFIX="https://mirror.ghproxy.com/"
fi fi

View File

@@ -14,7 +14,7 @@ log="释放内存!"
echo "★[$endDate] $log" echo "★[$endDate] $log"
echo '----------------------------------------------------------------------------' echo '----------------------------------------------------------------------------'
if [ $sysName == 'Darwin' ]; then if [ $sysName = 'Darwin' ]; then
echo '苹果内存释放!' echo '苹果内存释放!'
else else
echo 'do start!' echo 'do start!'
@@ -32,7 +32,7 @@ fi
echo "OpenResty -- END" echo "OpenResty -- END"
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82 83 84) PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82 83 84 85)
for PHP_VER in ${PHP_VER_LIST[@]}; do for PHP_VER in ${PHP_VER_LIST[@]}; do
echo "PHP${PHP_VER} -- START" echo "PHP${PHP_VER} -- START"
if [ -f /usr/lib/systemd/system/php${PHP_VER}.service ];then if [ -f /usr/lib/systemd/system/php${PHP_VER}.service ];then
@@ -72,7 +72,7 @@ sync
sleep 2 sleep 2
sync sync
if [ $sysName == 'Darwin' ]; then if [ $sysName = 'Darwin' ]; then
echo 'done!' echo 'done!'
else else
echo 3 > /proc/sys/vm/drop_caches echo 3 > /proc/sys/vm/drop_caches

View File

@@ -32,7 +32,7 @@ LOG_FILE=/var/log/mw-update.log
HTTP_PREFIX="https://" HTTP_PREFIX="https://"
LOCAL_ADDR=common LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn LOCAL_ADDR=cn
fi fi
@@ -106,7 +106,7 @@ function ChooseProxyURL(){
read -p "${CHOICE_A}" INPUT read -p "${CHOICE_A}" INPUT
# echo $INPUT # echo $INPUT
if [ "$INPUT" == "" ];then if [ "$INPUT" = "" ];then
INPUT=1 INPUT=1
TMP_INPUT=`expr $INPUT - 1` TMP_INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]} INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
@@ -149,7 +149,7 @@ if [ "$LOCAL_ADDR" != "common" ];then
fi fi
fi fi
if [ ${_os} == "Darwin" ]; then if [ ${_os} = "Darwin" ]; then
OSNAME='macos' OSNAME='macos'
elif grep -Eqi "openSUSE" /etc/*-release; then elif grep -Eqi "openSUSE" /etc/*-release; then
OSNAME='opensuse' OSNAME='opensuse'

View File

@@ -45,7 +45,7 @@ LOG_FILE=/var/log/mw-update.log
HTTP_PREFIX="https://" HTTP_PREFIX="https://"
LOCAL_ADDR=common LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn LOCAL_ADDR=cn
fi fi
@@ -119,7 +119,7 @@ function ChooseProxyURL(){
read -p "${CHOICE_A}" INPUT read -p "${CHOICE_A}" INPUT
# echo $INPUT # echo $INPUT
if [ "$INPUT" == "" ];then if [ "$INPUT" = "" ];then
INPUT=1 INPUT=1
TMP_INPUT=`expr $INPUT - 1` TMP_INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]} INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
@@ -162,7 +162,7 @@ if [ "$LOCAL_ADDR" != "common" ];then
fi fi
fi fi
if [ ${_os} == "Darwin" ]; then if [ ${_os} = "Darwin" ]; then
OSNAME='macos' OSNAME='macos'
elif grep -Eqi "openSUSE" /etc/*-release; then elif grep -Eqi "openSUSE" /etc/*-release; then
OSNAME='opensuse' OSNAME='opensuse'