Browse Source

rename _quiet to _flag and Update PHP version

lj2007331@gmail.com 6 years ago
parent
commit
cd04811e1b

+ 1 - 1
README.md

@@ -18,7 +18,7 @@ Script properties:
 - Jemalloc optimize MySQL, Nginx
 - Providing add a virtual host script, include Let's Encrypt SSL certificate
 - Provide Nginx/Tengine/OpenResty/Apache/Tomcat, MySQL/MariaDB/Percona, PHP, Redis, Memcached, phpMyAdmin upgrade script
-- Provide local backup,remote backup (rsync between servers),Aliyun OSS,Qcloud COS,UPYUN and QINIU script
+- Provide local backup,remote backup(rsync between servers),Aliyun OSS,Qcloud COS,UPYUN,QINIU,Google Drive and Dropbox script
 - Provided under HHVM install CentOS 6,7
 
 ## How to use

+ 2 - 2
include/init_Debian.sh

@@ -91,8 +91,8 @@ ntpdate pool.ntp.org
 # iptables
 if [ "${iptables_flag}" == 'y' ]; then
   apt-get -y install debconf-utils
-  echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
-  echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
+  echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections
+  echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections
   apt-get -y install iptables-persistent
   if [ -e "/etc/iptables/rules.v4" ] && [ -n "$(grep '^:INPUT DROP' /etc/iptables/rules.v4)" -a -n "$(grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables/rules.v4)" -a -n "$(grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables/rules.v4)" ]; then
     IPTABLES_STATUS=yes

+ 2 - 2
include/init_Ubuntu.sh

@@ -99,8 +99,8 @@ ntpdate pool.ntp.org
 # iptables
 if [ "${iptables_flag}" == 'y' ]; then
   apt-get -y install debconf-utils
-  echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
-  echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
+  echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections
+  echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections
   apt-get -y install iptables-persistent
   if [ -e "/etc/iptables/rules.v4" ] && [ -n "$(grep '^:INPUT DROP' /etc/iptables/rules.v4)" -a -n "$(grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables/rules.v4)" -a -n "$(grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables/rules.v4)" ]; then
     IPTABLES_STATUS=yes

+ 6 - 8
include/nginx.sh

