From bb78347630b4e11baf78bb699b95f00f2da9c75d Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 21 Jun 2022 12:04:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0dev=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/install_dev.sh | 80 ++++++++++++++++++++++++++++++++++++++++++ scripts/update_dev.sh | 59 +++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100755 scripts/install_dev.sh create mode 100755 scripts/update_dev.sh diff --git a/scripts/install_dev.sh b/scripts/install_dev.sh new file mode 100755 index 000000000..643698616 --- /dev/null +++ b/scripts/install_dev.sh @@ -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!" \ No newline at end of file diff --git a/scripts/update_dev.sh b/scripts/update_dev.sh new file mode 100755 index 000000000..35285da74 --- /dev/null +++ b/scripts/update_dev.sh @@ -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!" \ No newline at end of file From becf3143755c8ca25c00677a0bf9ddb5dc6345ee Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 21 Jun 2022 12:05:33 +0800 Subject: [PATCH 2/3] Update README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 19d8cea38..1de155c14 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,22 @@ curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install_cn. curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update_cn.sh | bash ``` + +### DEV使用 + +- 自动安装 + +``` +curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install_dev.sh | bash +``` + +- 脚本更新 + +``` +curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update_dev.sh | bash +``` + + ### 无图不真相 [![截图](/route/static/mdw.jpg)](/route/static/mdw.jpg) From dcb9ffd759cb286675a51fb89dd0e530dcee7b8e Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 21 Jun 2022 12:07:05 +0800 Subject: [PATCH 3/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1de155c14..8f0476f09 100644 --- a/README.md +++ b/README.md @@ -87,13 +87,13 @@ curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update_cn.s - 自动安装 ``` -curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install_dev.sh | bash +curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install_dev.sh | bash ``` - 脚本更新 ``` -curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update_dev.sh | bash +curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash ```