From 1407a44b5e78d1f8936c67d7a1868027e9e4e92e Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Tue, 15 Jan 2019 17:57:33 +0800 Subject: [PATCH] update --- class/core/system_api.py | 6 ++--- scripts/install.sh | 54 +++++++++++++++++++++------------------ scripts/install_centos.sh | 5 ++-- scripts/install_macos.sh | 50 +++++++++++++++++------------------- 4 files changed, 57 insertions(+), 58 deletions(-) diff --git a/class/core/system_api.py b/class/core/system_api.py index 550126fc2..9c29fdc80 100755 --- a/class/core/system_api.py +++ b/class/core/system_api.py @@ -12,7 +12,7 @@ from flask import request import db import public -import config +import config_api from threading import Thread @@ -643,7 +643,7 @@ class system_api: if not public.isRestart(): return public.returnJson(False, '请等待所有安装任务完成再执行!') if stype == 'check': - version_now = config.config().getVersion() + version_now = config_api.config_api().getVersion() version_new_info = self.getServerInfo() if not 'version' in version_new_info: return public.returnJson(False, '服务器数据有问题!') @@ -659,7 +659,7 @@ class system_api: if stype == 'info': version_new_info = self.getServerInfo() - version_now = config.config().getVersion() + version_now = config_api.config_api().getVersion() if not 'version' in version_new_info: return public.returnJson(False, '服务器数据有问题!') diff --git a/scripts/install.sh b/scripts/install.sh index 057fbeee2..72fe0fb21 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -6,32 +6,36 @@ is64bit=`getconf LONG_BIT` startTime=`date +%s` +_os=`uname` +if [ "$_os" == "Darwin" ] ; then + OSNAME='MAC' +elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then + OSNAME='CentOS' +elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then + OSNAME='RHEL' +elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then + OSNAME='Aliyun' +elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then + OSNAME='Fedora' +elif grep -Eqi "Amazon Linux AMI" /etc/issue || grep -Eq "Amazon Linux AMI" /etc/*-release; then + OSNAME='Amazon' +elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then + OSNAME='Debian' +elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then + OSNAME='Ubuntu' +elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then + OSNAME='Raspbian' +elif grep -Eqi "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then + OSNAME='Deepin' +else + OSNAME='unknow' +fi + + +if [ "$OSNAME" == 'MAC' ];then + curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install_macos.sh | sh +fi -mkdir -p /www/server -mkdir -p /www/wwwroot -mkdir -p /www/wwwlogs -mkdir -p /www/backup/database -mkdir -p /www/backup/site - - -yum -y provides '*/applydeltarpm' -yum -y install deltarpm - -yum install -y wget curl unzip zip - - -wget -O /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master -cd /tmp && unzip /tmp/master.zip -mv /tmp/mdserver-web-master /www/server/mdserver-web - -yum groupinstall -y "Development Tools" -paces="wget python-devel python-imaging zip unzip openssl openssl-devel gcc libxml2 libxml2-dev libxslt* zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs" -yum -y install $paces -yum -y lsof net-tools.x86_64 -yum -y install ncurses-devel mysql-dev -yum -y install epel-release python-pip python-devel -pip install --upgrade pip -pip install -r /www/server/mdserver-web/requirements.txt endTime=`date +%s` diff --git a/scripts/install_centos.sh b/scripts/install_centos.sh index 250b454fe..9ed7a7271 100755 --- a/scripts/install_centos.sh +++ b/scripts/install_centos.sh @@ -6,7 +6,6 @@ is64bit=`getconf LONG_BIT` startTime=`date +%s` - mkdir -p /www/server mkdir -p /www/wwwroot mkdir -p /www/wwwlogs @@ -27,14 +26,14 @@ mv /tmp/mdserver-web-master /www/server/mdserver-web yum groupinstall -y "Development Tools" paces="wget python-devel python-imaging zip unzip openssl openssl-devel gcc libxml2 libxml2-dev libxslt* zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs" yum -y install $paces - +yum -y lsof net-tools.x86_64 +yum -y install ncurses-devel mysql-dev yum -y install epel-release python-pip python-devel pip install --upgrade pip pip install -r /www/server/mdserver-web/requirements.txt - 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/install_macos.sh b/scripts/install_macos.sh index 250b454fe..4a8c2e3fa 100755 --- a/scripts/install_macos.sh +++ b/scripts/install_macos.sh @@ -2,39 +2,35 @@ 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` +USER=$(who | sed -n "2,1p" |awk '{print $1}') +DEV="/Users/${USER}/Desktop/mwdev" -mkdir -p /www/server -mkdir -p /www/wwwroot -mkdir -p /www/wwwlogs -mkdir -p /www/backup/database -mkdir -p /www/backup/site +mkdir -p $DEV +mkdir -p $DEV +mkdir -p $DEV/server +mkdir -p $DEV/wwwlogs +mkdir -p $DEV/backup/database +mkdir -p $DEV/backup/site +# install brew +if [ ! -f /usr/local/bin/brew ];then + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + brew install python@2 + brew install mysql +fi -yum -y provides '*/applydeltarpm' -yum -y install deltarpm -yum install -y wget curl unzip zip +if [ ! -f $DEV/server/mdserver-web ]; then + wget -O /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master + cd /tmp && unzip /tmp/master.zip + mv /tmp/mdserver-web-master $DEV/server/mdserver-web + rm -f /tmp/master.zip + rm -rf /tmp/mdserver-web-master +fi -wget -O /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master -cd /tmp && unzip /tmp/master.zip -mv /tmp/mdserver-web-master /www/server/mdserver-web +pip install -r $DEV/server/mdserver-web/requirements.txt -yum groupinstall -y "Development Tools" -paces="wget python-devel python-imaging zip unzip openssl openssl-devel gcc libxml2 libxml2-dev libxslt* zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs" -yum -y install $paces - -yum -y install epel-release python-pip python-devel -pip install --upgrade pip -pip install -r /www/server/mdserver-web/requirements.txt - - - - -endTime=`date +%s` -((outTime=($endTime-$startTime)/60)) -echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" \ No newline at end of file +cd $DEV/server/mdserver-web && ./cli.sh debug \ No newline at end of file