Browse Source

Update check_os.sh and Fix bug

lj2007331@gmail.com 6 years ago
parent
commit
a0c9e1a1a5
8 changed files with 29 additions and 33 deletions
  1. 20 24
      include/check_os.sh
  2. 2 2
      include/openresty.sh
  3. 2 2
      include/tengine.sh
  4. 1 1
      include/tomcat-6.sh
  5. 1 1
      include/tomcat-7.sh
  6. 1 1
      include/tomcat-8.sh
  7. 1 1
      include/tomcat-9.sh
  8. 1 1
      versions.txt

+ 20 - 24
include/check_os.sh

@@ -8,14 +8,14 @@
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
-if [ -n "$(grep 'Aliyun Linux release' /etc/issue)" -o -e /etc/redhat-release ]; then
+if [ -e /etc/redhat-release ]; then
   OS=CentOS
-  [ -n "$(grep ' 7\.' /etc/redhat-release 2> /dev/null)" ] && CentOS_ver=7
-  [ -n "$(grep ' 6\.' /etc/redhat-release 2> /dev/null)" -o -n "$(grep 'Aliyun Linux release6 15' /etc/issue)" ] && CentOS_ver=6
-  [ -n "$(grep ' 5\.' /etc/redhat-release 2> /dev/null)" -o -n "$(grep 'Aliyun Linux release5' /etc/issue)" ] && CentOS_ver=5
-elif [ -n "$(grep 'Amazon Linux AMI release' /etc/issue)" -o -e /etc/system-release ]; then
+  [ ! -e "$(which lsb_release)" ] && { yum -y install redhat-lsb-core; clear; }
+  CentOS_ver=$(lsb_release -sr | awk -F. '{print $1}')
+  [ "${CentOS_ver}" == '17' ] && CentOS_ver=7
+elif [ -n "$(grep 'Amazon Linux' /etc/issue)" ]; then
   OS=CentOS
-  CentOS_ver=6
+  CentOS_ver=7
 elif [ -n "$(grep 'bian' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Debian" ]; then
   OS=Debian
   [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; }
@@ -24,15 +24,15 @@ elif [ -n "$(grep 'Deepin' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "
   OS=Debian
   [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; }
   Debian_ver=8
-elif [ -n "$(grep 'Kali GNU/Linux Rolling' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Kali" ]; then
-  # kali rolling
+elif [ -n "$(grep -w 'Kali' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Kali" ]; then
   OS=Debian
   [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; }
   if [ -n "$(grep 'VERSION="2016.*"' /etc/os-release)" ]; then
     Debian_ver=8
-  else
-    echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}"
-    kill -9 $$
+  elif [ -n "$(grep 'VERSION="2017.*"' /etc/os-release)" ]; then
+    Debian_ver=9
+  elif [ -n "$(grep 'VERSION="2018.*"' /etc/os-release)" ]; then
+    Debian_ver=9
   fi
 elif [ -n "$(grep 'Ubuntu' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Ubuntu" -o -n "$(grep 'Linux Mint' /etc/issue)" ]; then
   OS=Ubuntu
@@ -84,19 +84,15 @@ fi
 
 THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l)
 
