diff --git a/scripts/install.sh b/scripts/install.sh index c923ed805..c90e56a46 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -33,6 +33,8 @@ if [ ${_os} == "Darwin" ]; then elif grep -Eq "openSUSE" /etc/*-release; then OSNAME='opensuse' zypper refresh +elif grep -Eq "FreeBSD" /etc/*-release; then + OSNAME='freebsd' elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then OSNAME='centos' yum install -y wget zip unzip diff --git a/scripts/install/freebsd.sh b/scripts/install/freebsd.sh new file mode 100644 index 000000000..7bf9606de --- /dev/null +++ b/scripts/install/freebsd.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 + + +pkg install -y python3 + + +#https need +if [ ! -d /root/.acme.sh ];then + curl https://get.acme.sh | sh +fi + +if [ -f /etc/init.d/iptables ];then + + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT + # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT + # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT + service iptables save + + iptables_status=`service iptables status | grep 'not running'` + if [ "${iptables_status}" == '' ];then + service iptables restart + fi + + #安装时不开启 + service iptables stop +fi + + +if [ ! -f /etc/init.d/iptables ];then + zypper install -y firewalld + systemctl enable firewalld + systemctl start firewalld + + firewall-cmd --permanent --zone=public --add-port=22/tcp + firewall-cmd --permanent --zone=public --add-port=80/tcp + firewall-cmd --permanent --zone=public --add-port=443/tcp + firewall-cmd --permanent --zone=public --add-port=888/tcp + firewall-cmd --permanent --zone=public --add-port=7200/tcp + # firewall-cmd --permanent --zone=public --add-port=3306/tcp + # firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp + + + sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf + firewall-cmd --reload + #安装时不开启 + systemctl stop firewalld +fi + + + + +cd /www/server/mdserver-web/scripts && bash lib.sh +chmod 755 /www/server/mdserver-web/data + + +cd /www/server/mdserver-web && ./cli.sh start +isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'` +n=0 +while [[ ! -f /etc/init.d/mw ]]; +do + echo -e ".\c" + sleep 1 + let n+=1 + if [ $n -gt 20 ];then + echo -e "start mw fail" + exit 1 + fi +done + +cd /www/server/mdserver-web && /etc/init.d/mw stop +cd /www/server/mdserver-web && /etc/init.d/mw start +cd /www/server/mdserver-web && /etc/init.d/mw default + diff --git a/scripts/install_cn.sh b/scripts/install_cn.sh index 04f8c18aa..9f5e43c26 100755 --- a/scripts/install_cn.sh +++ b/scripts/install_cn.sh @@ -33,6 +33,8 @@ if [ ${_os} == "Darwin" ]; then elif grep -Eq "openSUSE" /etc/*-release; then OSNAME='opensuse' zypper refresh +elif grep -Eq "FreeBSD" /etc/*-release; then + OSNAME='freebsd' elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then OSNAME='centos' yum install -y wget zip unzip diff --git a/scripts/install_dev.sh b/scripts/install_dev.sh index c81f1f5c4..c50351f1c 100755 --- a/scripts/install_dev.sh +++ b/scripts/install_dev.sh @@ -33,6 +33,8 @@ if [ ${_os} == "Darwin" ]; then elif grep -Eq "openSUSE" /etc/*-release; then OSNAME='opensuse' zypper refresh +elif grep -Eq "FreeBSD" /etc/*-release; then + OSNAME='freebsd' elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then OSNAME='arch' echo y | pacman -Sy unzip diff --git a/scripts/update.sh b/scripts/update.sh index 2435a6778..d66942575 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -28,6 +28,8 @@ if [ ${_os} == "Darwin" ]; then elif grep -Eq "openSUSE" /etc/*-release; then OSNAME='opensuse' zypper refresh +elif grep -Eq "FreeBSD" /etc/*-release; then + OSNAME='freebsd' elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then OSNAME='centos' yum install -y wget zip unzip diff --git a/scripts/update/freebsd.sh b/scripts/update/freebsd.sh new file mode 100644 index 000000000..06ccadc27 --- /dev/null +++ b/scripts/update/freebsd.sh @@ -0,0 +1,77 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH +LANG=en_US.UTF-8 + + +#https need +if [ ! -d /root/.acme.sh ];then + curl https://get.acme.sh | sh +fi + +if [ -f /etc/init.d/iptables ];then + + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT + # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT + # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT + service iptables save + + iptables_status=`service iptables status | grep 'not running'` + if [ "${iptables_status}" == '' ];then + service iptables restart + fi + + #安装时不开启 + service iptables stop +fi + + +if [ ! -f /etc/init.d/iptables ];then + zypper install -y firewalld + systemctl enable firewalld + systemctl start firewalld + + firewall-cmd --permanent --zone=public --add-port=22/tcp + firewall-cmd --permanent --zone=public --add-port=80/tcp + firewall-cmd --permanent --zone=public --add-port=443/tcp + firewall-cmd --permanent --zone=public --add-port=888/tcp + firewall-cmd --permanent --zone=public --add-port=7200/tcp + # firewall-cmd --permanent --zone=public --add-port=3306/tcp + # firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp + + + sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf + firewall-cmd --reload + #安装时不开启 + systemctl stop firewalld +fi + + + + +cd /www/server/mdserver-web/scripts && bash lib.sh +chmod 755 /www/server/mdserver-web/data + + +cd /www/server/mdserver-web && ./cli.sh start +isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'` +n=0 +while [[ ! -f /etc/init.d/mw ]]; +do + echo -e ".\c" + sleep 1 + let n+=1 + if [ $n -gt 20 ];then + echo -e "start mw fail" + exit 1 + fi +done + +cd /www/server/mdserver-web && /etc/init.d/mw stop +cd /www/server/mdserver-web && /etc/init.d/mw start +cd /www/server/mdserver-web && /etc/init.d/mw default + diff --git a/scripts/update_cn.sh b/scripts/update_cn.sh index 6e44bccfe..a76824af6 100755 --- a/scripts/update_cn.sh +++ b/scripts/update_cn.sh @@ -28,6 +28,8 @@ if [ ${_os} == "Darwin" ]; then elif grep -Eq "openSUSE" /etc/*-release; then OSNAME='opensuse' zypper refresh +elif grep -Eq "FreeBSD" /etc/*-release; then + OSNAME='freebsd' elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then OSNAME='centos' yum install -y wget zip unzip diff --git a/scripts/update_dev.sh b/scripts/update_dev.sh index b8a558dbc..45f3de803 100755 --- a/scripts/update_dev.sh +++ b/scripts/update_dev.sh @@ -28,6 +28,8 @@ if [ ${_os} == "Darwin" ]; then elif grep -Eq "openSUSE" /etc/*-release; then OSNAME='opensuse' zypper refresh +elif grep -Eq "FreeBSD" /etc/*-release; then + OSNAME='freebsd' elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then OSNAME='arch' elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then