@@ -18,7 +18,7 @@ Install_Nginx() {
   tar xzf openssl-${openssl11_ver}.tar.gz
   [ "${Fedora_ver}" == '28' ] && patch -d nginx-${nginx_ver} -p1 < 0001-unix-ngx_user-Apply-fix-for-really-old-bug-in-glibc-.patch
   patch -d nginx-${nginx_ver} -p0 < nginx-auto-cc-gcc.patch
-  pushd nginx-${nginx_ver}
+  pushd nginx-${nginx_ver} > /dev/null
   # Modify Nginx version
   #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION      "1.2"@' src/core/nginx.h
   #sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER          "Linuxeye/" NGINX_VERSION@' src/core/nginx.h
@@ -31,10 +31,8 @@ Install_Nginx() {
   ./configure --prefix=${nginx_install_dir} --user=${run_user} --group=${run_user} --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-${openssl11_ver} --with-pcre=../pcre-${pcre_ver} --with-pcre-jit --with-ld-opt='-ljemalloc' ${nginx_modules_options}
   make -j ${THREAD} && make install
   if [ -e "${nginx_install_dir}/conf/nginx.conf" ]; then
-    popd
-    rm -rf pcre-${pcre_ver}
-    rm -rf openssl-${openssl11_ver}
-    rm -rf nginx-${nginx_ver}
+    popd > /dev/null
+    rm -rf pcre-${pcre_ver} openssl-${openssl11_ver} nginx-${nginx_ver}
     echo "${CSUCCESS}Nginx installed successfully! ${CEND}"
   else
     rm -rf ${nginx_install_dir}
@@ -56,9 +54,9 @@ Install_Nginx() {
   fi
 
   mv ${nginx_install_dir}/conf/nginx.conf{,_bk}
-  if [[ ${apache_option} =~ ^[1-2]$ ]]; then
+  if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apachectl" ]; then
     /bin/cp ../config/nginx_apache.conf ${nginx_install_dir}/conf/nginx.conf
-  elif [[ ${tomcat_option} =~ ^[1-2]$ ]] && [ ! -e "${php_install_dir}/bin/php" ]; then
+  elif { [[ ${tomcat_option} =~ ^[1-4]$ ]] || [ -e "${tomcat_install_dir}/conf/server.xml" ]; } && { [[ ! ${php_option} =~ ^[1-8]$ ]] && [ ! -e "${php_install_dir}/bin/php" ]; }; then
     /bin/cp ../config/nginx_tomcat.conf ${nginx_install_dir}/conf/nginx.conf
   else
     /bin/cp ../config/nginx.conf ${nginx_install_dir}/conf/nginx.conf
@@ -100,7 +98,7 @@ ${wwwlogs_dir}/*nginx.log {
   endscript
 }
 EOF
-  popd
+  popd > /dev/null
   ldconfig
   service nginx start
 }

+ 8 - 10
include/openresty.sh

@@ -18,7 +18,7 @@ Install_OpenResty() {
   tar xzf openssl-${openssl_ver}.tar.gz
   [ "${Fedora_ver}" == '28' ] && patch -d openresty-${openresty_ver}/bundle/nginx-${openresty_ver%.*} -p1 < 0001-unix-ngx_user-Apply-fix-for-really-old-bug-in-glibc-.patch
   patch -d openresty-${openresty_ver}/bundle/nginx-${openresty_ver%.*} -p0 < nginx-auto-cc-gcc.patch
-  pushd openresty-${openresty_ver}
+  pushd openresty-${openresty_ver} > /dev/null
 
   # close debug
   sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-${openresty_ver%.*}/auto/cc/gcc # close debug
@@ -27,10 +27,8 @@ Install_OpenResty() {
   ./configure --prefix=${openresty_install_dir} --user=${run_user} --group=${run_user} --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-${openssl_ver} --with-pcre=../pcre-${pcre_ver} --with-pcre-jit --with-ld-opt='-ljemalloc' ${nginx_modules_options}
   make -j ${THREAD} && make install
   if [ -e "${openresty_install_dir}/nginx/conf/nginx.conf" ]; then
-    popd
-    rm -rf pcre-${pcre_ver}
-    rm -rf openssl-${openssl_ver}
-    rm -rf openresty-${openresty_ver}
+    popd > /dev/null
+    rm -rf pcre-${pcre_ver} openssl-${openssl_ver} openresty-${openresty_ver}
     echo "${CSUCCESS}OpenResty installed successfully! ${CEND}"
   else
     rm -rf ${openresty_install_dir}
@@ -52,10 +50,10 @@ Install_OpenResty() {
   fi
 
   mv ${openresty_install_dir}/nginx/conf/nginx.conf{,_bk}
-  if [[ ${apache_option} =~ ^[1-2]$ ]]; then
-    /bin/cp ../config/nginx_apache.conf ${openresty_install_dir}/nginx/conf/nginx.conf
-  elif [[ ${tomcat_option} =~ ^[1-2]$ ]] && [ ! -e "${php_install_dir}/bin/php" ]; then
-    /bin/cp ../config/nginx_tomcat.conf ${openresty_install_dir}/nginx/conf/nginx.conf
+  if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apachectl" ]; then
+    /bin/cp ../config/nginx_apache.conf ${openresty_install_dir}/conf/nginx.conf
+  elif { [[ ${tomcat_option} =~ ^[1-4]$ ]] || [ -e "${tomcat_install_dir}/conf/server.xml" ]; } && { [[ ! ${php_option} =~ ^[1-8]$ ]] && [ ! -e "${php_install_dir}/bin/php" ]; }; then
+    /bin/cp ../config/nginx_tomcat.conf ${openresty_install_dir}/conf/nginx.conf
   else
     /bin/cp ../config/nginx.conf ${openresty_install_dir}/nginx/conf/nginx.conf
     [[ "${php_option}" =~ ^[1-8]$ ]] && [ -z "`grep '/php-fpm_status' ${openresty_install_dir}/nginx/conf/nginx.conf`" ] &&  sed -i "s@index index.html index.php;@index index.html index.php;\n    location ~ /php-fpm_status {\n        #fastcgi_pass remote_php_ip:9000;\n        fastcgi_pass unix:/dev/shm/php-cgi.sock;\n        fastcgi_index index.php;\n        include fastcgi.conf;\n        allow 127.0.0.1;\n        deny all;\n        }@" ${openresty_install_dir}/nginx/conf/nginx.conf
@@ -96,7 +94,7 @@ ${wwwlogs_dir}/*nginx.log {
   endscript
 }
 EOF
-  popd
+  popd > /dev/null
   ldconfig
   service nginx start
 }

+ 5 - 5
include/php-5.3.sh

@@ -11,8 +11,8 @@
 Install_PHP53() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${apache_install_dir}/bin/apachectl" ];then
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_main_ver=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_main_ver=22
   fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
@@ -91,7 +91,7 @@ Install_PHP53() {
   patch -p1 < ../debian_patches_disable_SSLv2_for_openssl_1_0_0.patch
   make clean
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
-  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs --disable-fileinfo \
@@ -149,7 +149,7 @@ Install_PHP53() {
   sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
   [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_main_ver}" == '24' ]; then
     # php-fpm Init Script
     if [ -e /bin/systemctl ]; then
       /bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
@@ -247,7 +247,7 @@ EOF
 
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 5 - 5
include/php-5.4.sh

@@ -11,8 +11,8 @@
 Install_PHP54() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${apache_install_dir}/bin/apachectl" ];then
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_main_ver=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_main_ver=22
   fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
@@ -87,7 +87,7 @@ Install_PHP54() {
   pushd php-${php54_ver} > /dev/null
   make clean
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
-  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs --disable-fileinfo \
@@ -144,7 +144,7 @@ Install_PHP54() {
   sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
   [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_main_ver}" == '24' ]; then
     # php-fpm Init Script
     if [ -e /bin/systemctl ]; then
       /bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
@@ -242,7 +242,7 @@ EOF
 
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 5 - 5
include/php-5.5.sh

@@ -11,8 +11,8 @@
 Install_PHP55() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${apache_install_dir}/bin/apachectl" ];then
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_main_ver=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_main_ver=22
   fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
@@ -86,7 +86,7 @@ Install_PHP55() {
   pushd php-${php55_ver} > /dev/null
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -157,7 +157,7 @@ opcache.enable_cli=1
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_main_ver}" == '24' ]; then
     # php-fpm Init Script
     if [ -e /bin/systemctl ]; then
       /bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
@@ -255,7 +255,7 @@ EOF
 
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 5 - 5
include/php-5.6.sh

@@ -11,8 +11,8 @@
 Install_PHP56() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${apache_install_dir}/bin/apachectl" ];then
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_main_ver=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_main_ver=22
   fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
@@ -87,7 +87,7 @@ Install_PHP56() {
   make clean
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -160,7 +160,7 @@ opcache.enable_cli=1
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_main_ver}" == '24' ]; then
     # php-fpm Init Script
     if [ -e /bin/systemctl ]; then
       /bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
@@ -258,7 +258,7 @@ EOF
 
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 5 - 5
include/php-7.0.sh

@@ -11,8 +11,8 @@
 Install_PHP70() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${apache_install_dir}/bin/apachectl" ];then
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_main_ver=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_main_ver=22
   fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
@@ -88,7 +88,7 @@ Install_PHP70() {
   ./buildconf
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -166,7 +166,7 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_main_ver}" == '24' ]; then
     # php-fpm Init Script
     if [ -e /bin/systemctl ]; then
       /bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
@@ -264,7 +264,7 @@ EOF
 
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 5 - 5
include/php-7.1.sh

@@ -11,8 +11,8 @@
 Install_PHP71() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${apache_install_dir}/bin/apachectl" ];then
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_main_ver=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_main_ver=22
   fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
@@ -88,7 +88,7 @@ Install_PHP71() {
   ./buildconf
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -166,7 +166,7 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_main_ver}" == '24' ]; then
     # php-fpm Init Script
     if [ -e /bin/systemctl ]; then
       /bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
@@ -264,7 +264,7 @@ EOF
 
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 5 - 5
include/php-7.2.sh

@@ -11,8 +11,8 @@
 Install_PHP72() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${apache_install_dir}/bin/apachectl" ];then
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_main_ver=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_main_ver=22
   fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
@@ -82,7 +82,7 @@ Install_PHP72() {
   ./buildconf
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -159,7 +159,7 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_main_ver}" == '24' ]; then
     # php-fpm Init Script
     if [ -e /bin/systemctl ]; then
       /bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
@@ -257,7 +257,7 @@ EOF
 
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 5 - 5
include/php-7.3.sh

@@ -11,8 +11,8 @@
 Install_PHP73() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${apache_install_dir}/bin/apachectl" ];then
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_main_ver=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_main_ver=22
   fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
@@ -82,7 +82,7 @@ Install_PHP73() {
   ./buildconf
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -159,7 +159,7 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_main_ver}" == '24' ]; then
     # php-fpm Init Script
     if [ -e /bin/systemctl ]; then
       /bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
@@ -257,7 +257,7 @@ EOF
 
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_main_ver}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 19 - 17
include/phpmyadmin.sh

@@ -9,22 +9,24 @@
 #       https://github.com/oneinstack/oneinstack
 
 Install_phpMyAdmin() {
-  pushd ${oneinstack_dir}/src > /dev/null
-  PHP_detail_ver=`${php_install_dir}/bin/php -r 'echo PHP_VERSION;'`
-  PHP_main_ver=${PHP_detail_ver%.*}
-  if [[ "${PHP_main_ver}" =~ ^5.[3-4]$ ]]; then
-    tar xzf phpMyAdmin-${phpmyadmin_oldver}-all-languages.tar.gz
-    /bin/mv phpMyAdmin-${phpmyadmin_oldver}-all-languages ${wwwroot_dir}/default/phpMyAdmin
-  else
-    tar xzf phpMyAdmin-${phpmyadmin_ver}-all-languages.tar.gz
-    /bin/mv phpMyAdmin-${phpmyadmin_ver}-all-languages ${wwwroot_dir}/default/phpMyAdmin
+  if [ -e "${php_install_dir}/bin/phpize" ]; then
+    pushd ${oneinstack_dir}/src > /dev/null
+    PHP_detail_ver=`${php_install_dir}/bin/php -r 'echo PHP_VERSION;'`
+    PHP_main_ver=${PHP_detail_ver%.*}
+    if [[ "${PHP_main_ver}" =~ ^5.[3-4]$ ]]; then
+      tar xzf phpMyAdmin-${phpmyadmin_oldver}-all-languages.tar.gz
+      /bin/mv phpMyAdmin-${phpmyadmin_oldver}-all-languages ${wwwroot_dir}/default/phpMyAdmin
+    else
+      tar xzf phpMyAdmin-${phpmyadmin_ver}-all-languages.tar.gz
+      /bin/mv phpMyAdmin-${phpmyadmin_ver}-all-languages ${wwwroot_dir}/default/phpMyAdmin
+    fi
+    /bin/cp ${wwwroot_dir}/default/phpMyAdmin/{config.sample.inc.php,config.inc.php}
+    mkdir ${wwwroot_dir}/default/phpMyAdmin/{upload,save}
+    sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
+    sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
+    sed -i "s@host'\].*@host'\] = '127.0.0.1';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
+    sed -i "s@blowfish_secret.*;@blowfish_secret\'\] = \'$(cat /dev/urandom | head -1 | base64 | head -c 45)\';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
+    chown -R ${run_user}.${run_user} ${wwwroot_dir}/default/phpMyAdmin
+    popd > /dev/null
   fi
-  /bin/cp ${wwwroot_dir}/default/phpMyAdmin/{config.sample.inc.php,config.inc.php}
-  mkdir ${wwwroot_dir}/default/phpMyAdmin/{upload,save}
-  sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
-  sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
-  sed -i "s@host'\].*@host'\] = '127.0.0.1';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
-  sed -i "s@blowfish_secret.*;@blowfish_secret\'\] = \'$(cat /dev/urandom | head -1 | base64 | head -c 45)\';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
-  chown -R ${run_user}.${run_user} ${wwwroot_dir}/default/phpMyAdmin
-  popd
 }

+ 6 - 8
include/tengine.sh

@@ -18,7 +18,7 @@ Install_Tengine() {
   tar xzf openssl-${openssl_ver}.tar.gz
   [ "${Fedora_ver}" == '28' ] && patch -d tengine-${tengine_ver} -p1 < 0001-unix-ngx_user-Apply-fix-for-really-old-bug-in-glibc-.patch
   patch -d tengine-${tengine_ver} -p0 < nginx-auto-cc-gcc.patch
-  pushd tengine-${tengine_ver}
+  pushd tengine-${tengine_ver} > /dev/null
   # Modify Tengine version
   #sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h
 
@@ -29,10 +29,8 @@ Install_Tengine() {
   ./configure --prefix=${tengine_install_dir} --user=${run_user} --group=${run_user} --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-${openssl_ver} --with-pcre=../pcre-${pcre_ver} --with-pcre-jit --with-jemalloc ${nginx_modules_options}
   make && make install
   if [ -e "${tengine_install_dir}/conf/nginx.conf" ]; then
-    popd
-    rm -rf pcre-${pcre_ver}
-    rm -rf openssl-${openssl_ver}
-    rm -rf tengine-${tengine_ver}
+    popd > /dev/null
+    rm -rf pcre-${pcre_ver} openssl-${openssl_ver} tengine-${tengine_ver}
     echo "${CSUCCESS}Tengine installed successfully! ${CEND}"
   else
     rm -rf ${tengine_install_dir}
@@ -54,9 +52,9 @@ Install_Tengine() {
   fi
 
   mv ${tengine_install_dir}/conf/nginx.conf{,_bk}
-  if [[ ${apache_option} =~ ^[1-2]$ ]]; then
+  if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apachectl" ]; then
     /bin/cp ../config/nginx_apache.conf ${tengine_install_dir}/conf/nginx.conf
-  elif [[ ${tomcat_option} =~ ^[1-2]$ ]] && [ ! -e "${php_install_dir}/bin/php" ]; then
+  elif { [[ ${tomcat_option} =~ ^[1-4]$ ]] || [ -e "${tomcat_install_dir}/conf/server.xml" ]; } && { [[ ! ${php_option} =~ ^[1-8]$ ]] && [ ! -e "${php_install_dir}/bin/php" ]; }; then
     /bin/cp ../config/nginx_tomcat.conf ${tengine_install_dir}/conf/nginx.conf
   else
     /bin/cp ../config/nginx.conf ${tengine_install_dir}/conf/nginx.conf
@@ -102,7 +100,7 @@ ${wwwlogs_dir}/*nginx.log {
   endscript
 }
 EOF
-  popd
+  popd > /dev/null
   ldconfig
   service nginx start
 }

+ 2 - 2
include/upgrade_db.sh

@@ -55,7 +55,7 @@ Upgrade_DB() {
   echo
   echo "Current ${DB} Version: ${CMSG}${OLD_db_ver}${CEND}"
   while :; do echo
-    [ "${db_quiet}" != 'y' ] && read -e -p "Please input upgrade ${DB} Version(example: ${OLD_db_ver}): " NEW_db_ver
+    [ "${db_flag}" != 'y' ] && read -e -p "Please input upgrade ${DB} Version(example: ${OLD_db_ver}): " NEW_db_ver
     if [ `echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'` == `echo ${OLD_db_ver} | awk -F. '{print $1"."$2}'` ]; then
       if [ "${DB}" == 'MariaDB' ]; then
         DB_name=mariadb-${NEW_db_ver}-${GLIBC_FLAG}-${SYS_BIT_b}
@@ -85,7 +85,7 @@ Upgrade_DB() {
 
   if [ -e "`ls ${DB_name}.tar.?z 2>/dev/null`" ]; then
     echo "[${CMSG}`ls ${DB_name}.tar.?z 2>/dev/null`${CEND}] found"
-    if [ "${db_quiet}" != 'y' ]; then
+    if [ "${db_flag}" != 'y' ]; then
       echo "Press Ctrl+c to cancel or Press any key to continue..."
       char=`get_char`
     fi

+ 2 - 2
include/upgrade_memcached.sh

@@ -16,7 +16,7 @@ Upgrade_Memcached() {
   Latest_memcached_ver=${Latest_memcached_ver:-1.5.12}
   echo "Current Memcached Version: ${CMSG}${OLD_memcached_ver}${CEND}"
   while :; do echo
-    [ "${memcached_quiet}" != 'y' ] && read -e -p "Please input upgrade Memcached Version(default: ${Latest_memcached_ver}): " NEW_memcached_ver
+    [ "${memcached_flag}" != 'y' ] && read -e -p "Please input upgrade Memcached Version(default: ${Latest_memcached_ver}): " NEW_memcached_ver
     NEW_memcached_ver=${NEW_memcached_ver:-${Latest_memcached_ver}}
     if [ "${NEW_memcached_ver}" != "${OLD_memcached_ver}" ]; then
       [ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR=http://mirrors.linuxeye.com/oneinstack/src || DOWN_ADDR=http://www.memcached.org/files
@@ -35,7 +35,7 @@ Upgrade_Memcached() {
 
   if [ -e "memcached-${NEW_memcached_ver}.tar.gz" ]; then
     echo "[${CMSG}memcached-${NEW_memcached_ver}.tar.gz${CEND}] found"
-    if [ "${memcached_quiet}" != 'y' ]; then
+    if [ "${memcached_flag}" != 'y' ]; then
       echo "Press Ctrl+c to cancel or Press any key to continue..."
       char=`get_char`
     fi

+ 2 - 2
include/upgrade_php.sh

@@ -17,7 +17,7 @@ Upgrade_PHP() {
   echo
   echo "Current PHP Version: ${CMSG}$OLD_php_ver${CEND}"
   while :; do echo
-    [ "${php_quiet}" != 'y' ] && read -e -p "Please input upgrade PHP Version(Default: $Latest_php_ver): " NEW_php_ver
+    [ "${php_flag}" != 'y' ] && read -e -p "Please input upgrade PHP Version(Default: $Latest_php_ver): " NEW_php_ver
     NEW_php_ver=${NEW_php_ver:-${Latest_php_ver}}
     if [ "${NEW_php_ver%.*}" == "${OLD_php_ver%.*}" ]; then
       [ ! -e "php-${NEW_php_ver}.tar.gz" ] && wget --no-check-certificate -c http://www.php.net/distributions/php-${NEW_php_ver}.tar.gz > /dev/null 2>&1
@@ -34,7 +34,7 @@ Upgrade_PHP() {
 
   if [ -e "php-${NEW_php_ver}.tar.gz" ]; then
     echo "[${CMSG}php-${NEW_php_ver}.tar.gz${CEND}] found"
-    if [ "${php_quiet}" != 'y' ]; then
+    if [ "${php_flag}" != 'y' ]; then
       echo "Press Ctrl+c to cancel or Press any key to continue..."
       char=`get_char`
     fi

+ 2 - 2
include/upgrade_phpmyadmin.sh

@@ -16,7 +16,7 @@ Upgrade_phpMyAdmin() {
   Latest_phpmyadmin_ver=${Latest_phpmyadmin_ver:-4.8.3}
   echo "Current phpMyAdmin Version: ${CMSG}${OLD_phpmyadmin_ver}${CEND}"
   while :; do echo
-    [ "${phpmyadmin_quiet}" != 'y' ] && read -e -p "Please input upgrade phpMyAdmin Version(default: ${Latest_phpmyadmin_ver}): " NEW_phpmyadmin_ver
+    [ "${phpmyadmin_flag}" != 'y' ] && read -e -p "Please input upgrade phpMyAdmin Version(default: ${Latest_phpmyadmin_ver}): " NEW_phpmyadmin_ver
     NEW_phpmyadmin_ver=${NEW_phpmyadmin_ver:-${Latest_phpmyadmin_ver}}
     if [ "${NEW_phpmyadmin_ver}" != "${OLD_phpmyadmin_ver}" ]; then
       [ ! -e "phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz" ] && wget --no-check-certificate -c https://files.phpmyadmin.net/phpMyAdmin/${NEW_phpmyadmin_ver}/phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz > /dev/null 2>&1
@@ -34,7 +34,7 @@ Upgrade_phpMyAdmin() {
 
   if [ -e "phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz" ]; then
     echo "[${CMSG}phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz${CEND}] found"
-    if [ "${phpmyadmin_quiet}" != 'y' ]; then
+    if [ "${phpmyadmin_flag}" != 'y' ]; then
       echo "Press Ctrl+c to cancel or Press any key to continue..."
       char=`get_char`
     fi

+ 2 - 2
include/upgrade_redis.sh

@@ -16,7 +16,7 @@ Upgrade_Redis() {
   Latest_redis_ver=${Latest_redis_ver:-5.0.2}
   echo "Current Redis Version: ${CMSG}$OLD_redis_ver${CEND}"
   while :; do echo
-    [ "${redis_quiet}" != 'y' ] && read -e -p "Please input upgrade Redis Version(default: ${Latest_redis_ver}): " NEW_redis_ver
+    [ "${redis_flag}" != 'y' ] && read -e -p "Please input upgrade Redis Version(default: ${Latest_redis_ver}): " NEW_redis_ver
     NEW_redis_ver=${NEW_redis_ver:-${Latest_redis_ver}}
     if [ "$NEW_redis_ver" != "$OLD_redis_ver" ]; then
       [ ! -e "redis-$NEW_redis_ver.tar.gz" ] && wget --no-check-certificate -c http://download.redis.io/releases/redis-$NEW_redis_ver.tar.gz > /dev/null 2>&1
@@ -34,7 +34,7 @@ Upgrade_Redis() {
 
   if [ -e "redis-$NEW_redis_ver.tar.gz" ]; then
     echo "[${CMSG}redis-$NEW_redis_ver.tar.gz${CEND}] found"
-    if [ "${redis_quiet}" != 'y' ]; then
+    if [ "${redis_flag}" != 'y' ]; then
       echo "Press Ctrl+c to cancel or Press any key to continue..."
       char=`get_char`
     fi

+ 16 - 16
include/upgrade_web.sh

@@ -18,7 +18,7 @@ Upgrade_Nginx() {
   echo
   echo "Current Nginx Version: ${CMSG}${OLD_nginx_ver}${CEND}"
   while :; do echo
-    [ "${nginx_quiet}" != 'y' ] && read -e -p "Please input upgrade Nginx Version(default: ${Latest_nginx_ver}): " NEW_nginx_ver
+    [ "${nginx_flag}" != 'y' ] && read -e -p "Please input upgrade Nginx Version(default: ${Latest_nginx_ver}): " NEW_nginx_ver
     NEW_nginx_ver=${NEW_nginx_ver:-${Latest_nginx_ver}}
     if [ "${NEW_nginx_ver}" != "${OLD_nginx_ver}" ]; then
       [ ! -e "nginx-${NEW_nginx_ver}.tar.gz" ] && wget --no-check-certificate -c http://nginx.org/download/nginx-${NEW_nginx_ver}.tar.gz > /dev/null 2>&1
@@ -40,7 +40,7 @@ Upgrade_Nginx() {
 
   if [ -e "nginx-${NEW_nginx_ver}.tar.gz" ]; then
     echo "[${CMSG}nginx-${NEW_nginx_ver}.tar.gz${CEND}] found"
-    if [ "${nginx_quiet}" != 'y' ]; then
+    if [ "${nginx_flag}" != 'y' ]; then
       echo "Press Ctrl+c to cancel or Press any key to continue..."
       char=`get_char`
     fi
@@ -83,7 +83,7 @@ Upgrade_Tengine() {
   echo
   echo "Current Tengine Version: ${CMSG}${OLD_tengine_ver}${CEND}"
   while :; do echo
-    [ "${tengine_quiet}" != 'y' ] && read -e -p "Please input upgrade Tengine Version(default: ${Latest_tengine_ver}): " NEW_tengine_ver
+    [ "${tengine_flag}" != 'y' ] && read -e -p "Please input upgrade Tengine Version(default: ${Latest_tengine_ver}): " NEW_tengine_ver
     NEW_tengine_ver=${NEW_tengine_ver:-${Latest_tengine_ver}}
     if [ "${NEW_tengine_ver}" != "${OLD_tengine_ver}" ]; then
       [ ! -e "tengine-${NEW_tengine_ver}.tar.gz" ] && wget --no-check-certificate -c http://tengine.taobao.org/download/tengine-${NEW_tengine_ver}.tar.gz > /dev/null 2>&1
@@ -105,7 +105,7 @@ Upgrade_Tengine() {
 
   if [ -e "tengine-${NEW_tengine_ver}.tar.gz" ]; then
     echo "[${CMSG}tengine-${NEW_tengine_ver}.tar.gz${CEND}] found"
-    if [ "${tengine_quiet}" != 'y' ]; then
+    if [ "${tengine_flag}" != 'y' ]; then
       echo "Press Ctrl+c to cancel or Press any key to continue..."
       char=`get_char`
     fi
@@ -153,7 +153,7 @@ Upgrade_OpenResty() {
   echo
   echo "Current OpenResty Version: ${CMSG}${OLD_openresy_ver}${CEND}"
   while :; do echo
-    [ "${openresty_quiet}" != 'y' ] && read -e -p "Please input upgrade OpenResty Version(default: ${Latest_openresy_ver}): " NEW_openresy_ver
+    [ "${openresty_flag}" != 'y' ] && read -e -p "Please input upgrade OpenResty Version(default: ${Latest_openresy_ver}): " NEW_openresy_ver
     NEW_openresy_ver=${NEW_openresy_ver:-${Latest_openresy_ver}}
     if [ "${NEW_openresy_ver}" != "${OLD_openresy_ver}" ]; then
       [ ! -e "openresty-${NEW_openresy_ver}.tar.gz" ] && wget --no-check-certificate -c https://openresty.org/download/openresty-${NEW_openresy_ver}.tar.gz > /dev/null 2>&1
@@ -175,7 +175,7 @@ Upgrade_OpenResty() {
 
   if [ -e "openresty-${NEW_openresy_ver}.tar.gz" ]; then
     echo "[${CMSG}openresty-${NEW_openresy_ver}.tar.gz${CEND}] found"
-    if [ "${openresty_quiet}" != 'y' ]; then
+    if [ "${openresty_flag}" != 'y' ]; then
       echo "Press Ctrl+c to cancel or Press any key to continue..."
       char=`get_char`
     fi
@@ -208,17 +208,17 @@ Upgrade_Apache() {
   pushd ${oneinstack_dir}/src > /dev/null
   [ ! -e "${apache_install_dir}/bin/httpd" ] && echo "${CWARNING}Apache is not installed on your system! ${CEND}" && exit 1
   OLD_apache_ver="`${apache_install_dir}/bin/httpd -v | grep version | awk -F'/| ' '{print $4}'`"
-  Apache_flag="`echo ${OLD_apache_ver} | awk -F. '{print $1 $2}'`"
-  Latest_apache_ver=`curl --connect-timeout 2 -m 3 -s http://httpd.apache.org/download.cgi | awk "/#apache${Apache_flag}/{print $2}" | head -1 | grep -oE "2\.[24]\.[0-9]+"`
+  Apache_main_ver="`echo ${OLD_apache_ver} | awk -F. '{print $1 $2}'`"
+  Latest_apache_ver=`curl --connect-timeout 2 -m 3 -s http://httpd.apache.org/download.cgi | awk "/#apache${Apache_main_ver}/{print $2}" | head -1 | grep -oE "2\.[24]\.[0-9]+"`
   Latest_apache_ver=${Latest_apache_ver:-${apache22_ver}}
   echo
   echo "Current Apache Version: ${CMSG}${OLD_apache_ver}${CEND}"
   while :; do echo
-    [ "${apache_quiet}" != 'y' ] && read -e -p "Please input upgrade Apache Version(Default: ${Latest_apache_ver}): " NEW_apache_ver
+    [ "${apache_flag}" != 'y' ] && read -e -p "Please input upgrade Apache Version(Default: ${Latest_apache_ver}): " NEW_apache_ver
     NEW_apache_ver=${NEW_apache_ver:-${Latest_apache_ver}}
-    if [ `echo ${NEW_apache_ver} | awk -F. '{print $1$2}'` == "${Apache_flag}" ]; then
+    if [ `echo ${NEW_apache_ver} | awk -F. '{print $1$2}'` == "${Apache_main_ver}" ]; then
       if [ "${NEW_apache_ver}" != "${OLD_apache_ver}" ]; then
-        if [ "${Apache_flag}" == '24' ]; then
+        if [ "${Apache_main_ver}" == '24' ]; then
           src_url=http://archive.apache.org/dist/apr/apr-${apr_ver}.tar.gz && Download_src
           src_url=http://archive.apache.org/dist/apr/apr-util-${apr_util_ver}.tar.gz && Download_src
           tar xzf apr-${apr_ver}.tar.gz
@@ -242,18 +242,18 @@ Upgrade_Apache() {
 
   if [ -e "httpd-${NEW_apache_ver}.tar.gz" ]; then
     echo "[${CMSG}httpd-${NEW_apache_ver}.tar.gz${CEND}] found"
-    if [ "${apache_quiet}" != 'y' ]; then
+    if [ "${apache_flag}" != 'y' ]; then
       echo "Press Ctrl+c to cancel or Press any key to continue..."
       char=`get_char`
     fi
     tar xzf httpd-${NEW_apache_ver}.tar.gz
     pushd httpd-${NEW_apache_ver}
     make clean
-    if [ "${Apache_flag}" == '24' ]; then
+    if [ "${Apache_main_ver}" == '24' ]; then
       /bin/cp -R ../apr-${apr_ver} ./srclib/apr
       /bin/cp -R ../apr-util-${apr_util_ver} ./srclib/apr-util
       LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --enable-mpms-shared=all --with-pcre --with-included-apr --enable-headers --enable-mime-magic --enable-deflate --enable-proxy --enable-so --enable-dav --enable-rewrite --enable-remoteip --enable-expires --enable-static-support --enable-suexec --enable-mods-shared=most --enable-nonportable-atomics=yes --enable-ssl --with-ssl=${openssl_install_dir} --enable-http2 --with-nghttp2=/usr/local
-    elif [ "${Apache_flag}" == '22' ]; then
+    elif [ "${Apache_main_ver}" == '22' ]; then
       [ "${Ubuntu_ver}" == "12" ] && sed -i '@SSL_PROTOCOL_SSLV2@d' modules/ssl/ssl_engine_io.c
       LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --with-mpm=prefork --enable-mpms-shared=all --with-included-apr --enable-headers --enable-mime-magic --enable-deflate --enable-proxy --enable-so --enable-dav --enable-rewrite --enable-expires --enable-static-support --enable-suexec --with-expat=builtin --enable-mods-shared=most --enable-ssl --with-ssl=${openssl_install_dir}
     fi
@@ -284,7 +284,7 @@ Upgrade_Tomcat() {
   echo
   echo "Current Tomcat Version: ${CMSG}${OLD_tomcat_ver}${CEND}"
   while :; do echo
-    [ "${tomcat_quiet}" != 'y' ] && read -e -p "Please input upgrade Tomcat Version(Default: ${Latest_tomcat_ver}): " NEW_tomcat_ver
+    [ "${tomcat_flag}" != 'y' ] && read -e -p "Please input upgrade Tomcat Version(Default: ${Latest_tomcat_ver}): " NEW_tomcat_ver
     NEW_tomcat_ver=${NEW_tomcat_ver:-${Latest_tomcat_ver}}
     if [ "`echo ${NEW_tomcat_ver} | awk -F. '{print $1}'`" == "${Tomcat_flag}" ]; then
       rm -f catalina-jmx-remote.jar
@@ -306,7 +306,7 @@ Upgrade_Tomcat() {
 
   if [ -e "apache-tomcat-${NEW_tomcat_ver}.tar.gz" ]; then
     echo "[${CMSG}apache-tomcat-${NEW_tomcat_ver}.tar.gz${CEND}] found"
-    if [ "${tomcat_quiet}" != 'y' ]; then
+    if [ "${tomcat_flag}" != 'y' ]; then
       echo "Press Ctrl+c to cancel or Press any key to continue..."
       char=`get_char`
     fi

+ 6 - 1
install.sh

@@ -206,6 +206,7 @@ if [ -e "/etc/ssh/sshd_config" ]; then
       break
     else
       echo "${CWARNING}input error! Input range: 22,1025~65534${CEND}"
+      exit 1
     fi
   done
 
@@ -685,7 +686,11 @@ if [ ${ARG_NUM} == 0 ]; then
 fi
 
 # install wget gcc curl python
-[ ! -e ~/.oneinstack ] && ${PM} -y -q install wget gcc curl python
+if [ ! -e ~/.oneinstack ]; then
+  [ "${PM}" == 'apt-get' ] && apt-get -y update
+  [ "${PM}" == 'yum' ] && yum clean all
+  ${PM} -y -q install wget gcc curl python
+fi
 
 # get the IP information
 IPADDR=$(./include/get_ipaddr.py)

+ 18 - 18
pureftpd_vhost.sh

@@ -61,31 +61,31 @@ while :; do
       Show_Help; exit 0
       ;;
     --add|--useradd)
-      useradd_quiet=y; shift 1
+      useradd_flag=y; shift 1
       ;;
     --usermod)
-      usermod_quiet=y; shift 1
+      usermod_flag=y; shift 1
       ;;
     --passwd)
-      passwd_quiet=y; shift 1
+      passwd_flag=y; shift 1
       ;;
     --delete|--userdel)
-      userdel_quiet=y; shift 1
+      userdel_flag=y; shift 1
       ;;
     --list|--listalluser)
-      listalluser_quiet=y; shift 1
+      listalluser_flag=y; shift 1
       ;;
     --showuser)
-      showuser_quiet=y; shift 1
+      showuser_flag=y; shift 1
       ;;
     -u|--username)
-      username_quiet=y; User=$2; shift 2
+      username_flag=y; User=$2; shift 2
       ;;
     -p|--password)
-      password_quiet=y; Password=$2; shift 2
+      password_flag=y; Password=$2; shift 2
       ;;
     -d|-D|--directory)
-      directory_quiet=y; Directory=$2; shift 2
+      directory_flag=y; Directory=$2; shift 2
       ;;
     --)
       shift
@@ -98,7 +98,7 @@ done
 
 USER() {
   while :; do
-    if [ "${username_quiet}" != 'y' ]; then
+    if [ "${username_flag}" != 'y' ]; then
       echo
       read -e -p "Please input a username: " User
     fi
@@ -112,7 +112,7 @@ USER() {
 
 PASSWORD() {
   while :; do
-    if [ "${password_quiet}" != 'y' ]; then
+    if [ "${password_flag}" != 'y' ]; then
       echo
       read -e -p "Please input the password: " Password
     fi
@@ -128,7 +128,7 @@ PASSWORD() {
 
 DIRECTORY() {
   while :; do
-    if [ "${directory_quiet}" != 'y' ]; then
+    if [ "${directory_flag}" != 'y' ]; then
       echo
       read -e -p "Please input the directory(Default directory: ${wwwroot_dir}): " Directory
     fi
@@ -262,10 +262,10 @@ What Are You Doing?
 if [ ${ARG_NUM} == 0 ]; then
   Menu
 else
-  [ "${useradd_quiet}" == 'y' ] && UserAdd
-  [ "${usermod_quiet}" == 'y' ] && UserMod
-  [ "${passwd_quiet}" == 'y' ] && UserPasswd
-  [ "${userdel_quiet}" == 'y' ] && UserDel
-  [ "${listalluser_quiet}" == 'y' ] && ListAllUser
-  [ "${showuser_quiet}" == 'y' ] && ShowUser
+  [ "${useradd_flag}" == 'y' ] && UserAdd
+  [ "${usermod_flag}" == 'y' ] && UserMod
+  [ "${passwd_flag}" == 'y' ] && UserPasswd
+  [ "${userdel_flag}" == 'y' ] && UserDel
+  [ "${listalluser_flag}" == 'y' ] && ListAllUser
+  [ "${showuser_flag}" == 'y' ] && ShowUser
 fi

+ 22 - 19
upgrade.sh

@@ -71,31 +71,34 @@ while :; do
       Show_Help; exit 0
       ;;
     --nginx)
-      nginx_quiet=y; NEW_nginx_ver=$2; shift 2
+      nginx_flag=y; NEW_nginx_ver=$2; shift 2
       ;;
     --tengine)
-      tengine_quiet=y; NEW_tengine_ver=$2; shift 2
+      tengine_flag=y; NEW_tengine_ver=$2; shift 2
       ;;
     --openresty)
-      openresty_quiet=y; NEW_openresy_ver=$2; shift 2
+      openresty_flag=y; NEW_openresy_ver=$2; shift 2
       ;;
     --apache)
-      apache_quiet=y; NEW_apache_ver=$2; shift 2
+      apache_flag=y; NEW_apache_ver=$2; shift 2
       ;;
     --tomcat)
-      tomcat_quiet=y; NEW_tomcat_ver=$2; shift 2
+      tomcat_flag=y; NEW_tomcat_ver=$2; shift 2
+      ;;
+    --db)
+      db_flag=y; NEW_db_ver=$2; shift 2
       ;;
     --php)
-      php_quiet=y; NEW_php_ver=$2; shift 2
+      php_flag=y; NEW_php_ver=$2; shift 2
       ;;
     --redis)
-      redis_quiet=y; NEW_redis_ver=$2; shift 2
+      redis_flag=y; NEW_redis_ver=$2; shift 2
       ;;
     --memcached)
-      memcached_quiet=y; NEW_memcached_ver=$2; shift 2
+      memcached_flag=y; NEW_memcached_ver=$2; shift 2
       ;;
     --phpmyadmin)
-      phpmyadmin_quiet=y; NEW_phpmyadmin_ver=$2; shift 2
+      phpmyadmin_flag=y; NEW_phpmyadmin_ver=$2; shift 2
       ;;
     --oneinstack)
       NEW_oneinstack_ver=latest; shift 1
@@ -177,16 +180,16 @@ What Are You Doing?
 if [ ${ARG_NUM} == 0 ]; then
   Menu
 else
-  [ "${nginx_quiet}" == 'y' ] && Upgrade_Nginx
-  [ "${tengine_quiet}" == 'y' ] && Upgrade_Tengine
-  [ "${openresty_quiet}" == 'y' ] && Upgrade_OpenResty
-  [ "${apache_quiet}" == 'y' ] && Upgrade_Apache
-  [ "${tomcat_quiet}" == 'y' ] && Upgrade_Tomcat
-  [ "${db_quiet}" == 'y' ] && Upgrade_DB
-  [ "${php_quiet}" == 'y' ] && Upgrade_PHP
-  [ "${redis_quiet}" == 'y' ] && Upgrade_Redis
-  [ "${memcached_quiet}" == 'y' ] && Upgrade_Memcached
-  [ "${phpmyadmin_quiet}" == 'y' ] && Upgrade_phpMyAdmin
+  [ "${nginx_flag}" == 'y' ] && Upgrade_Nginx
+  [ "${tengine_flag}" == 'y' ] && Upgrade_Tengine
+  [ "${openresty_flag}" == 'y' ] && Upgrade_OpenResty
+  [ "${apache_flag}" == 'y' ] && Upgrade_Apache
+  [ "${tomcat_flag}" == 'y' ] && Upgrade_Tomcat
+  [ "${db_flag}" == 'y' ] && Upgrade_DB
+  [ "${php_flag}" == 'y' ] && Upgrade_PHP
+  [ "${redis_flag}" == 'y' ] && Upgrade_Redis
+  [ "${memcached_flag}" == 'y' ] && Upgrade_Memcached
+  [ "${phpmyadmin_flag}" == 'y' ] && Upgrade_phpMyAdmin
   [ "${NEW_oneinstack_ver}" == 'latest' ] && Upgrade_OneinStack
   [ "${NEW_acme_ver}" == 'latest' ] && [ -e ~/.acme.sh/acme.sh ] && { ~/.acme.sh/acme.sh --upgrade; ~/.acme.sh/acme.sh --version; }
 fi

+ 1 - 1
versions.txt

@@ -51,7 +51,7 @@ php73_ver=7.3.1
 php72_ver=7.2.14
 php71_ver=7.1.26
 php70_ver=7.0.33
-php56_ver=5.6.39
+php56_ver=5.6.40
 php55_ver=5.5.38
 php54_ver=5.4.45
 php53_ver=5.3.29

+ 4 - 4
vhost.sh

@@ -99,8 +99,8 @@ done
 
 Choose_ENV() {
   if [ -e "${apache_install_dir}/bin/apachectl" ];then
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && { Apache_flag=24; Apache_grant='Require all granted'; }
-    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && { Apache_main_ver=24; Apache_grant='Require all granted'; }
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_main_ver=22
   fi
   if [ -e "${php_install_dir}/bin/phpize" -a -e "${tomcat_install_dir}/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then
     Number=111
@@ -755,7 +755,7 @@ Apache_log() {
 }
 
 Create_apache_conf() {
-  if [ "${Apache_flag}" == '24' ]; then
+  if [ "${Apache_main_ver}" == '24' ]; then
     if [ -e "/dev/shm/php-cgi.sock" ] && [ -n "`grep -E ^LoadModule.*mod_proxy_fcgi.so ${apache_install_dir}/conf/httpd.conf`" ]; then
       Apache_fcgi=$(echo -e "<Files ~ (\\.user.ini|\\.htaccess|\\.git|\\.svn|\\.project|LICENSE|README.md)\$>\n    Order allow,deny\n    Deny from all\n  </Files>\n  <FilesMatch \\.php\$>\n    SetHandler \"proxy:unix:/dev/shm/php-cgi.sock|fcgi://localhost\"\n  </FilesMatch>")
     fi
@@ -876,7 +876,7 @@ EOF
   fi
 
   # Apache
-  if [ "${Apache_flag}" == '24' ]; then
+  if [ "${Apache_main_ver}" == '24' ]; then
     if [ -e "/dev/shm/php-cgi.sock" ] && [ -n "`grep -E ^LoadModule.*mod_proxy_fcgi.so ${apache_install_dir}/conf/httpd.conf`" ]; then
       Apache_fcgi=$(echo -e "<Files ~ (\\.user.ini|\\.htaccess|\\.git|\\.svn|\\.project|LICENSE|README.md)\$>\n    Order allow,deny\n    Deny from all\n  </Files>\n  <FilesMatch \\.php\$>\n    SetHandler \"proxy:unix:/dev/shm/php-cgi.sock|fcgi://localhost\"\n  </FilesMatch>")
     fi