-# Percona
-if [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then
-  if [ "${Debian_ver}" == '6' ]; then
-    sslLibVer=ssl098
-  else
-    sslLibVer=ssl100
-  fi
-elif [ "${OS}" == "CentOS" ]; then
-  if [ "${CentOS_ver}" == '5' ]; then
-    sslLibVer=ssl098e
-  else
-    sslLibVer=ssl101
-  fi
+# Percona binary
+if [ "${CentOS_ver}" == '5' -o "${Debian_ver}" == '6' ]; then
+  sslLibVer=ssl098
+elif [ "${Debian_ver}" == '7' -o "${Ubuntu_ver}" == '12' ]; then
+  sslLibVer=ssl100
+elif [ "${CentOS_ver}" == '6' -o "${Debian_ver}" == '8' -o "${Ubuntu_ver}" == '14' ]; then
+  sslLibVer=ssl101
+elif [ "${CentOS_ver}" == '7' -o "${Debian_ver}" == '9' -o ${Ubuntu_ver} -ge 16 >/dev/null 2>&1 ]; then
+  sslLibVer=ssl102
 else
   sslLibVer=unknown
 fi

+ 2 - 2
include/openresty.sh

@@ -46,8 +46,8 @@ Install_OpenResty() {
     sed -i "s@/usr/local/nginx@${openresty_install_dir}/nginx@g" /lib/systemd/system/nginx.service
     systemctl enable nginx
   else
-    [ "${OS}" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${nginx_install_dir}@g" /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; }
-    [[ ${OS} =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${nginx_install_dir}@g" /etc/init.d/nginx; update-rc.d nginx defaults; }
+    [ "${OS}" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${openresty_install_dir}@g" /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; }
+    [[ ${OS} =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${openresty_install_dir}@g" /etc/init.d/nginx; update-rc.d nginx defaults; }
   fi
 
   mv ${openresty_install_dir}/nginx/conf/nginx.conf{,_bk}

+ 2 - 2
include/tengine.sh

@@ -47,8 +47,8 @@ Install_Tengine() {
     sed -i "s@/usr/local/nginx@${tengine_install_dir}@g" /lib/systemd/system/nginx.service
     systemctl enable nginx
   else
-    [ "${OS}" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${nginx_install_dir}@g" /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; }
-    [[ ${OS} =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${nginx_install_dir}@g" /etc/init.d/nginx; update-rc.d nginx defaults; }
+    [ "${OS}" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${tengine_install_dir}@g" /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; }
+    [[ ${OS} =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${tengine_install_dir}@g" /etc/init.d/nginx; update-rc.d nginx defaults; }
   fi
 
   mv ${tengine_install_dir}/conf/nginx.conf{,_bk}

+ 1 - 1
include/tomcat-6.sh

@@ -70,7 +70,7 @@ EOF
     /bin/cp ${oneinstack_dir}/config/server.xml ${tomcat_install_dir}/conf
     sed -i "s@/usr/local/tomcat@${tomcat_install_dir}@g" ${tomcat_install_dir}/conf/server.xml
     sed -i /ThreadLocalLeakPreventionListener/d ${tomcat_install_dir}/conf/server.xml
-    if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then
+    if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${openresty_install_dir}/nginx/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then
       if [ "${iptables_yn}" == 'y' ]; then
         if [ "${OS}" == "CentOS" ]; then
           if [ -z "$(grep -w '8080' /etc/sysconfig/iptables)" ]; then

+ 1 - 1
include/tomcat-7.sh

@@ -70,7 +70,7 @@ EOF
     /bin/cp ${oneinstack_dir}/config/server.xml ${tomcat_install_dir}/conf
     sed -i "s@/usr/local/tomcat@${tomcat_install_dir}@g" ${tomcat_install_dir}/conf/server.xml
 
-    if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then
+    if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${openresty_install_dir}/nginx/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then
       if [ "${iptables_yn}" == 'y' ]; then
         if [ "${OS}" == "CentOS" ]; then
           if [ -z "$(grep -w '8080' /etc/sysconfig/iptables)" ]; then

+ 1 - 1
include/tomcat-8.sh

@@ -70,7 +70,7 @@ EOF
     /bin/cp ${oneinstack_dir}/config/server.xml ${tomcat_install_dir}/conf
     sed -i "s@/usr/local/tomcat@${tomcat_install_dir}@g" ${tomcat_install_dir}/conf/server.xml
 
-    if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then
+    if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${openresty_install_dir}/nginx/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then
       if [ "${iptables_yn}" == 'y' ]; then
         if [ "${OS}" == "CentOS" ]; then
           if [ -z "$(grep -w '8080' /etc/sysconfig/iptables)" ]; then

+ 1 - 1
include/tomcat-9.sh

@@ -70,7 +70,7 @@ EOF
     /bin/cp ${oneinstack_dir}/config/server.xml ${tomcat_install_dir}/conf
     sed -i "s@/usr/local/tomcat@${tomcat_install_dir}@g" ${tomcat_install_dir}/conf/server.xml
 
-    if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then
+    if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${openresty_install_dir}/nginx/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then
       if [ "${iptables_yn}" == 'y' ]; then
         if [ "${OS}" == "CentOS" ]; then
           if [ -z "$(grep -w '8080' /etc/sysconfig/iptables)" ]; then

+ 1 - 1
versions.txt

@@ -60,7 +60,7 @@ mcrypt_ver=2.6.8
 mhash_ver=0.9.9.9
 libsodium_ver=1.0.16
 argon2_ver=20171227
-imagemagick_ver=6.9.9-45
+imagemagick_ver=6.9.9-47
 imagick_ver=3.4.3
 graphicsmagick_ver=1.3.28
 gmagick_for_php7_ver=2.0.5RC1