Browse Source

Fix memcached bug

lj2007331@gmail.com 7 năm trước cách đây
mục cha
commit
f8d226c912
84 tập tin đã thay đổi với 1306 bổ sung1346 xóa
  1. 54 65
      addons.sh
  2. 41 40
      backup.sh
  3. 23 24
      backup_setup.sh
  4. 8 8
      include/GraphicsMagick.sh
  5. 3 3
      include/ImageMagick.sh
  6. 14 14
      include/ZendGuardLoader.sh
  7. 2 3
      include/alisql-5.6.sh
  8. 13 13
      include/apache-2.2.sh
  9. 16 16
      include/apache-2.4.sh
  10. 2 2
      include/apcu.sh
  11. 2 2
      include/boost.sh
  12. 4 4
      include/check_dir.sh
  13. 30 30
      include/check_download.sh
  14. 13 13
      include/check_os.sh
  15. 12 13
      include/check_sw.sh
  16. 1 1
      include/color.sh
  17. 3 4
      include/demo.sh
  18. 2 2
      include/download.sh
  19. 7 5
      include/eaccelerator.sh
  20. 1 1
      include/get_char.sh
  21. 3 3
      include/hhvm_CentOS.sh
  22. 6 6
      include/init_CentOS.sh
  23. 2 2
      include/init_Debian.sh
  24. 2 2
      include/init_Ubuntu.sh
  25. 6 6
      include/ioncube.sh
  26. 2 3
      include/jdk-1.6.sh
  27. 2 3
      include/jdk-1.7.sh
  28. 2 3
      include/jdk-1.8.sh
  29. 3 3
      include/jemalloc.sh
  30. 2 3
      include/mariadb-10.0.sh
  31. 2 3
      include/mariadb-10.1.sh
  32. 2 3
      include/mariadb-10.2.sh
  33. 2 3
      include/mariadb-5.5.sh
  34. 6 6
      include/memcached.sh
  35. 1 1
      include/memory.sh
  36. 2 2
      include/mongodb.sh
  37. 2 3
      include/mysql-5.5.sh
  38. 2 3
      include/mysql-5.6.sh
  39. 2 3
      include/mysql-5.7.sh
  40. 11 12
      include/nginx.sh
  41. 11 12
      include/openresty.sh
  42. 2 2
      include/openssl.sh
  43. 2 2
      include/pecl_mongodb.sh
  44. 7 7
      include/pecl_pgsql.sh
  45. 2 3
      include/percona-5.5.sh
  46. 2 3
      include/percona-5.6.sh
  47. 2 3
      include/percona-5.7.sh
  48. 79 80
      include/php-5.3.sh
  49. 79 80
      include/php-5.4.sh
  50. 82 83
      include/php-5.5.sh
  51. 81 82
      include/php-5.6.sh
  52. 82 83
      include/php-7.0.sh
  53. 82 83
      include/php-7.1.sh
  54. 79 80
      include/php-7.2.sh
  55. 3 3
      include/phpmyadmin.sh
  56. 2 2
      include/postgresql.sh
  57. 4 5
      include/pureftpd.sh
  58. 4 4
      include/python.sh
  59. 4 4
      include/redis.sh
  60. 11 12
      include/tengine.sh
  61. 3 5
      include/tomcat-6.sh
  62. 3 5
      include/tomcat-7.sh
  63. 3 5
      include/tomcat-8.sh
  64. 31 31
      include/upgrade_db.sh
  65. 20 18
      include/upgrade_memcached.sh
  66. 2 1
      include/upgrade_oneinstack.sh
  67. 1 1
      include/upgrade_php.sh
  68. 2 2
      include/upgrade_phpmyadmin.sh
  69. 18 18
      include/upgrade_redis.sh
  70. 37 37
      include/upgrade_web.sh
  71. 2 2
      include/xcache.sh
  72. 9 9
      include/zendopcache.sh
  73. 169 165
      install.sh
  74. 0 3
      options.conf
  75. 12 11
      pureftpd_vhost.sh
  76. 5 6
      reset_db_root_password.sh
  77. 21 23
      ss.sh
  78. 8 8
      tools/db_bk.sh
  79. 2 2
      tools/mabs.sh
  80. 5 5
      tools/website_bk.sh
  81. 6 6
      uninstall.sh
  82. 4 5
      upgrade.sh
  83. 6 6
      versions.txt
  84. 4 3
      vhost.sh

+ 54 - 65
addons.sh

@@ -17,12 +17,11 @@ printf "
 #       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
-
 # Check if user is root
 [ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
 
-# get pwd
-sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf
+oneinstack_dir=$(dirname "`readlink -f $0`")
+pushd ${oneinstack_dir} > /dev/null
 
 # get the IP information
 PUBLIC_IPADDR=`./include/get_public_ipaddr.py`
@@ -57,34 +56,13 @@ IPADDR_COUNTRY=`./include/get_ipaddr_state.py $PUBLIC_IPADDR | awk '{print $1}'`
 # Check PHP
 if [ -e "${php_install_dir}/bin/phpize" ]; then
   phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
-  PHP_detail_version=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
-  PHP_main_version=${PHP_detail_version%.*}
-
-  case "${PHP_main_version}" in
-    "5.3")
-      php_ver=1
-      ;;
-    "5.4")
-      php_ver=2
-      ;;
-    "5.5")
-      php_ver=3
-      ;;
-    "5.6")
-      php_ver=4
-      ;;
-    "7.0" | "7.1" | "7.2" )
-      php_ver=5
-      ;;
-    *)
-      echo "${CFAILURE}Your PHP version ${PHP_main_version} is not supported! ${CEND}"
-      kill -9 $$
-      ;;
-  esac
+  PHP_detail_ver=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
+  PHP_main_ver=${PHP_detail_ver%.*}
 fi
 
 # Check PHP Extensions
 Check_PHP_Extension() {
+  [ ! -e "${php_install_dir}/bin/phpize" ] && { echo "${CWARNING}PHP was not exist! ${CEND}"; exit 1; } 
   [ -e "${php_install_dir}/etc/php.d/ext-${PHP_extension}.ini" ] && { echo "${CWARNING}PHP ${PHP_extension} module already installed! ${CEND}"; exit 1; }
 }
 
@@ -124,7 +102,7 @@ Uninstall_letsencrypt() {
 
 Install_fail2ban() {
   [ ! -e "${python_install_dir}/bin/python" ] && Install_Python
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   src_url=http://mirrors.linuxeye.com/oneinstack/src/fail2ban-${fail2ban_ver}.tar.gz && Download_src
   tar xzf fail2ban-${fail2ban_ver}.tar.gz
   pushd fail2ban-${fail2ban_ver}
@@ -232,12 +210,12 @@ What Are You Doing?
           echo -e "\t${CMSG}2${CEND}. XCache"
           echo -e "\t${CMSG}3${CEND}. APCU"
           echo -e "\t${CMSG}4${CEND}. eAccelerator"
-          read -p "Please input a number:(Default 1 press Enter) " php_cache
-          [ -z "${php_cache}" ] && php_cache=1
-          if [[ ! "${php_cache}" =~ ^[1-4]$ ]]; then
+          read -p "Please input a number:(Default 1 press Enter) " phpcache_option
+          [ -z "${phpcache_option}" ] && phpcache_option=1
+          if [[ ! "${phpcache_option}" =~ ^[1-4]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~4${CEND}"
           else
-            case "${php_cache}" in
+            case "${phpcache_option}" in
               1)
                 PHP_extension=opcache
                 ;;
@@ -259,21 +237,21 @@ What Are You Doing?
           if [ -e ${php_install_dir}/etc/php.d/ext-ZendGuardLoader.ini ]; then
             echo; echo "${CWARNING}You have to install ZendGuardLoader, You need to uninstall it before install ${PHP_extension}! ${CEND}"; echo; exit 1
           else
-            case "${php_cache}" in
+            case "${phpcache_option}" in
               1)
-                pushd ${oneinstack_dir}/src
-                if [[ "${PHP_main_version}" =~ ^5.[3-4]$ ]]; then
+                pushd ${oneinstack_dir}/src > /dev/null
+                if [[ "${PHP_main_ver}" =~ ^5.[3-4]$ ]]; then
                   src_url=https://pecl.php.net/get/zendopcache-${zendopcache_ver}.tgz && Download_src
                   Install_ZendOPcache
                 else
-                  src_url=http://www.php.net/distributions/php-${PHP_detail_version}.tar.gz && Download_src
+                  src_url=http://www.php.net/distributions/php-${PHP_detail_ver}.tar.gz && Download_src
                   Install_ZendOPcache
                 fi
                 popd
                 Check_succ
                 ;;
               2)
-                if [[ ${PHP_main_version} =~ ^5.[3-6]$ ]]; then
+                if [[ "${PHP_main_ver}" =~ ^5.[3-6]$ ]]; then
                   while :; do
                     read -p "Please input xcache admin password: " xcache_admin_pass
                     (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=$(echo -n "${xcache_admin_pass}" | md5sum | awk '{print $1}') ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}"
@@ -286,7 +264,7 @@ What Are You Doing?
                 fi
                 ;;
               3)
-                if [[ "${PHP_main_version}" =~ ^5.[3-6]$|^7.[0-1]$ ]]; then
+                if [[ "${PHP_main_ver}" =~ ^5.[3-6]$|^7.[0-2]$ ]]; then
                   checkDownload
                   Install_APCU
                   Check_succ
@@ -295,7 +273,7 @@ What Are You Doing?
                 fi
                 ;;
               4)
-                if [[ "${PHP_main_version}" =~ ^5.[3-4]$ ]]; then
+                if [[ "${PHP_main_ver}" =~ ^5.[3-4]$ ]]; then
                   checkDownload
                   Install_eAccelerator
                   Check_succ
@@ -328,7 +306,7 @@ What Are You Doing?
         if [ "${ACTION}" = '1' ]; then
           Check_PHP_Extension
           if [ "${Loader}" = '1' ]; then
-            if [[ "${PHP_main_version}" =~ ^5.[3-6]$ ]] || [ "${armplatform}" != 'y' ]; then
+            if [[ "${PHP_main_ver}" =~ ^5.[3-6]$ ]] || [ "${armplatform}" != 'y' ]; then
               if [ -e ${php_install_dir}/etc/php.d/ext-opcache.ini ]; then
                 echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1
               else
@@ -337,15 +315,15 @@ What Are You Doing?
                 Check_succ
               fi
             else
-              echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}";
+              echo; echo "${CWARNING}Your php ${PHP_detail_ver} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}";
             fi
           elif [ "${Loader}" = '2' ]; then
-            if [[ "${PHP_main_version}" =~ ^5.[3-6]$|^7.[0-2]$ ]] || [ "${TARGET_ARCH}" != "arm64" ]; then
+            if [[ "${PHP_main_ver}" =~ ^5.[3-6]$|^7.[0-2]$ ]] || [ "${TARGET_ARCH}" != "arm64" ]; then
               ioncube_yn='y' && checkDownload
               Install_ionCube
               Restart_PHP; echo "${CSUCCESS}PHP ioncube module installed successfully! ${CEND}";
             else
-              echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}";
+              echo; echo "${CWARNING}Your php ${PHP_detail_ver} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}";
             fi
           fi
         else
@@ -358,24 +336,24 @@ What Are You Doing?
           echo "Please select ImageMagick/GraphicsMagick:"
           echo -e "\t${CMSG}1${CEND}. ImageMagick"
           echo -e "\t${CMSG}2${CEND}. GraphicsMagick"
-          read -p "Please input a number:(Default 1 press Enter) " magick
-          [ -z "${magick}" ] && magick=1
-          if [[ ! "${magick}" =~ ^[1,2]$ ]]; then
+          read -p "Please input a number:(Default 1 press Enter) " magick_option
+          [ -z "${magick_option}" ] && magick_option=1
+          if [[ ! "${magick_option}" =~ ^[1,2]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~2${CEND}"
           else
-            [ "${magick}" = '1' ] && PHP_extension=imagick
-            [ "${magick}" = '2' ] && PHP_extension=gmagick
+            [ "${magick_option}" = '1' ] && PHP_extension=imagick
+            [ "${magick_option}" = '2' ] && PHP_extension=gmagick
             break
           fi
         done
         if [ "${ACTION}" = '1' ]; then
           Check_PHP_Extension
           magick_yn=y && checkDownload
-          if [ "${magick}" = '1' ]; then
+          if [ "${magick_option}" = '1' ]; then
             [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick
             Install_php-imagick
             Check_succ
-          elif [ "${magick}" = '2' ]; then
+          elif [ "${magick_option}" = '2' ]; then
             [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick
             Install_php-gmagick
             Check_succ
@@ -391,15 +369,15 @@ What Are You Doing?
         PHP_extension=fileinfo
         if [ "${ACTION}" = '1' ]; then
           Check_PHP_Extension
-          pushd ${oneinstack_dir}/src
-          src_url=http://www.php.net/distributions/php-${PHP_detail_version}.tar.gz && Download_src
-          tar xzf php-${PHP_detail_version}.tar.gz
-          pushd php-${PHP_detail_version}/ext/fileinfo
+          pushd ${oneinstack_dir}/src > /dev/null
+          src_url=http://www.php.net/distributions/php-${PHP_detail_ver}.tar.gz && Download_src
+          tar xzf php-${PHP_detail_ver}.tar.gz
+          pushd php-${PHP_detail_ver}/ext/fileinfo
           ${php_install_dir}/bin/phpize
           ./configure --with-php-config=${php_install_dir}/bin/php-config
           make -j ${THREAD} && make install
           popd;popd
-          rm -rf php-${PHP_detail_version}
+          rm -rf php-${PHP_detail_ver}
           echo "extension=fileinfo.so" > ${php_install_dir}/etc/php.d/ext-fileinfo.ini
           Check_succ
         else
@@ -479,8 +457,8 @@ What Are You Doing?
         PHP_extension=swoole
         if [ "${ACTION}" = '1' ]; then
           Check_PHP_Extension
-          pushd ${oneinstack_dir}/src
-          if [[ "${PHP_main_version}" =~ ^7\.[0-1]$ ]]; then
+          pushd ${oneinstack_dir}/src > /dev/null
+          if [[ "${PHP_main_ver}" =~ ^7\.[0-2]$ ]]; then
             src_url=https://pecl.php.net/get/swoole-${swoole_ver}.tgz && Download_src
             tar xzf swoole-${swoole_ver}.tgz
             pushd swoole-${swoole_ver}
@@ -502,18 +480,29 @@ What Are You Doing?
         fi
         ;;
       9)
-        [[ ! "${PHP_main_version}" =~ ^5\.[5-6]$|^7\.[0-1]$ ]] && { echo "${CWARNING}Need a PHP version >= 5.5.0 and < 7.2.0${CEND}"; exit 1; }
         ACTION_FUN
         PHP_extension=xdebug
         if [ "${ACTION}" = '1' ]; then
           Check_PHP_Extension
-          pushd ${oneinstack_dir}/src
-          src_url=https://pecl.php.net/get/xdebug-${xdebug_ver}.tgz && Download_src
-          src_url=http://mirrors.linuxeye.com/oneinstack/src/webgrind-master.zip && Download_src
-          tar xzf xdebug-${xdebug_ver}.tgz
-          unzip -q webgrind-master.zip 
-          /bin/mv webgrind-master ${wwwroot_dir}/default/webgrind 
-          pushd xdebug-${xdebug_ver}
+          pushd ${oneinstack_dir}/src > /dev/null
+          if [[ "${PHP_main_ver}" =~ ^7\.[0-2]$ ]]; then
+            src_url=https://pecl.php.net/get/xdebug-${xdebug_ver}.tgz && Download_src
+            src_url=http://mirrors.linuxeye.com/oneinstack/src/webgrind-master.zip && Download_src
+            tar xzf xdebug-${xdebug_ver}.tgz 
+            unzip -q webgrind-master.zip
+            /bin/mv webgrind-master ${wwwroot_dir}/default/webgrind 
+            pushd xdebug-${xdebug_ver} 
+          elif [[ "${PHP_main_ver}" =~ ^5\.[5-6]$ ]]; then
+            src_url=https://pecl.php.net/get/xdebug-2.5.5.tgz && Download_src
+            src_url=http://mirrors.linuxeye.com/oneinstack/src/webgrind-master.zip && Download_src
+            tar xzf xdebug-2.5.5.tgz 
+            unzip -q webgrind-master.zip
+            /bin/mv webgrind-master ${wwwroot_dir}/default/webgrind 
+            pushd xdebug-2.5.5 
+          else
+            echo "${CWARNING}Need a PHP version >= 5.5.0 and <= 7.2.0${CEND}"
+            exit 1
+          fi
           ${php_install_dir}/bin/phpize
           ./configure --with-php-config=${php_install_dir}/bin/php-config
           make -j ${THREAD} && make install

+ 41 - 40
backup.sh

@@ -11,126 +11,127 @@
 # Check if user is root
 [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
 
-pushd tools > /dev/null
+oneinstack_dir=$(dirname "`readlink -f $0`")
+pushd ${oneinstack_dir}/tools > /dev/null
 . ../options.conf
 
 DB_Local_BK() {
-  for D in `echo $db_name | tr ',' ' '`
+  for D in `echo ${db_name} | tr ',' ' '`
   do
     ./db_bk.sh $D
   done
 }
 
 DB_Remote_BK() {
-  for D in `echo $db_name | tr ',' ' '`
+  for D in `echo ${db_name} | tr ',' ' '`
   do
     ./db_bk.sh $D
     DB_GREP="DB_${D}_`date +%Y`"
-    DB_FILE=`ls -lrt $backup_dir | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
-    echo "file:::$backup_dir/$DB_FILE $backup_dir push" >> config_bakcup.txt
-    echo "com:::[ -e "$backup_dir/$DB_FILE" ] && rm -rf $backup_dir/DB_${D}_$(date +%Y%m%d --date="$expired_days days ago")_*.tgz" >> config_bakcup.txt
+    DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
+    echo "file:::${backup_dir}/$DB_FILE ${backup_dir} push" >> config_bakcup.txt
+    echo "com:::[ -e "${backup_dir}/$DB_FILE" ] && rm -rf ${backup_dir}/DB_${D}_$(date +%Y%m%d --date="$expired_days days ago")_*.tgz" >> config_bakcup.txt
   done
 }
 
 DB_COS_BK() {
-  for D in `echo $db_name | tr ',' ' '`
+  for D in `echo ${db_name} | tr ',' ' '`
   do
     ./db_bk.sh $D
     DB_GREP="DB_${D}_`date +%Y`"
-    DB_FILE=`ls -lrt $backup_dir | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
-    ${python_install_dir}/bin/coscmd upload $backup_dir/$DB_FILE /`date +%F`/$DB_FILE
+    DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
+    ${python_install_dir}/bin/coscmd upload ${backup_dir}/$DB_FILE /`date +%F`/$DB_FILE
     [ $? -eq 0 ] && ${python_install_dir}/bin/coscmd delete -r -f `date +%F --date="$expired_days days ago"` > /dev/null 2>&1
   done
 }
 
 DB_UPYUN_BK() {
-  for D in `echo $db_name | tr ',' ' '`
+  for D in `echo ${db_name} | tr ',' ' '`
   do
     ./db_bk.sh $D
     DB_GREP="DB_${D}_`date +%Y`"
-    DB_FILE=`ls -lrt $backup_dir | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
-    /usr/local/bin/upx put $backup_dir/$DB_FILE /`date +%F`/$DB_FILE
+    DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
+    /usr/local/bin/upx put ${backup_dir}/$DB_FILE /`date +%F`/$DB_FILE
     [ $? -eq 0 ] && /usr/local/bin/upx rm -a `date +%F --date="$expired_days days ago"` > /dev/null 2>&1
   done
 }
 
 WEB_Local_BK() {
-  for W in `echo $website_name | tr ',' ' '`
+  for W in `echo ${website_name} | tr ',' ' '`
   do
     ./website_bk.sh $W
   done
 }
 
 WEB_Remote_BK() {
-  for W in `echo $website_name | tr ',' ' '`
+  for W in `echo ${website_name} | tr ',' ' '`
   do
-    if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ]; then
+    if [ `du -sm "${wwwroot_dir}/$WebSite" | awk '{print $1}'` -lt 1024 ]; then
       ./website_bk.sh $W
       Web_GREP="Web_${W}_`date +%Y`"
-      Web_FILE=`ls -lrt $backup_dir | grep ${Web_GREP} | tail -1 | awk '{print $NF}'`
-      echo "file:::$backup_dir/$Web_FILE $backup_dir push" >> config_bakcup.txt
-      echo "com:::[ -e "$backup_dir/$Web_FILE" ] && rm -rf $backup_dir/Web_${W}_$(date +%Y%m%d --date="$expired_days days ago")_*.tgz" >> config_bakcup.txt
+      Web_FILE=`ls -lrt ${backup_dir} | grep ${Web_GREP} | tail -1 | awk '{print $NF}'`
+      echo "file:::${backup_dir}/$Web_FILE ${backup_dir} push" >> config_bakcup.txt
+      echo "com:::[ -e "${backup_dir}/$Web_FILE" ] && rm -rf ${backup_dir}/Web_${W}_$(date +%Y%m%d --date="$expired_days days ago")_*.tgz" >> config_bakcup.txt
     else
-      echo "file:::$wwwroot_dir/$W $backup_dir push" >> config_bakcup.txt
+      echo "file:::${wwwroot_dir}/$W ${backup_dir} push" >> config_bakcup.txt
     fi
   done
 }
 
 WEB_COS_BK() {
-  for W in `echo $website_name | tr ',' ' '`
+  for W in `echo ${website_name} | tr ',' ' '`
   do
-    [ ! -e "$wwwroot_dir/$WebSite" ] && { echo "[$wwwroot_dir/$WebSite] not exist"; break; }
-    PUSH_FILE="$backup_dir/Web_${W}_$(date +%Y%m%d_%H).tgz"
+    [ ! -e "${wwwroot_dir}/$WebSite" ] && { echo "[${wwwroot_dir}/$WebSite] not exist"; break; }
+    PUSH_FILE="${backup_dir}/Web_${W}_$(date +%Y%m%d_%H).tgz"
     if [ ! -e "$PUSH_FILE" ]; then
-      pushd $wwwroot_dir
+      pushd ${wwwroot_dir}
       tar czf $PUSH_FILE ./$W
       popd
     fi
     ${python_install_dir}/bin/coscmd upload $PUSH_FILE /`date +%F`/Web_${W}_$(date +%Y%m%d_%H).tgz
     if [ $? -eq 0 ]; then
       ${python_install_dir}/bin/coscmd delete -r -f `date +%F --date="$expired_days days ago"` > /dev/null 2>&1
-      [ -e "$PUSH_FILE" -a -z "`echo $backup_destination | grep -ow 'local'`" ] && rm -rf $PUSH_FILE
+      [ -e "$PUSH_FILE" -a -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -rf $PUSH_FILE
     fi
   done
 }
 
 WEB_UPYUN_BK() {
-  for W in `echo $website_name | tr ',' ' '`
+  for W in `echo ${website_name} | tr ',' ' '`
   do
-    [ ! -e "$wwwroot_dir/$WebSite" ] && { echo "[$wwwroot_dir/$WebSite] not exist"; break; }
-    [ ! -e "$backup_dir" ] && mkdir -p $backup_dir
-    PUSH_FILE="$backup_dir/Web_${W}_$(date +%Y%m%d_%H).tgz"
+    [ ! -e "${wwwroot_dir}/$WebSite" ] && { echo "[${wwwroot_dir}/$WebSite] not exist"; break; }
+    [ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}
+    PUSH_FILE="${backup_dir}/Web_${W}_$(date +%Y%m%d_%H).tgz"
     if [ ! -e "$PUSH_FILE" ]; then
-      pushd $wwwroot_dir
+      pushd ${wwwroot_dir}
       tar czf $PUSH_FILE ./$W
       popd
     fi
     /usr/local/bin/upx put $PUSH_FILE /`date +%F`/Web_${W}_$(date +%Y%m%d_%H).tgz
     if [ $? -eq 0 ]; then
       /usr/local/bin/upx rm -a `date +%F --date="$expired_days days ago"` > /dev/null 2>&1 
-      [ -e "$PUSH_FILE" -a -z "`echo $backup_destination | grep -ow 'local'`" ] && rm -rf $PUSH_FILE
+      [ -e "$PUSH_FILE" -a -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -rf $PUSH_FILE
     fi
   done
 }
 
-for DEST in `echo $backup_destination | tr ',' ' '`
+for DEST in `echo ${backup_destination} | tr ',' ' '`
 do
   if [ "$DEST" == 'local' ]; then
-    [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK
-    [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK
+    [ -n "`echo ${backup_content} | grep -ow db`" ] && DB_Local_BK
+    [ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_Local_BK
   fi 
   if [ "$DEST" == 'remote' ]; then
-    echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt
-    [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK
-    [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK
+    echo "com:::[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}" > config_bakcup.txt
+    [ -n "`echo ${backup_content} | grep -ow db`" ] && DB_Remote_BK
+    [ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_Remote_BK
     ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log
   fi 
   if [ "$DEST" == 'cos' ]; then
-    [ -n "`echo $backup_content | grep -ow db`" ] && DB_COS_BK
-    [ -n "`echo $backup_content | grep -ow web`" ] && WEB_COS_BK
+    [ -n "`echo ${backup_content} | grep -ow db`" ] && DB_COS_BK
+    [ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_COS_BK
   fi 
   if [ "$DEST" == 'upyun' ]; then
-    [ -n "`echo $backup_content | grep -ow db`" ] && DB_UPYUN_BK
-    [ -n "`echo $backup_content | grep -ow web`" ] && WEB_UPYUN_BK
+    [ -n "`echo ${backup_content} | grep -ow db`" ] && DB_UPYUN_BK
+    [ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_UPYUN_BK
   fi 
 done

+ 23 - 24
backup_setup.sh

@@ -17,9 +17,11 @@ printf "
 #       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
-# get pwd
-sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf
+# Check if user is root
+[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
 
+oneinstack_dir=$(dirname "`readlink -f $0`")
+pushd ${oneinstack_dir} > /dev/null
 . ./options.conf
 . ./versions.txt
 . ./include/color.sh
@@ -28,9 +30,6 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf
 . ./include/download.sh
 . ./include/python.sh
 
-# Check if user is root
-[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
-
 while :; do echo
   echo 'Please select your backup destination:'
   echo -e "\t${CMSG}1${CEND}. Localhost"
@@ -75,15 +74,15 @@ done
 if [[ $desc_bk =~ ^[1,2]$ ]]; then
   while :; do echo
     echo "Please enter the directory for save the backup file: "
-    read -p "(Default directory: $backup_dir): " new_backup_dir
-    [ -z "$new_backup_dir" ] && new_backup_dir="$backup_dir"
-    if [ -z "`echo $new_backup_dir| grep '^/'`" ]; then
+    read -p "(Default directory: ${backup_dir}): " new_backup_dir
+    [ -z "${new_backup_dir}" ] && new_backup_dir="${backup_dir}"
+    if [ -z "`echo ${new_backup_dir}| grep '^/'`" ]; then
       echo "${CWARNING}input error! ${CEND}"
     else
       break
     fi
   done
-  sed -i "s@^backup_dir=.*@backup_dir=$new_backup_dir@" ./options.conf
+  sed -i "s@^backup_dir=.*@backup_dir=${new_backup_dir}@" ./options.conf
 fi
 
 while :; do echo
@@ -95,43 +94,43 @@ done
 sed -i "s@^expired_days=.*@expired_days=$expired_days@" ./options.conf
 
 if [ "$content_bk" != '2' ]; then
-  databases=`$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep Database | awk '{print $2}' | grep -Evw "(performance_schema|information_schema|mysql|sys)"`
+  databases=`${db_install_dir}/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep Database | awk '{print $2}' | grep -Evw "(performance_schema|information_schema|mysql|sys)"`
   while :; do echo
     echo "Please enter one or more name for database, separate multiple database names with commas: "
     read -p "(Default database: `echo $databases | tr ' ' ','`) " db_name
-    db_name=`echo $db_name | tr -d ' '`
-    [ -z "$db_name" ] && db_name="`echo $databases | tr ' ' ','`"
+    db_name=`echo ${db_name} | tr -d ' '`
+    [ -z "${db_name}" ] && db_name="`echo $databases | tr ' ' ','`"
     D_tmp=0
-    for D in `echo $db_name | tr ',' ' '`
+    for D in `echo ${db_name} | tr ',' ' '`
     do
       [ -z "`echo $databases | grep -w $D`" ] && { echo "${CWARNING}$D was not exist! ${CEND}" ; D_tmp=1; }
     done
     [ "$D_tmp" != '1' ] && break
   done
-  sed -i "s@^db_name=.*@db_name=$db_name@" ./options.conf
+  sed -i "s@^db_name=.*@db_name=${db_name}@" ./options.conf
 fi
 
 if [ "$content_bk" != '1' ]; then
-  websites=`ls $wwwroot_dir | grep -vw default`
+  websites=`ls ${wwwroot_dir} | grep -vw default`
   while :; do echo
     echo "Please enter one or more name for website, separate multiple website names with commas: "
     read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name 
-    website_name=`echo $website_name | tr -d ' '`
-    [ -z "$website_name" ] && website_name="`echo $websites | tr ' ' ','`"
+    website_name=`echo ${website_name} | tr -d ' '`
+    [ -z "${website_name}" ] && website_name="`echo $websites | tr ' ' ','`"
     W_tmp=0
-    for W in `echo $website_name | tr ',' ' '`
+    for W in `echo ${website_name} | tr ',' ' '`
     do
-      [ ! -e "$wwwroot_dir/$W" ] && { echo "${CWARNING}$wwwroot_dir/$W not exist! ${CEND}" ; W_tmp=1; }
+      [ ! -e "${wwwroot_dir}/$W" ] && { echo "${CWARNING}${wwwroot_dir}/$W not exist! ${CEND}" ; W_tmp=1; }
     done
     [ "$W_tmp" != '1' ] && break
   done
-  sed -i "s@^website_name=.*@website_name=$website_name@" ./options.conf
+  sed -i "s@^website_name=.*@website_name=${website_name}@" ./options.conf
 fi
 
 echo
 echo "You have to backup the content:"
-[ "$content_bk" != '2' ] && echo "Database: ${CMSG}$db_name${CEND}"
-[ "$content_bk" != '1' ] && echo "Website: ${CMSG}$website_name${CEND}"
+[ "$content_bk" != '2' ] && echo "Database: ${CMSG}${db_name}${CEND}"
+[ "$content_bk" != '1' ] && echo "Website: ${CMSG}${website_name}${CEND}"
 
 if [ `echo $desc_bk | grep -e 2` ]; then
   > tools/iplist.txt
@@ -206,8 +205,8 @@ if [ `echo $desc_bk | grep -e 3` ]; then
     read -p "Please enter the Qcloud COS bucket: " bucket 
     [ -z "$bucket" ] && continue
     echo
-    $python_install_dir/bin/coscmd config -u $appid -a $SecretId -s $SecretKey -r $region -b $bucket >/dev/null 2>&1
-    $python_install_dir/bin/coscmd list >/dev/null 2>&1
+    ${python_install_dir}/bin/coscmd config -u $appid -a $SecretId -s $SecretKey -r $region -b $bucket >/dev/null 2>&1
+    ${python_install_dir}/bin/coscmd list >/dev/null 2>&1
     if [ $? = 0 ]; then
       echo "${CMSG}appid/SecretId/SecretKey/region/bucket OK${CEND}"
       echo

+ 8 - 8
include/GraphicsMagick.sh

@@ -2,14 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_GraphicsMagick() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   tar xzf GraphicsMagick-${graphicsmagick_ver}.tar.gz
   pushd GraphicsMagick-${graphicsmagick_ver}
   ./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static
@@ -20,15 +20,15 @@ Install_GraphicsMagick() {
 }
 
 Install_php-gmagick() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
     if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then
-      tar xzf gmagick-${gmagick_for_php7_version}.tgz 
-      pushd gmagick-${gmagick_for_php7_version} 
+      tar xzf gmagick-${gmagick_for_php7_ver}.tgz 
+      pushd gmagick-${gmagick_for_php7_ver} 
     else
-      tar xzf gmagick-${gmagick_version}.tgz
-      pushd gmagick-${gmagick_version}
+      tar xzf gmagick-${gmagick_ver}.tgz
+      pushd gmagick-${gmagick_ver}
     fi
     export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
     ${php_install_dir}/bin/phpize
@@ -38,7 +38,7 @@ Install_php-gmagick() {
     if [ -f "${phpExtensionDir}/gmagick.so" ]; then
       echo 'extension=gmagick.so' > ${php_install_dir}/etc/php.d/ext-gmagick.ini
       echo "${CSUCCESS}PHP gmagick module installed successfully! ${CEND}"
-      rm -rf gmagick-${gmagick_for_php7_version} gmagick-${gmagick_version}
+      rm -rf gmagick-${gmagick_for_php7_ver} gmagick-${gmagick_ver}
     else
       echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}"
     fi

+ 3 - 3
include/ImageMagick.sh

@@ -2,14 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_ImageMagick() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   tar xzf ImageMagick-${imagemagick_ver}.tar.gz
   pushd ImageMagick-${imagemagick_ver}
   ./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static
@@ -20,7 +20,7 @@ Install_ImageMagick() {
 }
 
 Install_php-imagick() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
     tar xzf imagick-${imagick_ver}.tgz

+ 14 - 14
include/ZendGuardLoader.sh

@@ -2,62 +2,62 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_ZendGuardLoader() {
-  pushd ${oneinstack_dir}/src
-  PHP_detail_version=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
-  PHP_main_version=${PHP_detail_version%.*}
+  pushd ${oneinstack_dir}/src > /dev/null
+  PHP_detail_ver=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
+  PHP_main_ver=${PHP_detail_ver%.*}
   phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
   [ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir}
-  if [ "$OS_BIT" == '64' ]; then
-    if [ "$PHP_main_version" == '5.6' ]; then
+  if [ "${OS_BIT}" == '64' ]; then
+    if [ "$PHP_main_ver" == '5.6' ]; then
       tar xzf zend-loader-php5.6-linux-x86_64.tar.gz
       /bin/cp zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so ${phpExtensionDir}
       rm -rf zend-loader-php5.6-linux-x86_64
     fi
 
-    if [ "$PHP_main_version" == '5.5' ]; then
+    if [ "$PHP_main_ver" == '5.5' ]; then
       tar xzf zend-loader-php5.5-linux-x86_64.tar.gz
       /bin/cp zend-loader-php5.5-linux-x86_64/ZendGuardLoader.so ${phpExtensionDir}
       rm -rf zend-loader-php5.5-linux-x86_64
     fi
 
-    if [ "$PHP_main_version" == '5.4' ]; then
+    if [ "$PHP_main_ver" == '5.4' ]; then
       tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz
       /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so ${phpExtensionDir}
       rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64
     fi
 
-    if [ "$PHP_main_version" == '5.3' ]; then
+    if [ "$PHP_main_ver" == '5.3' ]; then
       tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
       /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so ${phpExtensionDir}
       rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64
     fi
   else
-    if [ "$PHP_main_version" == '5.6' ]; then
+    if [ "$PHP_main_ver" == '5.6' ]; then
       tar xzf zend-loader-php5.6-linux-i386.tar.gz
       /bin/cp zend-loader-php5.6-linux-i386/ZendGuardLoader.so ${phpExtensionDir}
       rm -rf zend-loader-php5.6-linux-i386
     fi
 
-    if [ "$PHP_main_version" == '5.5' ]; then
+    if [ "$PHP_main_ver" == '5.5' ]; then
       tar xzf zend-loader-php5.5-linux-i386.tar.gz
       /bin/cp zend-loader-php5.5-linux-i386/ZendGuardLoader.so ${phpExtensionDir}
       rm -rf zend-loader-php5.5-linux-x386
     fi
 
-    if [ "$PHP_main_version" == '5.4' ]; then
+    if [ "$PHP_main_ver" == '5.4' ]; then
       tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz
       /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so ${phpExtensionDir}
       rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386
     fi
 
-    if [ "$PHP_main_version" == '5.3' ]; then
+    if [ "$PHP_main_ver" == '5.3' ]; then
       tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
       /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so ${phpExtensionDir}
       rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386
@@ -65,7 +65,7 @@ Install_ZendGuardLoader() {
   fi
 
   if [ -f "${phpExtensionDir}/ZendGuardLoader.so" ]; then
-    cat > $php_install_dir/etc/php.d/ext-ZendGuardLoader.ini << EOF
+    cat > ${php_install_dir}/etc/php.d/ext-ZendGuardLoader.ini << EOF
 [Zend Guard Loader]
 zend_extension=${phpExtensionDir}/ZendGuardLoader.so
 zend_loader.enable=1

+ 2 - 3
include/alisql-5.6.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_AliSQL56() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 13 - 13
include/apache-2.2.sh

@@ -2,20 +2,20 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Apache22() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u ${run_user} >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   tar xzf httpd-${apache22_ver}.tar.gz
   pushd httpd-${apache22_ver}
   [ ! -d "${apache_install_dir}" ] && mkdir -p ${apache_install_dir}
-  [ "${Ubuntu_version}" == "12" ] && sed -i '@SSL_PROTOCOL_SSLV2@d' modules/ssl/ssl_engine_io.c
+  [ "${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 --with-included-apr --enable-headers --enable-deflate --enable-so --enable-rewrite --enable-ssl--with-ssl=${openssl_install_dir} --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all
   make -j ${THREAD} && make install
   unset LDFLAGS
@@ -42,10 +42,10 @@ Install_Apache22() {
   
   sed -i "s@^User daemon@User ${run_user}@" ${apache_install_dir}/conf/httpd.conf
   sed -i "s@^Group daemon@Group ${run_user}@" ${apache_install_dir}/conf/httpd.conf
-  if [ "${nginx_ver}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ]; then
+  if [ "${nginx_option}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ]; then
     sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' ${apache_install_dir}/conf/httpd.conf
     TMP_PORT=80
-  elif [[ ${nginx_ver} =~ ^[1-3]$ ]] || [ -e "${web_install_dir}/sbin/nginx" ]; then
+  elif [[ ${nginx_option} =~ ^[1-3]$ ]] || [ -e "${web_install_dir}/sbin/nginx" ]; then
     sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' ${apache_install_dir}/conf/httpd.conf
     sed -i 's@^Listen.*@Listen 127.0.0.1:88@' ${apache_install_dir}/conf/httpd.conf
     TMP_PORT=88
@@ -53,13 +53,13 @@ Install_Apache22() {
   sed -i "s@AddType\(.*\)Z@AddType\1Z\n    AddType application/x-httpd-php .php .phtml\n    AddType application/x-httpd-php-source .phps@" ${apache_install_dir}/conf/httpd.conf
   sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" ${apache_install_dir}/conf/httpd.conf
   sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' ${apache_install_dir}/conf/httpd.conf
-  sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" ${apache_install_dir}/conf/httpd.conf
-  sed -i "s@^<Directory \"${apache_install_dir}/htdocs\">@<Directory \"$wwwroot_dir/default\">@" ${apache_install_dir}/conf/httpd.conf
+  sed -i "s@^DocumentRoot.*@DocumentRoot \"${wwwroot_dir}/default\"@" ${apache_install_dir}/conf/httpd.conf
+  sed -i "s@^<Directory \"${apache_install_dir}/htdocs\">@<Directory \"${wwwroot_dir}/default\">@" ${apache_install_dir}/conf/httpd.conf
   sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" ${apache_install_dir}/conf/httpd.conf
   
   #logrotate apache log
   cat > /etc/logrotate.d/apache << EOF
-$wwwlogs_dir/*apache.log {
+${wwwlogs_dir}/*apache.log {
   daily
   rotate 5
   missingok
@@ -78,11 +78,11 @@ EOF
 NameVirtualHost *:$TMP_PORT
 <VirtualHost *:$TMP_PORT>
   ServerAdmin admin@example.com
-  DocumentRoot "$wwwroot_dir/default"
+  DocumentRoot "${wwwroot_dir}/default"
   ServerName 127.0.0.1
-  ErrorLog "$wwwlogs_dir/error_apache.log"
-  CustomLog "$wwwlogs_dir/access_apache.log" common
-<Directory "$wwwroot_dir/default">
+  ErrorLog "${wwwlogs_dir}/error_apache.log"
+  CustomLog "${wwwlogs_dir}/access_apache.log" common
+<Directory "${wwwroot_dir}/default">
   SetOutputFilter DEFLATE
   Options FollowSymLinks ExecCGI
   AllowOverride All
@@ -116,7 +116,7 @@ ServerSignature Off
 Include conf/vhost/*.conf
 EOF
 
-  if [ "${nginx_ver}" != '4' -o -e "${web_install_dir}/sbin/nginx" ]; then
+  if [ "${nginx_option}" != '4' -o -e "${web_install_dir}/sbin/nginx" ]; then
     ${apache_install_dir}/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c
     cat > ${apache_install_dir}/conf/extra/httpd-remoteip.conf << EOF
 LoadModule remoteip_module modules/mod_remoteip.so

+ 16 - 16
include/apache-2.4.sh

@@ -2,21 +2,21 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Apache24() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   tar xzf pcre-${pcre_ver}.tar.gz
   pushd pcre-${pcre_ver}
   ./configure
   make -j ${THREAD} && make install
   popd
   id -u ${run_user} >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   tar xzf httpd-${apache24_ver}.tar.gz
   tar xzf nghttp2-${nghttp2_ver}.tar.gz
   tar xzf apr-${apr_ver}.tar.gz
@@ -61,12 +61,12 @@ Install_Apache24() {
   [ "$OS" == 'CentOS' ] && { chkconfig --add httpd; chkconfig httpd on; }
   [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d httpd defaults
   
-  sed -i "s@^User daemon@User $run_user@" ${apache_install_dir}/conf/httpd.conf
-  sed -i "s@^Group daemon@Group $run_user@" ${apache_install_dir}/conf/httpd.conf
-  if [ "${nginx_ver}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ]; then
+  sed -i "s@^User daemon@User ${run_user}@" ${apache_install_dir}/conf/httpd.conf
+  sed -i "s@^Group daemon@Group ${run_user}@" ${apache_install_dir}/conf/httpd.conf
+  if [ "${nginx_option}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ]; then
     sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' ${apache_install_dir}/conf/httpd.conf
     TMP_PORT=80
-  elif [[ ${nginx_ver} =~ ^[1-3]$ ]] || [ -e "${web_install_dir}/sbin/nginx" ]; then
+  elif [[ ${nginx_option} =~ ^[1-3]$ ]] || [ -e "${web_install_dir}/sbin/nginx" ]; then
     sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' ${apache_install_dir}/conf/httpd.conf
     sed -i 's@^Listen.*@Listen 127.0.0.1:88@' ${apache_install_dir}/conf/httpd.conf
     TMP_PORT=88
@@ -81,13 +81,13 @@ Install_Apache24() {
   sed -ri 's@^#(.*mod_ssl.so)@\1@' ${apache_install_dir}/conf/httpd.conf
   sed -ri 's@^#(.*mod_http2.so)@\1@' ${apache_install_dir}/conf/httpd.conf
   sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' ${apache_install_dir}/conf/httpd.conf
-  sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" ${apache_install_dir}/conf/httpd.conf
-  sed -i "s@^<Directory \"${apache_install_dir}/htdocs\">@<Directory \"$wwwroot_dir/default\">@" ${apache_install_dir}/conf/httpd.conf
+  sed -i "s@^DocumentRoot.*@DocumentRoot \"${wwwroot_dir}/default\"@" ${apache_install_dir}/conf/httpd.conf
+  sed -i "s@^<Directory \"${apache_install_dir}/htdocs\">@<Directory \"${wwwroot_dir}/default\">@" ${apache_install_dir}/conf/httpd.conf
   sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" ${apache_install_dir}/conf/httpd.conf
   
   #logrotate apache log
   cat > /etc/logrotate.d/apache << EOF
-$wwwlogs_dir/*apache.log {
+${wwwlogs_dir}/*apache.log {
   daily
   rotate 5
   missingok
@@ -105,11 +105,11 @@ EOF
   cat > ${apache_install_dir}/conf/vhost/0.conf << EOF
 <VirtualHost *:$TMP_PORT>
   ServerAdmin admin@example.com
-  DocumentRoot "$wwwroot_dir/default"
+  DocumentRoot "${wwwroot_dir}/default"
   ServerName 127.0.0.1 
-  ErrorLog "$wwwlogs_dir/error_apache.log"
-  CustomLog "$wwwlogs_dir/access_apache.log" common
-<Directory "$wwwroot_dir/default">
+  ErrorLog "${wwwlogs_dir}/error_apache.log"
+  CustomLog "${wwwlogs_dir}/access_apache.log" common
+<Directory "${wwwroot_dir}/default">
   SetOutputFilter DEFLATE
   Options FollowSymLinks ExecCGI
   Require all granted
@@ -144,8 +144,8 @@ ServerTokens ProductOnly
 ServerSignature Off
 Include conf/vhost/*.conf
 EOF
-  [ "${nginx_ver}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ] && echo 'Protocols h2 http/1.1' >> ${apache_install_dir}/conf/httpd.conf
-  if [ "${nginx_ver}" != '4' -o -e "${web_install_dir}/sbin/nginx" ]; then
+  [ "${nginx_option}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ] && echo 'Protocols h2 http/1.1' >> ${apache_install_dir}/conf/httpd.conf
+  if [ "${nginx_option}" != '4' -o -e "${web_install_dir}/sbin/nginx" ]; then
     cat > ${apache_install_dir}/conf/extra/httpd-remoteip.conf << EOF
 LoadModule remoteip_module modules/mod_remoteip.so
 RemoteIPHeader X-Forwarded-For

+ 2 - 2
include/apcu.sh

@@ -2,14 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_APCU() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
   if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then
     tar xzf apcu-${apcu_for_php7_ver}.tgz

+ 2 - 2
include/boost.sh

@@ -1,14 +1,14 @@
 #!/bin/bash
 # Author:  Alpha Eva <kaneawk AT gmail.com>
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 installBoost() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   if [ ! -e "/usr/local/lib/libboost_system.so" ]; then
     boostVersion2=$(echo ${boost_ver} | awk -F. '{print $1}')_$(echo ${boost_ver} | awk -F. '{print $2}')_$(echo ${boost_ver} | awk -F. '{print $3}')
     tar xvf boost_${boostVersion2}.tar.gz

+ 4 - 4
include/check_dir.sh

@@ -2,16 +2,16 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 # check MySQL dir
-[ -d "$mysql_install_dir/support-files" ] && { db_install_dir=$mysql_install_dir; db_data_dir=$mysql_data_dir; }
-[ -d "$mariadb_install_dir/support-files" ] && { db_install_dir=$mariadb_install_dir; db_data_dir=$mariadb_data_dir; }
-[ -d "$percona_install_dir/support-files" ] && { db_install_dir=$percona_install_dir; db_data_dir=$percona_data_dir; }
+[ -d "$mysql_install_dir/support-files" ] && { db_install_dir=$mysql_install_dir; db_data_dir=${mysql_data_dir}; }
+[ -d "${mariadb_install_dir}/support-files" ] && { db_install_dir=${mariadb_install_dir}; db_data_dir=${mariadb_data_dir}; }
+[ -d "${percona_install_dir}/support-files" ] && { db_install_dir=${percona_install_dir}; db_data_dir=${percona_data_dir}; }
 [ -d "$alisql_install_dir/support-files" ] && { db_install_dir=$alisql_install_dir; db_data_dir=$alisql_data_dir; }
 
 # check Nginx dir

+ 30 - 30
include/check_download.sh

@@ -1,7 +1,7 @@
 #!/bin/bash
 # Author:  Alpha Eva <kaneawk AT gmail.com>
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -9,8 +9,7 @@
 
 checkDownload() {
   mirrorLink=http://mirrors.linuxeye.com/oneinstack/src
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   # General system utils
   echo "Download openSSL..."
   src_url=https://www.openssl.org/source/openssl-${openssl_ver}.tar.gz && Download_src
@@ -18,7 +17,7 @@ checkDownload() {
 
   # Web
   if [ "${web_yn}" == 'y' ]; then
-    case "${nginx_ver}" in
+    case "${nginx_option}" in
       1)
         echo "Download nginx..."
         src_url=http://nginx.org/download/nginx-${nginx_ver}.tar.gz && Download_src
@@ -33,20 +32,20 @@ checkDownload() {
         ;;
     esac
 
-    if [[ "${nginx_ver}" =~ ^[1-3]$ || ${apache_ver} == '1' ]]; then
+    if [[ "${nginx_option}" =~ ^[1-3]$ || ${apache_option} == '1' ]]; then
       echo "Download pcre..."
       src_url=${mirrorLink}/pcre-${pcre_ver}.tar.gz && Download_src
     fi
 
     # apache
-    if [ "${apache_ver}" == '1' ]; then
+    if [ "${apache_option}" == '1' ]; then
       echo "Download apache 2.4..."
       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
       src_url=http://mirrors.linuxeye.com/apache/httpd/nghttp2-${nghttp2_ver}.tar.gz && Download_src
       src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache24_ver}.tar.gz && Download_src
     fi
-    if [ "${apache_ver}" == '2' ]; then
+    if [ "${apache_option}" == '2' ]; then
       echo "Download apache 2.2..."
       src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache22_ver}.tar.gz && Download_src
 
@@ -55,7 +54,7 @@ checkDownload() {
     fi
 
     # tomcat
-    case "${tomcat_ver}" in
+    case "${tomcat_option}" in
       1)
         echo "Download tomcat 8..."
         src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat8_ver}/apache-tomcat-${tomcat8_ver}.tar.gz && Download_src
@@ -73,8 +72,8 @@ checkDownload() {
         ;;
     esac
 
-    if [[ "${jdk_version}"  =~ ^[1-3]$ ]]; then
-      case "${jdk_version}" in
+    if [[ "${jdk_option}"  =~ ^[1-3]$ ]]; then
+      case "${jdk_option}" in
         1)
           echo "Download JDK 1.8..."
           JDK_FILE="jdk-$(echo ${jdk18_ver} | awk -F. '{print $2}')u$(echo ${jdk18_ver} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz"
@@ -96,14 +95,14 @@ checkDownload() {
   fi
 
   if [ "${db_yn}" == 'y' ]; then
-    if [[ "${db_ver}" =~ ^[1,4,8]$ ]] && [ "${dbinstallmethod}" == "2" ]; then
+    if [[ "${db_option}" =~ ^[1,4,8]$ ]] && [ "${dbinstallmethod}" == "2" ]; then
       echo "Download boost..."
       [ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR_BOOST=${mirrorLink} || DOWN_ADDR_BOOST=http://downloads.sourceforge.net/project/boost/boost/${boost_ver}
       boostVersion2=$(echo ${boost_ver} | awk -F. '{print $1}')_$(echo ${boost_ver} | awk -F. '{print $2}')_$(echo ${boost_ver} | awk -F. '{print $3}')
       src_url=${DOWN_ADDR_BOOST}/boost_${boostVersion2}.tar.gz && Download_src
     fi
 
-    case "${db_ver}" in
+    case "${db_option}" in
       1)
         # MySQL 5.7
         if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then
@@ -578,7 +577,7 @@ checkDownload() {
     src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/${mcrypt_ver}/mcrypt-${mcrypt_ver}.tar.gz && Download_src
     src_url=${mirrorLink}/libiconv-glibc-2.16.patch && Download_src
 
-    case "${php_ver}" in
+    case "${php_option}" in
       1)
         # php 5.3
         src_url=${mirrorLink}/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch && Download_src
@@ -610,16 +609,16 @@ checkDownload() {
   fi
 
   # PHP OPCache
-  case "${php_cache}" in
+  case "${phpcache_option}" in
     1)
-      if [[ "$php_ver" =~ ^[1-2]$ ]]; then
+      if [[ "${php_option}" =~ ^[1-2]$ ]]; then
         # php 5.3 5.4
         echo "Download Zend OPCache..."
         src_url=https://pecl.php.net/get/zendopcache-${zendopcache_ver}.tgz && Download_src
       fi
       ;;
     2)
-      if [[ "$php_ver" =~ ^[1-4]$ ]]; then
+      if [[ "${php_option}" =~ ^[1-4]$ ]]; then
         # php 5.3 5.4 5.5 5.6
         echo "Download xcache..."
         src_url=http://xcache.lighttpd.net/pub/Releases/${xcache_ver}/xcache-${xcache_ver}.tar.gz && Download_src
@@ -628,7 +627,7 @@ checkDownload() {
     3)
       # php 5.3 5.4 5.5 5.6 7.0 7.1 7.2
       echo "Download apcu..."
-      if [[ "$php_ver" =~ ^[1-4]$ ]]; then
+      if [[ "${php_option}" =~ ^[1-4]$ ]]; then
         src_url=https://pecl.php.net/get/apcu-${apcu_ver}.tgz && Download_src
       else
         src_url=https://pecl.php.net/get/apcu-${apcu_for_php7_ver}.tgz && Download_src
@@ -636,10 +635,10 @@ checkDownload() {
       ;;
     4)
       # php 5.3 5.4
-      if [ "${php_ver}" == '1' ]; then
+      if [ "${php_option}" == '1' ]; then
         echo "Download eaccelerator 0.9..."
         src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-${eaccelerator_ver}.tar.bz2 && Download_src
-      elif [ "${php_ver}" == '2' ]; then
+      elif [ "${php_option}" == '2' ]; then
         echo "Download eaccelerator 1.0 dev..."
         src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src
       fi
@@ -648,7 +647,7 @@ checkDownload() {
 
   # Zend Guard Loader
   if [ "${zendguardloader_yn}" == 'y' -a "${armplatform}" != 'y' ]; then
-    case "${php_ver}" in
+    case "${php_option}" in
       4)
         if [ "${OS_BIT}" == "64" ]; then
           # 64 bit
@@ -696,8 +695,8 @@ checkDownload() {
     esac
   fi
 
-  if [ "${db_ver}" == '13' ]; then
-    if [[ "$php_ver" =~ ^[1-2]$ ]]; then
+  if [ "${db_option}" == '13' ]; then
+    if [[ "${php_option}" =~ ^[1-2]$ ]]; then
       echo "Download pecl mongo for php..."
       src_url=https://pecl.php.net/get/mongo-${mongo_pecl_ver}.tgz && Download_src
     else
@@ -720,7 +719,7 @@ checkDownload() {
   fi
 
   if [ "${magick_yn}" == 'y' ]; then
-    if [ "${magick}" == '1' ]; then
+    if [ "${magick_option}" == '1' ]; then
       echo "Download ImageMagick..."
       src_url=${mirrorLink}/ImageMagick-${imagemagick_ver}.tar.gz && Download_src
       echo "Download imagick..."
@@ -728,12 +727,12 @@ checkDownload() {
     else
       echo "Download graphicsmagick..."
       src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/${graphicsmagick_ver}/GraphicsMagick-${graphicsmagick_ver}.tar.gz && Download_src
-      if [[ "$php_ver" =~ ^[5-7]$ ]]; then
+      if [[ "${php_option}" =~ ^[5-7]$ ]]; then
         echo "Download gmagick for php 7.x..."
-        src_url=https://pecl.php.net/get/gmagick-${gmagick_for_php7_version}.tgz && Download_src
+        src_url=https://pecl.php.net/get/gmagick-${gmagick_for_php7_ver}.tgz && Download_src
       else
         echo "Download gmagick for php..."
-        src_url=https://pecl.php.net/get/gmagick-${gmagick_version}.tgz && Download_src
+        src_url=https://pecl.php.net/get/gmagick-${gmagick_ver}.tgz && Download_src
       fi
     fi
   fi
@@ -761,8 +760,9 @@ checkDownload() {
 
   if [ "${memcached_yn}" == 'y' ]; then
     echo "Download memcached..."
-    src_url=http://www.memcached.org/files/memcached-${memcached_ver}.tar.gz && Download_src
-    if [[ "$php_ver" =~ ^[5-7]$ ]]; then
+    [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=${mirrorLink} || DOWN_ADDR=http://www.memcached.org/files
+    src_url=${DOWN_ADDR}/memcached-${memcached_ver}.tar.gz && Download_src
+    if [[ "${php_option}" =~ ^[5-7]$ ]]; then
       echo "Download pecl memcache for php 7.x..."
       # src_url=https://codeload.github.com/websupport-sk/pecl-memcache/zip/php7 && Download_src
       src_url=${mirrorLink}/pecl-memcache-php7.tgz && Download_src
@@ -779,7 +779,7 @@ checkDownload() {
     src_url=https://launchpad.net/libmemcached/1.0/${libmemcached_ver}/+download/libmemcached-${libmemcached_ver}.tar.gz && Download_src
   fi
 
-  if [[ $nginx_ver =~ ^[1-3]$ ]] || [ "$db_yn" == 'y' -a "$db_ver" != '10' ]; then
+  if [[ ${nginx_option} =~ ^[1-3]$ ]] || [ "$db_yn" == 'y' -a "${db_option}" != '10' ]; then
     echo "Download jemalloc..."
     src_url=${mirrorLink}/jemalloc-${jemalloc_ver}.tar.bz2 && Download_src
   fi
@@ -795,7 +795,7 @@ checkDownload() {
       src_url=http://hisham.hm/htop/releases/${htop_ver}/htop-${htop_ver}.tar.gz && Download_src
     fi
 
-    if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]]; then
+    if [[ "${Ubuntu_ver}" =~ ^14$|^15$ ]]; then
       echo "Download bison for Ubuntu..."
       src_url=http://ftp.gnu.org/gnu/bison/bison-${bison_ver}.tar.gz && Download_src
     fi

+ 13 - 13
include/check_os.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -10,26 +10,26 @@
 
 if [ -n "$(grep 'Aliyun Linux release' /etc/issue)" -o -e /etc/redhat-release ]; then
   OS=CentOS
-  [ -n "$(grep ' 7\.' /etc/redhat-release 2> /dev/null)" ] && CentOS_RHEL_version=7
-  [ -n "$(grep ' 6\.' /etc/redhat-release 2> /dev/null)" -o -n "$(grep 'Aliyun Linux release6 15' /etc/issue)" ] && CentOS_RHEL_version=6
-  [ -n "$(grep ' 5\.' /etc/redhat-release 2> /dev/null)" -o -n "$(grep 'Aliyun Linux release5' /etc/issue)" ] && CentOS_RHEL_version=5
+  [ -n "$(grep ' 7\.' /etc/redhat-release 2> /dev/null)" ] && CentOS_RHEL_ver=7
+  [ -n "$(grep ' 6\.' /etc/redhat-release 2> /dev/null)" -o -n "$(grep 'Aliyun Linux release6 15' /etc/issue)" ] && CentOS_RHEL_ver=6
+  [ -n "$(grep ' 5\.' /etc/redhat-release 2> /dev/null)" -o -n "$(grep 'Aliyun Linux release5' /etc/issue)" ] && CentOS_RHEL_ver=5
 elif [ -n "$(grep 'Amazon Linux AMI release' /etc/issue)" -o -e /etc/system-release ]; then
   OS=CentOS
-  CentOS_RHEL_version=6
+  CentOS_RHEL_ver=6
 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; }
-  Debian_version=$(lsb_release -sr | awk -F. '{print $1}')
+  Debian_ver=$(lsb_release -sr | awk -F. '{print $1}')
 elif [ -n "$(grep 'Deepin' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Deepin" ]; then
   OS=Debian
   [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; }
-  Debian_version=$(lsb_release -sr | awk -F. '{print $1}')
+  Debian_ver=$(lsb_release -sr | awk -F. '{print $1}')
 # kali rolling
 elif [ -n "$(grep 'Kali GNU/Linux Rolling' /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_version=8
+    Debian_ver=8
   else
     echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}"
     kill -9 $$
@@ -37,12 +37,12 @@ elif [ -n "$(grep 'Kali GNU/Linux Rolling' /etc/issue)" -o "$(lsb_release -is 2>
 elif [ -n "$(grep 'Ubuntu' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Ubuntu" -o -n "$(grep 'Linux Mint' /etc/issue)" ]; then
   OS=Ubuntu
   [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; }
-  Ubuntu_version=$(lsb_release -sr | awk -F. '{print $1}')
-  [ -n "$(grep 'Linux Mint 18' /etc/issue)" ] && Ubuntu_version=16
+  Ubuntu_ver=$(lsb_release -sr | awk -F. '{print $1}')
+  [ -n "$(grep 'Linux Mint 18' /etc/issue)" ] && Ubuntu_ver=16
 elif [ -n "$(grep 'elementary' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'elementary' ]; then
   OS=Ubuntu
   [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; }
-  Ubuntu_version=16
+  Ubuntu_ver=16
 else
   echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}"
   kill -9 $$
@@ -80,13 +80,13 @@ THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l)
 
 # Percona
 if [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then
-  if [ "${Debian_version}" == '6' ]; then
+  if [ "${Debian_ver}" == '6' ]; then
     sslLibVer=ssl098
   else
     sslLibVer=ssl100
   fi
 elif [ "${OS}" == "CentOS" ]; then
-  if [ "${CentOS_RHEL_version}" == '5' ]; then
+  if [ "${CentOS_RHEL_ver}" == '5' ]; then
     sslLibVer=ssl098e
   else
     sslLibVer=ssl101

+ 12 - 13
include/check_sw.sh

@@ -1,7 +1,7 @@
 #!/bin/bash
 # Author:  Alpha Eva <kaneawk AT gmail.com>
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -24,7 +24,7 @@ installDepsDebian() {
   apt-get -y autoremove
 
   # Install needed packages
-  case "${Debian_version}" in
+  case "${Debian_ver}" in
     [6,7])
       pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect libexpat1-dev rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget sysv-rc"
       ;;
@@ -35,7 +35,7 @@ installDepsDebian() {
       pkgList="gcc g++ make cmake autoconf libjpeg62-turbo-dev libjpeg-dev libpng-dev libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl1 patch vim zip unzip tmux htop bc dc expect libexpat1-dev rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget sysv-rc"
       ;;
     *)
-      echo "${CFAILURE}Your system Debian ${Debian_version} are not supported!${CEND}"
+      echo "${CFAILURE}Your system Debian ${Debian_ver} are not supported!${CEND}"
       kill -9 $$
       ;;
   esac
@@ -52,16 +52,16 @@ installDepsCentOS() {
   yum makecache
   # Uninstall the conflicting packages
   echo "${CMSG}Removing the conflicting packages...${CEND}"
-  if [ "${CentOS_RHEL_version}" == '7' ]; then
+  if [ "${CentOS_RHEL_ver}" == '7' ]; then
     yum -y groupremove "Basic Web Server" "MySQL Database server" "MySQL Database client" "File and Print Server"
     systemctl mask firewalld.service
-    if [ "$iptables_yn" == 'y' ]; then
+    if [ "${iptables_yn}" == 'y' ]; then
       yum -y install iptables-services
       systemctl enable iptables.service
     fi
-  elif [ "${CentOS_RHEL_version}" == '6' ]; then
+  elif [ "${CentOS_RHEL_ver}" == '6' ]; then
     yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client"
-  elif [ "${CentOS_RHEL_version}" == '5' ]; then
+  elif [ "${CentOS_RHEL_ver}" == '5' ]; then
     yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution"
   fi
 
@@ -105,13 +105,13 @@ installDepsUbuntu() {
     apt-get -y install ${Package} --force-yes
   done
 
-  if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]]; then
+  if [[ "${Ubuntu_ver}" =~ ^14$|^15$ ]]; then
     apt-get -y install libcloog-ppl1
     apt-get -y remove bison
     ln -sf /usr/include/freetype2 /usr/include/freetype2/freetype
-  elif [ "${Ubuntu_version}" == "13" ]; then
+  elif [ "${Ubuntu_ver}" == "13" ]; then
     apt-get -y install bison libcloog-ppl1
-  elif [ "${Ubuntu_version}" == "12" ]; then
+  elif [ "${Ubuntu_ver}" == "12" ]; then
     apt-get -y install bison libcloog-ppl0
   else
     apt-get -y install bison libcloog-ppl1
@@ -119,10 +119,9 @@ installDepsUbuntu() {
 }
 
 installDepsBySrc() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   if [ "${OS}" == "Ubuntu" ]; then
-    if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]]; then
+    if [[ "${Ubuntu_ver}" =~ ^14$|^15$ ]]; then
       # Install bison on ubt 14.x 15.x
       tar xzf bison-${bison_ver}.tar.gz
       pushd bison-${bison_ver}

+ 1 - 1
include/color.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com

+ 3 - 4
include/demo.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 DEMO() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   [ "${IPADDR_COUNTRY}"x == "CN"x ] && /bin/cp ${oneinstack_dir}/config/index_cn.html ${wwwroot_dir}/default/index.html || /bin/cp ${oneinstack_dir}/config/index.html ${wwwroot_dir}/default
 
   if [ -e "${php_install_dir}/bin/php" ]; then
@@ -23,7 +22,7 @@ DEMO() {
     fi
 
     echo "<?php phpinfo() ?>" > ${wwwroot_dir}/default/phpinfo.php
-    case "${php_cache}" in
+    case "${phpcache_option}" in
       1)
         src_url=http://mirrors.linuxeye.com/oneinstack/src/ocp.php && Download_src
         /bin/cp ocp.php ${wwwroot_dir}/default

+ 2 - 2
include/download.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -11,7 +11,7 @@
 Download_src() {
   [ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || { wget -4 --tries=6 -c --no-check-certificate $src_url; sleep 1; }
   if [ ! -e "${src_url##*/}" ]; then
-    echo "${CFAILURE}${src_url##*/} download failed, Please contact the author! ${CEND}"
+    echo "${CFAILURE}Auto download failed! You can manually download ${src_url##*/} into the oneinstack/src directory.${CEND}"
     kill -9 $$
   fi
 }

+ 7 - 5
include/eaccelerator.sh

@@ -2,21 +2,23 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_eAccelerator() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
+  PHP_detail_ver=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
+  PHP_main_ver=${PHP_detail_ver%.*}
   phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
-  case "${php_ver}" in
-    1)
+  case "${PHP_main_ver}" in
+    5.3)
       tar jxf eaccelerator-${eaccelerator_ver}.tar.bz2
       pushd eaccelerator-${eaccelerator_ver}
       ;;
-    2)
+    5.4)
       /bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz
       tar xzf eaccelerator-eaccelerator-42067ac.tar.gz
       pushd eaccelerator-eaccelerator-42067ac

+ 1 - 1
include/get_char.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com

+ 3 - 3
include/hhvm_CentOS.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -13,7 +13,7 @@ Install_hhvm_CentOS() {
   id -u ${run_user} >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
 
-  if [ "${CentOS_RHEL_version}" == '7' ]; then
+  if [ "${CentOS_RHEL_ver}" == '7' ]; then
     [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF
 [epel]
 name=Extra Packages for Enterprise Linux 7 - \$basearch
@@ -34,7 +34,7 @@ EOF
     [ ! -e "/usr/bin/hhvm" -a "/usr/local/bin/hhvm" ] && ln -s /usr/local/bin/hhvm /usr/bin/hhvm
   fi
 
-  if [ "${CentOS_RHEL_version}" == '6' ]; then
+  if [ "${CentOS_RHEL_ver}" == '6' ]; then
     [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF
 [epel]
 name=Extra Packages for Enterprise Linux 6 - \$basearch

+ 6 - 6
include/init_CentOS.sh

@@ -2,14 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 # closed Unnecessary services and remove obsolete rpm package
-[ "${CentOS_RHEL_version}" == '7' ] && [ "$(systemctl is-active NetworkManager.service)" == 'active' ] && NM_flag=1
+[ "${CentOS_RHEL_ver}" == '7' ] && [ "$(systemctl is-active NetworkManager.service)" == 'active' ] && NM_flag=1
 for Service in $(chkconfig --list | grep 3:on | awk '{print $1}' | grep -vE 'nginx|httpd|tomcat|mysqld|php-fpm|pureftpd|redis-server|memcached|supervisord|aegis|NetworkManager|iptables');do chkconfig --level 3 ${Service} off;done
 [ "${NM_flag}" == '1' ] && systemctl enable NetworkManager.service
 for Service in sshd network crond messagebus irqbalance syslog rsyslog;do chkconfig --level 3 ${Service} on;done
@@ -103,15 +103,15 @@ net.netfilter.nf_conntrack_tcp_timeout_established = 3600
 EOF
 sysctl -p
 
-if [ "${CentOS_RHEL_version}" == '5' ]; then
+if [ "${CentOS_RHEL_ver}" == '5' ]; then
   sed -i 's@^[3-6]:2345:respawn@#&@g' /etc/inittab
   sed -i 's@^ca::ctrlaltdel@#&@' /etc/inittab
   sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n
-elif [ "${CentOS_RHEL_version}" == '6' ]; then
+elif [ "${CentOS_RHEL_ver}" == '6' ]; then
   sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init
   sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf
   sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n
-elif [ "${CentOS_RHEL_version}" == '7' ]; then
+elif [ "${CentOS_RHEL_ver}" == '7' ]; then
   sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf
 fi
 
@@ -120,7 +120,7 @@ ntpdate pool.ntp.org
 [ ! -e "/var/spool/cron/root" -o -z "$(grep 'ntpdate' /var/spool/cron/root)" ] && { echo "*/20 * * * * $(which ntpdate) pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; }
 
 # iptables
-if [ "$iptables_yn" == 'y' ]; then
+if [ "${iptables_yn}" == 'y' ]; then
   if [ -e "/etc/sysconfig/iptables" ] && [ -n "$(grep '^:INPUT DROP' /etc/sysconfig/iptables)" -a -n "$(grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/sysconfig/iptables)" -a -n "$(grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/sysconfig/iptables)" ]; then
     IPTABLES_STATUS=yes
   else

+ 2 - 2
include/init_Debian.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -89,7 +89,7 @@ ntpdate pool.ntp.org
 [ ! -e "/var/spool/cron/crontabs/root" -o -z "$(grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null)" ] && { echo "*/20 * * * * $(which ntpdate) pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; }
 
 # iptables
-if [ "$iptables_yn" == 'y' ]; then
+if [ "${iptables_yn}" == 'y' ]; then
   if [ -e "/etc/iptables.up.rules" ] && [ -n "$(grep '^:INPUT DROP' /etc/iptables.up.rules)" -a -n "$(grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules)" -a -n "$(grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules)" ]; then
     IPTABLES_STATUS=yes
   else

+ 2 - 2
include/init_Ubuntu.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -97,7 +97,7 @@ ntpdate pool.ntp.org
 [ ! -e "/var/spool/cron/crontabs/root" -o -z "$(grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null)" ] && { echo "*/20 * * * * $(which ntpdate) pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; }
 
 # iptables
-if [ "$iptables_yn" == 'y' ]; then
+if [ "${iptables_yn}" == 'y' ]; then
   if [ -e "/etc/iptables.up.rules" ] && [ -n "$(grep '^:INPUT DROP' /etc/iptables.up.rules)" -a -n "$(grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules)" -a -n "$(grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules)" ]; then
     IPTABLES_STATUS=yes
   else

+ 6 - 6
include/ioncube.sh

@@ -2,16 +2,16 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_ionCube() {
-  pushd ${oneinstack_dir}/src
-  PHP_detail_version=`${php_install_dir}/bin/php -r 'echo PHP_VERSION;'`
-  PHP_main_version=${PHP_detail_version%.*}
+  pushd ${oneinstack_dir}/src > /dev/null
+  PHP_detail_ver=`${php_install_dir}/bin/php -r 'echo PHP_VERSION;'`
+  PHP_main_ver=${PHP_detail_ver%.*}
   phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
   if [ "${OS_BIT}" == '64' ]; then
       tar xzf ioncube_loaders_lin_x86-64.tar.gz
@@ -24,7 +24,7 @@ Install_ionCube() {
   fi
 
   [ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir}
-  case "${PHP_main_version}" in
+  case "${PHP_main_ver}" in
     7.2)
       /bin/cp ioncube/ioncube_loader_lin_7.2.so ${phpExtensionDir}
       zend_extension="${phpExtensionDir}/ioncube_loader_lin_7.2.so"
@@ -54,7 +54,7 @@ Install_ionCube() {
       zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.3.so"
       ;;
     *)
-      echo "Error! Your PHP ${PHP_detail_version} does not support ionCube!"
+      echo "Error! Your PHP ${PHP_detail_ver} does not support ionCube!"
       exit 1
       ;;
   esac

+ 2 - 3
include/jdk-1.6.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install-JDK16() {
-  pushd ${oneinstack_dir}/src
-  
+  pushd ${oneinstack_dir}/src > /dev/null
   JDK_FILE="jdk-`echo $jdk16_ver | awk -F. '{print $2}'`u`echo $jdk16_ver | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.bin"
   JAVA_dir=/usr/java
   JDK_NAME="jdk$jdk16_ver"

+ 2 - 3
include/jdk-1.7.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install-JDK17() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   JDK_FILE="jdk-`echo $jdk17_ver | awk -F. '{print $2}'`u`echo $jdk17_ver | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.tar.gz"
   JAVA_dir=/usr/java
   JDK_NAME="jdk$jdk17_ver"

+ 2 - 3
include/jdk-1.8.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install-JDK18() {
-  pushd ${oneinstack_dir}/src
-  
+  pushd ${oneinstack_dir}/src > /dev/null
   JDK_FILE="jdk-`echo $jdk18_ver | awk -F. '{print $2}'`u`echo $jdk18_ver | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.tar.gz"
   JAVA_dir=/usr/java
   JDK_NAME="jdk$jdk18_ver"

+ 3 - 3
include/jemalloc.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -10,7 +10,7 @@
 
 Install_Jemalloc() {
   if [ ! -e "/usr/local/lib/libjemalloc.so" ]; then
-    pushd ${oneinstack_dir}/src
+    pushd ${oneinstack_dir}/src > /dev/null
     tar xjf jemalloc-$jemalloc_ver.tar.bz2
     pushd jemalloc-$jemalloc_ver
     LDFLAGS="${LDFLAGS} -lrt" ./configure
@@ -18,7 +18,7 @@ Install_Jemalloc() {
     unset LDFLAGS
     popd
     if [ -f "/usr/local/lib/libjemalloc.so" ]; then
-      if [ "$OS_BIT" == '64' -a "$OS" == 'CentOS' ]; then
+      if [ "${OS_BIT}" == '64' -a "$OS" == 'CentOS' ]; then
         ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1
       else
         ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.1

+ 2 - 3
include/mariadb-10.0.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MariaDB100() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 2 - 3
include/mariadb-10.1.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MariaDB101() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 2 - 3
include/mariadb-10.2.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MariaDB102() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 2 - 3
include/mariadb-5.5.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MariaDB55() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 6 - 6
include/memcached.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_memcached() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   # memcached server
   id -u memcached >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin memcached
@@ -18,7 +17,8 @@ Install_memcached() {
   tar xzf memcached-${memcached_ver}.tar.gz
   pushd memcached-${memcached_ver}
   [ ! -d "${memcached_install_dir}" ] && mkdir -p ${memcached_install_dir}
-  ./configure --prefix=${memcached_install_dir}
+  [ "${OS}" == "CentOS" ] && libevent_arg='--with-libevent=/usr/local'
+  ./configure --prefix=${memcached_install_dir} ${libevent_arg}
   make -j ${THREAD} && make install
   popd
   if [ -d "${memcached_install_dir}/include/memcached" ]; then
@@ -42,7 +42,7 @@ Install_memcached() {
 }
 
 Install_php-memcache() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
     # php memcache extension
@@ -71,7 +71,7 @@ Install_php-memcache() {
 }
 
 Install_php-memcached() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
     # php memcached extension

+ 1 - 1
include/memory.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com

+ 2 - 2
include/mongodb.sh

@@ -2,14 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MongoDB() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mongod >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -s /sbin/nologin mongod
   mkdir -p ${mongo_data_dir};chown mongod.mongod -R ${mongo_data_dir}

+ 2 - 3
include/mysql-5.5.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MySQL55() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 2 - 3
include/mysql-5.6.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MySQL56() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 2 - 3
include/mysql-5.7.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MySQL57() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 11 - 12
include/nginx.sh

@@ -2,17 +2,16 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Nginx() {
-  pushd ${oneinstack_dir}/src
-  
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
+  pushd ${oneinstack_dir}/src > /dev/null
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   
   tar xzf pcre-$pcre_ver.tar.gz
   tar xzf nginx-$nginx_ver.tar.gz
@@ -27,7 +26,7 @@ Install_Nginx() {
   sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc
   
   [ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir
-  ./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-$openssl_ver --with-pcre=../pcre-$pcre_ver --with-pcre-jit --with-ld-opt='-ljemalloc' $nginx_modules_options 
+  ./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-$openssl_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 
@@ -49,9 +48,9 @@ Install_Nginx() {
   sed -i "s@/usr/local/nginx@$nginx_install_dir@g" /etc/init.d/nginx
   
   mv $nginx_install_dir/conf/nginx.conf{,_bk}
-  if [[ $apache_ver =~ ^[1-2]$ ]]; then
+  if [[ ${apache_option} =~ ^[1-2]$ ]]; then
     /bin/cp ../config/nginx_apache.conf $nginx_install_dir/conf/nginx.conf
-  elif [[ $tomcat_ver =~ ^[1-2]$ ]] && [ ! -e "$php_install_dir/bin/php" ]; then
+  elif [[ ${tomcat_option} =~ ^[1-2]$ ]] && [ ! -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
@@ -74,13 +73,13 @@ proxy_set_header X-Real-IP \$remote_addr;
 proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
 proxy_set_header X-Forwarded-Proto \$scheme;
 EOF
-  sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $nginx_install_dir/conf/nginx.conf
-  sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf
-  sed -i "s@^user www www@user $run_user $run_user@" $nginx_install_dir/conf/nginx.conf
+  sed -i "s@/data/wwwroot/default@${wwwroot_dir}/default@" $nginx_install_dir/conf/nginx.conf
+  sed -i "s@/data/wwwlogs@${wwwlogs_dir}@g" $nginx_install_dir/conf/nginx.conf
+  sed -i "s@^user www www@user ${run_user} ${run_user}@" $nginx_install_dir/conf/nginx.conf
   
   # logrotate nginx log
   cat > /etc/logrotate.d/nginx << EOF
-$wwwlogs_dir/*nginx.log {
+${wwwlogs_dir}/*nginx.log {
   daily
   rotate 5
   missingok

+ 11 - 12
include/openresty.sh

@@ -2,17 +2,16 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_OpenResty() {
-  pushd ${oneinstack_dir}/src
-  
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
+  pushd ${oneinstack_dir}/src > /dev/null
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   
   tar xzf pcre-$pcre_ver.tar.gz
   tar xzf openresty-$openresty_ver.tar.gz
@@ -24,7 +23,7 @@ Install_OpenResty() {
   sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_ver_tmp/auto/cc/gcc # close debug
   
   [ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir
-  ./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 
+  ./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
@@ -46,9 +45,9 @@ Install_OpenResty() {
   sed -i "s@/usr/local/nginx@$openresty_install_dir/nginx@g" /etc/init.d/nginx
   
   mv $openresty_install_dir/nginx/conf/nginx.conf{,_bk}
-  if [[ $apache_ver =~ ^[1-2]$ ]]; then
+  if [[ ${apache_option} =~ ^[1-2]$ ]]; then
     /bin/cp ../config/nginx_apache.conf $openresty_install_dir/nginx/conf/nginx.conf
-  elif [[ $tomcat_ver =~ ^[1-2]$ ]] && [ ! -e "$php_install_dir/bin/php" ]; then
+  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
   else
     /bin/cp ../config/nginx.conf $openresty_install_dir/nginx/conf/nginx.conf
@@ -71,13 +70,13 @@ proxy_set_header X-Real-IP \$remote_addr;
 proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
 proxy_set_header X-Forwarded-Proto \$scheme;
 EOF
-  sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $openresty_install_dir/nginx/conf/nginx.conf
-  sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $openresty_install_dir/nginx/conf/nginx.conf
-  sed -i "s@^user www www@user $run_user $run_user@" $openresty_install_dir/nginx/conf/nginx.conf
+  sed -i "s@/data/wwwroot/default@${wwwroot_dir}/default@" $openresty_install_dir/nginx/conf/nginx.conf
+  sed -i "s@/data/wwwlogs@${wwwlogs_dir}@g" $openresty_install_dir/nginx/conf/nginx.conf
+  sed -i "s@^user www www@user ${run_user} ${run_user}@" $openresty_install_dir/nginx/conf/nginx.conf
   
   # logrotate nginx log
   cat > /etc/logrotate.d/nginx << EOF
-$wwwlogs_dir/*nginx.log {
+${wwwlogs_dir}/*nginx.log {
   daily
   rotate 5
   missingok

+ 2 - 2
include/openssl.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -11,7 +11,7 @@
 Install_openSSL102() {
   if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then
     # install openssl-1.0.2
-    pushd ${oneinstack_dir}/src
+    pushd ${oneinstack_dir}/src > /dev/null
     tar xzf openssl-${openssl_ver}.tar.gz
     pushd openssl-${openssl_ver}
     make clean

+ 2 - 2
include/pecl_mongodb.sh

@@ -2,14 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_pecl-mongodb() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
     if [[ "$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1$2}')" =~ ^5[3-4]$ ]]; then

+ 7 - 7
include/pecl_pgsql.sh

@@ -2,23 +2,23 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_pecl-pgsql() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
-  PHP_detail_version=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
-  tar xzf php-${PHP_detail_version}.tar.gz
-  pushd php-${PHP_detail_version}/ext/pgsql
+  PHP_detail_ver=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
+  tar xzf php-${PHP_detail_ver}.tar.gz
+  pushd php-${PHP_detail_ver}/ext/pgsql
   ${php_install_dir}/bin/phpize
   ./configure --with-pgsql=${pgsql_install_dir} --with-php-config=${php_install_dir}/bin/php-config
   make -j ${THREAD} && make install
   popd
-  pushd php-${PHP_detail_version}/ext/pdo_pgsql
+  pushd php-${PHP_detail_ver}/ext/pdo_pgsql
   ${php_install_dir}/bin/phpize
   ./configure --with-pdo-pgsql=${pgsql_install_dir} --with-php-config=${php_install_dir}/bin/php-config
   make -j ${THREAD} && make install
@@ -28,7 +28,7 @@ Install_pecl-pgsql() {
     echo 'extension=pdo_pgsql.so' >> ${php_install_dir}/etc/php.d/ext-pgsql.ini
     echo "${CSUCCESS}PHP pgsql module installed successfully! ${CEND}"
     popd
-    rm -rf php-${PHP_detail_version} 
+    rm -rf php-${PHP_detail_ver} 
   else
     echo "${CFAILURE}PHP pgsql module install failed, Please contact the author! ${CEND}"
   fi

+ 2 - 3
include/percona-5.5.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Percona55() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 2 - 3
include/percona-5.6.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Percona56() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 2 - 3
include/percona-5.7.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Percona57() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u mysql >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
 

+ 79 - 80
include/php-5.3.sh

@@ -2,32 +2,31 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP53() {
-  pushd ${oneinstack_dir}/src
-  
-  tar xzf libiconv-$libiconv_ver.tar.gz
-  patch -d libiconv-$libiconv_ver -p0 < libiconv-glibc-2.16.patch
-  pushd libiconv-$libiconv_ver
+  pushd ${oneinstack_dir}/src > /dev/null
+  tar xzf libiconv-${libiconv_ver}.tar.gz
+  patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
+  pushd libiconv-${libiconv_ver}
   ./configure --prefix=/usr/local
   make -j ${THREAD} && make install
   popd
-  rm -rf libiconv-$libiconv_ver
+  rm -rf libiconv-${libiconv_ver}
   
-  tar xzf curl-$curl_ver.tar.gz
-  pushd curl-$curl_ver
+  tar xzf curl-${curl_ver}.tar.gz
+  pushd curl-${curl_ver}
   ./configure --prefix=/usr/local --with-ssl=${openssl_install_dir}
   make -j ${THREAD} && make install
   popd
-  rm -rf curl-$curl_ver
+  rm -rf curl-${curl_ver}
 
-  tar xzf libmcrypt-$libmcrypt_ver.tar.gz
-  pushd libmcrypt-$libmcrypt_ver
+  tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
+  pushd libmcrypt-${libmcrypt_ver}
   ./configure
   make -j ${THREAD} && make install
   ldconfig
@@ -35,18 +34,18 @@ Install_PHP53() {
   ./configure --enable-ltdl-install
   make -j ${THREAD} && make install
   popd;popd 
-  rm -rf libmcrypt-$libmcrypt_ver
+  rm -rf libmcrypt-${libmcrypt_ver}
   
-  tar xzf mhash-$mhash_ver.tar.gz
-  pushd mhash-$mhash_ver
+  tar xzf mhash-${mhash_ver}.tar.gz
+  pushd mhash-${mhash_ver}
   ./configure
   make -j ${THREAD} && make install
   popd 
-  rm -rf mhash-$mhash_ver
+  rm -rf mhash-${mhash_ver}
   
   echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
   ldconfig
-  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
+  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "${OS_BIT}" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
   
   [ ! -e '/usr/include/freetype2/freetype' ] &&  ln -s /usr/include/freetype2 /usr/include/freetype2/freetype
   
@@ -58,20 +57,20 @@ Install_PHP53() {
   popd 
   rm -rf mcrypt-$mcrypt_ver
   
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   
-  tar xzf php-$php53_ver.tar.gz
-  patch -d php-$php53_ver -p0 < fpm-race-condition.patch
-  pushd php-$php53_ver
+  tar xzf php-${php53_ver}.tar.gz
+  patch -d php-${php53_ver} -p0 < fpm-race-condition.patch
+  pushd php-${php53_ver}
   patch -p1 < ../php5.3patch
   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_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; 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 \
+  [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
+  if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; 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 \
     --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -80,9 +79,9 @@ Install_PHP53() {
     --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
     --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options
   else
-    ./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-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm --disable-fileinfo \
+    ./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-fpm-user=${run_user} --with-fpm-group=${run_user} --enable-fpm --disable-fileinfo \
     --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -95,45 +94,45 @@ Install_PHP53() {
   make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
   make install
   
-  if [ -e "$php_install_dir/bin/phpize" ]; then
+  if [ -e "${php_install_dir}/bin/phpize" ]; then
     echo "${CSUCCESS}PHP installed successfully! ${CEND}"
   else
-    rm -rf $php_install_dir
+    rm -rf ${php_install_dir}
     echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
     kill -9 $$
   fi
   
-  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile
-  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile
+  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
+  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
   . /etc/profile
   
   # wget -c http://pear.php.net/go-pear.phar
-  # $php_install_dir/bin/php go-pear.phar
+  # ${php_install_dir}/bin/php go-pear.phar
   
-  [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d
-  /bin/cp php.ini-production $php_install_dir/etc/php.ini
+  [ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
+  /bin/cp php.ini-production ${php_install_dir}/etc/php.ini
   
-  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini
-  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini
-  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini
-  sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini
-  sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini
-  sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini
-  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini
-  sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini
-  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini
-  sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini
-  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
+  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
+  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^max_execution_time.*@max_execution_time = 5@' ${php_install_dir}/etc/php.ini
+  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 [[ ! $apache_ver =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then
+  if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then
     # php-fpm Init Script
     /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
     chmod +x /etc/init.d/php-fpm
     [ "$OS" == 'CentOS' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
     [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d php-fpm defaults
 
-    cat > $php_install_dir/etc/php-fpm.conf <<EOF
+    cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
 ; FPM Configuration ;
 ;;;;;;;;;;;;;;;;;;;;;
@@ -156,15 +155,15 @@ daemonize = yes
 ; Pool Definitions ;
 ;;;;;;;;;;;;;;;;;;;;
 
-[$run_user]
+[${run_user}]
 listen = /dev/shm/php-cgi.sock
 listen.backlog = -1
 listen.allowed_clients = 127.0.0.1
-listen.owner = $run_user
-listen.group = $run_user
+listen.owner = ${run_user}
+listen.group = ${run_user}
 listen.mode = 0666
-user = $run_user
-group = $run_user
+user = ${run_user}
+group = ${run_user}
 
 pm = dynamic
 pm.max_children = 12
@@ -189,42 +188,42 @@ env[TMPDIR] = /tmp
 env[TEMP] = /tmp
 EOF
 
-    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf
+    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' ${php_install_dir}/etc/php-fpm.conf ${oneinstack_dir}/vhost.sh ${oneinstack_dir}/config/nginx.conf
 
     if [ $Mem -le 3000 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
     fi
 
-    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf
+    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then
+  elif [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then
     service httpd restart
   fi
   popd
-  [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php53_ver
+  [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php53_ver}
   popd
 }

+ 79 - 80
include/php-5.4.sh

@@ -2,32 +2,31 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP54() {
-  pushd ${oneinstack_dir}/src
-  
-  tar xzf libiconv-$libiconv_ver.tar.gz
-  patch -d libiconv-$libiconv_ver -p0 < libiconv-glibc-2.16.patch
-  pushd libiconv-$libiconv_ver
+  pushd ${oneinstack_dir}/src > /dev/null
+  tar xzf libiconv-${libiconv_ver}.tar.gz
+  patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
+  pushd libiconv-${libiconv_ver}
   ./configure --prefix=/usr/local
   make -j ${THREAD} && make install
   popd
-  rm -rf libiconv-$libiconv_ver
+  rm -rf libiconv-${libiconv_ver}
   
-  tar xzf curl-$curl_ver.tar.gz
-  pushd curl-$curl_ver
+  tar xzf curl-${curl_ver}.tar.gz
+  pushd curl-${curl_ver}
   ./configure --prefix=/usr/local --with-ssl=${openssl_install_dir}
   make -j ${THREAD} && make install
   popd
-  rm -rf curl-$curl_ver
+  rm -rf curl-${curl_ver}
   
-  tar xzf libmcrypt-$libmcrypt_ver.tar.gz
-  pushd libmcrypt-$libmcrypt_ver
+  tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
+  pushd libmcrypt-${libmcrypt_ver}
   ./configure
   make -j ${THREAD} && make install
   ldconfig
@@ -35,18 +34,18 @@ Install_PHP54() {
   ./configure --enable-ltdl-install
   make -j ${THREAD} && make install
   popd;popd
-  rm -rf libmcrypt-$libmcrypt_ver
+  rm -rf libmcrypt-${libmcrypt_ver}
   
-  tar xzf mhash-$mhash_ver.tar.gz
-  pushd mhash-$mhash_ver
+  tar xzf mhash-${mhash_ver}.tar.gz
+  pushd mhash-${mhash_ver}
   ./configure
   make -j ${THREAD} && make install
   popd 
-  rm -rf mhash-$mhash_ver
+  rm -rf mhash-${mhash_ver}
   
   echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
   ldconfig
-  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
+  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "${OS_BIT}" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
   
   tar xzf mcrypt-$mcrypt_ver.tar.gz
   pushd mcrypt-$mcrypt_ver
@@ -56,18 +55,18 @@ Install_PHP54() {
   popd
   rm -rf mcrypt-$mcrypt_ver
   
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   
-  tar xzf php-$php54_ver.tar.gz
-  patch -d php-$php54_ver -p0 < fpm-race-condition.patch
-  pushd php-$php54_ver
+  tar xzf php-${php54_ver}.tar.gz
+  patch -d php-${php54_ver} -p0 < fpm-race-condition.patch
+  pushd php-${php54_ver}
   make clean
-  [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir
-  if [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; 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 \
+  [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
+  if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; 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 \
     --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -76,9 +75,9 @@ Install_PHP54() {
     --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
     --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options
   else
-    ./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-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm --disable-fileinfo \
+    ./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-fpm-user=${run_user} --with-fpm-group=${run_user} --enable-fpm --disable-fileinfo \
     --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -90,45 +89,45 @@ Install_PHP54() {
   make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
   make install
   
-  if [ -e "$php_install_dir/bin/phpize" ]; then
+  if [ -e "${php_install_dir}/bin/phpize" ]; then
     echo "${CSUCCESS}PHP installed successfully! ${CEND}"
   else
-    rm -rf $php_install_dir
+    rm -rf ${php_install_dir}
     echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
     kill -9 $$
   fi
   
-  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile
-  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile
+  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
+  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
   . /etc/profile
   
   # wget -c http://pear.php.net/go-pear.phar
-  # $php_install_dir/bin/php go-pear.phar
+  # ${php_install_dir}/bin/php go-pear.phar
   
-  [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d
-  /bin/cp php.ini-production $php_install_dir/etc/php.ini
+  [ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
+  /bin/cp php.ini-production ${php_install_dir}/etc/php.ini
   
-  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini
-  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini
-  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini
-  sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini
-  sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini
-  sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini
-  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini
-  sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini
-  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini
-  sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini
-  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
+  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
+  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^max_execution_time.*@max_execution_time = 5@' ${php_install_dir}/etc/php.ini
+  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 [[ ! $apache_ver =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then
+  if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then
     # php-fpm Init Script
     /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
     chmod +x /etc/init.d/php-fpm
     [ "$OS" == 'CentOS' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
     [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d php-fpm defaults
 
-    cat > $php_install_dir/etc/php-fpm.conf <<EOF
+    cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
 ; FPM Configuration ;
 ;;;;;;;;;;;;;;;;;;;;;
@@ -151,15 +150,15 @@ daemonize = yes
 ; Pool Definitions ;
 ;;;;;;;;;;;;;;;;;;;;
 
-[$run_user]
+[${run_user}]
 listen = /dev/shm/php-cgi.sock
 listen.backlog = -1
 listen.allowed_clients = 127.0.0.1
-listen.owner = $run_user
-listen.group = $run_user
+listen.owner = ${run_user}
+listen.group = ${run_user}
 listen.mode = 0666
-user = $run_user
-group = $run_user
+user = ${run_user}
+group = ${run_user}
 
 pm = dynamic
 pm.max_children = 12
@@ -184,42 +183,42 @@ env[TMPDIR] = /tmp
 env[TEMP] = /tmp
 EOF
 
-    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf
+    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' ${php_install_dir}/etc/php-fpm.conf ${oneinstack_dir}/vhost.sh ${oneinstack_dir}/config/nginx.conf
 
     if [ $Mem -le 3000 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
     fi
 
-    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf
+    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then
+  elif [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then
     service httpd restart
   fi
   popd
-  [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php54_ver
+  [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php54_ver}
   popd
 }

+ 82 - 83
include/php-5.5.sh

@@ -2,32 +2,31 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP55() {
-  pushd ${oneinstack_dir}/src
-  
-  tar xzf libiconv-$libiconv_ver.tar.gz
-  patch -d libiconv-$libiconv_ver -p0 < libiconv-glibc-2.16.patch
-  pushd libiconv-$libiconv_ver
+  pushd ${oneinstack_dir}/src > /dev/null
+  tar xzf libiconv-${libiconv_ver}.tar.gz
+  patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
+  pushd libiconv-${libiconv_ver}
   ./configure --prefix=/usr/local
   make -j ${THREAD} && make install
   popd
-  rm -rf libiconv-$libiconv_ver
+  rm -rf libiconv-${libiconv_ver}
   
-  tar xzf curl-$curl_ver.tar.gz
-  pushd curl-$curl_ver
+  tar xzf curl-${curl_ver}.tar.gz
+  pushd curl-${curl_ver}
   ./configure --prefix=/usr/local --with-ssl=${openssl_install_dir}
   make -j ${THREAD} && make install
   popd
-  rm -rf curl-$curl_ver
+  rm -rf curl-${curl_ver}
   
-  tar xzf libmcrypt-$libmcrypt_ver.tar.gz
-  pushd libmcrypt-$libmcrypt_ver
+  tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
+  pushd libmcrypt-${libmcrypt_ver}
   ./configure
   make -j ${THREAD} && make install
   ldconfig
@@ -35,18 +34,18 @@ Install_PHP55() {
   ./configure --enable-ltdl-install
   make -j ${THREAD} && make install
   popd;popd
-  rm -rf libmcrypt-$libmcrypt_ver
+  rm -rf libmcrypt-${libmcrypt_ver}
   
-  tar xzf mhash-$mhash_ver.tar.gz
-  pushd mhash-$mhash_ver
+  tar xzf mhash-${mhash_ver}.tar.gz
+  pushd mhash-${mhash_ver}
   ./configure
   make -j ${THREAD} && make install
   popd
-  rm -rf mhash-$mhash_ver
+  rm -rf mhash-${mhash_ver}
   
   echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
   ldconfig
-  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
+  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "${OS_BIT}" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
   
   tar xzf mcrypt-$mcrypt_ver.tar.gz
   pushd mcrypt-$mcrypt_ver
@@ -56,17 +55,17 @@ Install_PHP55() {
   popd
   rm -rf mcrypt-$mcrypt_ver
   
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
-  tar xzf php-$php55_ver.tar.gz
-  patch -d php-$php55_ver -p0 < fpm-race-condition.patch
-  pushd php-$php55_ver
-  [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir
-  [ "$php_cache" == '1' ] && php_cache_tmp='--enable-opcache' || php_cache_tmp='--disable-opcache'
-  if [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; 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 $php_cache_tmp --disable-fileinfo \
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
+  tar xzf php-${php55_ver}.tar.gz
+  patch -d php-${php55_ver} -p0 < fpm-race-condition.patch
+  pushd php-${php55_ver}
+  [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
+  [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
+  if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; 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 \
     --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -75,9 +74,9 @@ Install_PHP55() {
     --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
     --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options
   else
-    ./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-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $php_cache_tmp --disable-fileinfo \
+    ./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-fpm-user=${run_user} --with-fpm-group=${run_user} --enable-fpm ${phpcache_arg} --disable-fileinfo \
     --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -89,42 +88,42 @@ Install_PHP55() {
   make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
   make install
   
-  if [ -e "$php_install_dir/bin/phpize" ]; then
+  if [ -e "${php_install_dir}/bin/phpize" ]; then
     echo "${CSUCCESS}PHP installed successfully! ${CEND}"
   else
-    rm -rf $php_install_dir
+    rm -rf ${php_install_dir}
     echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
     kill -9 $$
   fi
   
-  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile
-  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile
+  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
+  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
   . /etc/profile
   
   # wget -c http://pear.php.net/go-pear.phar
-  # $php_install_dir/bin/php go-pear.phar
+  # ${php_install_dir}/bin/php go-pear.phar
   
-  [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d
-  /bin/cp php.ini-production $php_install_dir/etc/php.ini
+  [ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
+  /bin/cp php.ini-production ${php_install_dir}/etc/php.ini
   
-  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini
-  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini
-  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini
-  sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini
-  sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini
-  sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini
-  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini
-  sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini
-  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini
-  sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini
-  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
+  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
+  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^max_execution_time.*@max_execution_time = 5@' ${php_install_dir}/etc/php.ini
+  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
   
-  [ "$php_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF
+  [ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/ext-opcache.ini << EOF
 [opcache]
 zend_extension=opcache.so
 opcache.enable=1
-opcache.memory_consumption=$Memory_limit
+opcache.memory_consumption=${Memory_limit}
 opcache.interned_strings_buffer=8
 opcache.max_accelerated_files=4000
 opcache.revalidate_freq=60
@@ -134,14 +133,14 @@ opcache.enable_cli=1
 ;opcache.optimization_level=0
 EOF
 
-  if [[ ! $apache_ver =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then
+  if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then
     # php-fpm Init Script
     /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
     chmod +x /etc/init.d/php-fpm
     [ "$OS" == 'CentOS' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
     [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d php-fpm defaults
 
-    cat > $php_install_dir/etc/php-fpm.conf <<EOF
+    cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
 ; FPM Configuration ;
 ;;;;;;;;;;;;;;;;;;;;;
@@ -164,15 +163,15 @@ daemonize = yes
 ; Pool Definitions ;
 ;;;;;;;;;;;;;;;;;;;;
 
-[$run_user]
+[${run_user}]
 listen = /dev/shm/php-cgi.sock
 listen.backlog = -1
 listen.allowed_clients = 127.0.0.1
-listen.owner = $run_user
-listen.group = $run_user
+listen.owner = ${run_user}
+listen.group = ${run_user}
 listen.mode = 0666
-user = $run_user
-group = $run_user
+user = ${run_user}
+group = ${run_user}
 
 pm = dynamic
 pm.max_children = 12
@@ -197,42 +196,42 @@ env[TMPDIR] = /tmp
 env[TEMP] = /tmp
 EOF
 
-    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf
+    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' ${php_install_dir}/etc/php-fpm.conf ${oneinstack_dir}/vhost.sh ${oneinstack_dir}/config/nginx.conf
 
     if [ $Mem -le 3000 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
     fi
 
-    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf
+    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then
+  elif [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then
     service httpd restart
   fi
   popd
-  [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php55_ver
+  [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php55_ver}
   popd
 }

+ 81 - 82
include/php-5.6.sh

@@ -2,32 +2,31 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP56() {
-  pushd ${oneinstack_dir}/src
-  
-  tar xzf libiconv-$libiconv_ver.tar.gz
-  patch -d libiconv-$libiconv_ver -p0 < libiconv-glibc-2.16.patch
-  pushd libiconv-$libiconv_ver
+  pushd ${oneinstack_dir}/src > /dev/null
+  tar xzf libiconv-${libiconv_ver}.tar.gz
+  patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
+  pushd libiconv-${libiconv_ver}
   ./configure --prefix=/usr/local
   make -j ${THREAD} && make install
   popd
-  rm -rf libiconv-$libiconv_ver
+  rm -rf libiconv-${libiconv_ver}
   
-  tar xzf curl-$curl_ver.tar.gz
-  pushd curl-$curl_ver
+  tar xzf curl-${curl_ver}.tar.gz
+  pushd curl-${curl_ver}
   ./configure --prefix=/usr/local --with-ssl=${openssl_install_dir}
   make -j ${THREAD} && make install
   popd
-  rm -rf curl-$curl_ver
+  rm -rf curl-${curl_ver}
   
-  tar xzf libmcrypt-$libmcrypt_ver.tar.gz
-  pushd libmcrypt-$libmcrypt_ver
+  tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
+  pushd libmcrypt-${libmcrypt_ver}
   ./configure
   make -j ${THREAD} && make install
   ldconfig
@@ -35,18 +34,18 @@ Install_PHP56() {
   ./configure --enable-ltdl-install
   make -j ${THREAD} && make install
   popd;popd
-  rm -rf libmcrypt-$libmcrypt_ver
+  rm -rf libmcrypt-${libmcrypt_ver}
   
-  tar xzf mhash-$mhash_ver.tar.gz
-  pushd mhash-$mhash_ver
+  tar xzf mhash-${mhash_ver}.tar.gz
+  pushd mhash-${mhash_ver}
   ./configure
   make -j ${THREAD} && make install
   popd
-  rm -rf mhash-$mhash_ver
+  rm -rf mhash-${mhash_ver}
   
   echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
   ldconfig
-  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
+  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "${OS_BIT}" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
   
   tar xzf mcrypt-$mcrypt_ver.tar.gz
   pushd mcrypt-$mcrypt_ver
@@ -56,18 +55,18 @@ Install_PHP56() {
   popd
   rm -rf mcrypt-$mcrypt_ver
   
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   
-  tar xzf php-$php56_ver.tar.gz
-  pushd php-$php56_ver
+  tar xzf php-${php56_ver}.tar.gz
+  pushd php-${php56_ver}
   make clean
-  [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir
-  [ "$php_cache" == '1' ] && php_cache_tmp='--enable-opcache' || php_cache_tmp='--disable-opcache'
-  if [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; 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 $php_cache_tmp --disable-fileinfo \
+  [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
+  [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
+  if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; 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 \
     --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -76,9 +75,9 @@ Install_PHP56() {
     --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
     --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options
   else
-    ./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-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $php_cache_tmp --disable-fileinfo \
+    ./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-fpm-user=${run_user} --with-fpm-group=${run_user} --enable-fpm ${phpcache_arg} --disable-fileinfo \
     --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -90,42 +89,42 @@ Install_PHP56() {
   make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
   make install
   
-  if [ -e "$php_install_dir/bin/phpize" ]; then
+  if [ -e "${php_install_dir}/bin/phpize" ]; then
     echo "${CSUCCESS}PHP installed successfully! ${CEND}"
   else
-    rm -rf $php_install_dir
+    rm -rf ${php_install_dir}
     echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
     kill -9 $$
   fi
 
-  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile
-  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile
+  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
+  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
   . /etc/profile
   
   # wget -c http://pear.php.net/go-pear.phar
-  # $php_install_dir/bin/php go-pear.phar
+  # ${php_install_dir}/bin/php go-pear.phar
   
-  [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d
-  /bin/cp php.ini-production $php_install_dir/etc/php.ini
+  [ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
+  /bin/cp php.ini-production ${php_install_dir}/etc/php.ini
   
-  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini
-  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini
-  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini
-  sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini
-  sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini
-  sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini
-  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini
-  sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini
-  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini
-  sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini
-  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
+  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
+  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^max_execution_time.*@max_execution_time = 5@' ${php_install_dir}/etc/php.ini
+  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
   
-  [ "$php_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF
+  [ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/ext-opcache.ini << EOF
 [opcache]
 zend_extension=opcache.so
 opcache.enable=1
-opcache.memory_consumption=$Memory_limit
+opcache.memory_consumption=${Memory_limit}
 opcache.interned_strings_buffer=8
 opcache.max_accelerated_files=4000
 opcache.revalidate_freq=60
@@ -135,14 +134,14 @@ opcache.enable_cli=1
 ;opcache.optimization_level=0
 EOF
 
-  if [[ ! $apache_ver =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then
+  if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then
     # php-fpm Init Script
     /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
     chmod +x /etc/init.d/php-fpm
     [ "$OS" == 'CentOS' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
     [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d php-fpm defaults
 
-    cat > $php_install_dir/etc/php-fpm.conf <<EOF
+    cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
 ; FPM Configuration ;
 ;;;;;;;;;;;;;;;;;;;;;
@@ -165,15 +164,15 @@ daemonize = yes
 ; Pool Definitions ;
 ;;;;;;;;;;;;;;;;;;;;
 
-[$run_user]
+[${run_user}]
 listen = /dev/shm/php-cgi.sock
 listen.backlog = -1
 listen.allowed_clients = 127.0.0.1
-listen.owner = $run_user
-listen.group = $run_user
+listen.owner = ${run_user}
+listen.group = ${run_user}
 listen.mode = 0666
-user = $run_user
-group = $run_user
+user = ${run_user}
+group = ${run_user}
 
 pm = dynamic
 pm.max_children = 12
@@ -198,42 +197,42 @@ env[TMPDIR] = /tmp
 env[TEMP] = /tmp
 EOF
 
-    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf
+    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' ${php_install_dir}/etc/php-fpm.conf ${oneinstack_dir}/vhost.sh ${oneinstack_dir}/config/nginx.conf
 
     if [ $Mem -le 3000 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
     fi
 
-    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf
+    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then
+  elif [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then
     service httpd restart
   fi
   popd
-  [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php56_ver
+  [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php56_ver}
   popd
 }

+ 82 - 83
include/php-7.0.sh

@@ -2,32 +2,31 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP70() {
-  pushd ${oneinstack_dir}/src
-  
-  tar xzf libiconv-$libiconv_ver.tar.gz
-  patch -d libiconv-$libiconv_ver -p0 < libiconv-glibc-2.16.patch
-  pushd libiconv-$libiconv_ver
+  pushd ${oneinstack_dir}/src > /dev/null
+  tar xzf libiconv-${libiconv_ver}.tar.gz
+  patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
+  pushd libiconv-${libiconv_ver}
   ./configure --prefix=/usr/local
   make -j ${THREAD} && make install
   popd
-  rm -rf libiconv-$libiconv_ver
+  rm -rf libiconv-${libiconv_ver}
   
-  tar xzf curl-$curl_ver.tar.gz
-  pushd curl-$curl_ver
+  tar xzf curl-${curl_ver}.tar.gz
+  pushd curl-${curl_ver}
   ./configure --prefix=/usr/local --with-ssl=${openssl_install_dir}
   make -j ${THREAD} && make install
   popd
-  rm -rf curl-$curl_ver
+  rm -rf curl-${curl_ver}
   
-  tar xzf libmcrypt-$libmcrypt_ver.tar.gz
-  pushd libmcrypt-$libmcrypt_ver
+  tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
+  pushd libmcrypt-${libmcrypt_ver}
   ./configure
   make -j ${THREAD} && make install
   ldconfig
@@ -35,18 +34,18 @@ Install_PHP70() {
   ./configure --enable-ltdl-install
   make -j ${THREAD} && make install
   popd;popd
-  rm -rf libmcrypt-$libmcrypt_ver
+  rm -rf libmcrypt-${libmcrypt_ver}
   
-  tar xzf mhash-$mhash_ver.tar.gz
-  pushd mhash-$mhash_ver
+  tar xzf mhash-${mhash_ver}.tar.gz
+  pushd mhash-${mhash_ver}
   ./configure
   make -j ${THREAD} && make install
   popd
-  rm -rf mhash-$mhash_ver
+  rm -rf mhash-${mhash_ver}
   
   echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
   ldconfig
-  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
+  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "${OS_BIT}" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
   
   tar xzf mcrypt-$mcrypt_ver.tar.gz
   pushd mcrypt-$mcrypt_ver
@@ -56,19 +55,19 @@ Install_PHP70() {
   popd
   rm -rf mcrypt-$mcrypt_ver
   
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   
-  tar xzf php-$php70_ver.tar.gz
-  pushd php-$php70_ver
+  tar xzf php-${php70_ver}.tar.gz
+  pushd php-${php70_ver}
   make clean
   ./buildconf
-  [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir
-  [ "$php_cache" == '1' ] && php_cache_tmp='--enable-opcache' || php_cache_tmp='--disable-opcache'
-  if [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; 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 $php_cache_tmp --disable-fileinfo \
+  [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
+  [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
+  if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; 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 \
     --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -77,9 +76,9 @@ Install_PHP70() {
     --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
     --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options
   else
-    ./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-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $php_cache_tmp --disable-fileinfo \
+    ./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-fpm-user=${run_user} --with-fpm-group=${run_user} --enable-fpm ${phpcache_arg} --disable-fileinfo \
     --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -91,44 +90,44 @@ Install_PHP70() {
   make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
   make install
   
-  if [ -e "$php_install_dir/bin/phpize" ]; then
+  if [ -e "${php_install_dir}/bin/phpize" ]; then
     echo "${CSUCCESS}PHP installed successfully! ${CEND}"
   else
-    rm -rf $php_install_dir
+    rm -rf ${php_install_dir}
     echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
     kill -9 $$
   fi
   
-  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile
-  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile
+  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
+  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
   . /etc/profile
   
   # wget -c http://pear.php.net/go-pear.phar
-  # $php_install_dir/bin/php go-pear.phar
+  # ${php_install_dir}/bin/php go-pear.phar
   
-  [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d
-  /bin/cp php.ini-production $php_install_dir/etc/php.ini
+  [ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
+  /bin/cp php.ini-production ${php_install_dir}/etc/php.ini
   
-  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini
-  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini
-  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini
-  sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini
-  sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini
-  sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini
-  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini
-  sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini
-  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini
-  sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini
-  sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini
-  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
+  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
+  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^max_execution_time.*@max_execution_time = 600@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' ${php_install_dir}/etc/php.ini
+  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
   
-  [ "$php_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF
+  [ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/ext-opcache.ini << EOF
 [opcache]
 zend_extension=opcache.so
 opcache.enable=1
 opcache.enable_cli=1
-opcache.memory_consumption=$Memory_limit
+opcache.memory_consumption=${Memory_limit}
 opcache.interned_strings_buffer=8
 opcache.max_accelerated_files=100000
 opcache.max_wasted_percentage=5
@@ -141,14 +140,14 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [[ ! $apache_ver =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then
+  if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then
     # php-fpm Init Script
     /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
     chmod +x /etc/init.d/php-fpm
     [ "$OS" == 'CentOS' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
     [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d php-fpm defaults
 
-    cat > $php_install_dir/etc/php-fpm.conf <<EOF
+    cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
 ; FPM Configuration ;
 ;;;;;;;;;;;;;;;;;;;;;
@@ -171,15 +170,15 @@ daemonize = yes
 ; Pool Definitions ;
 ;;;;;;;;;;;;;;;;;;;;
 
-[$run_user]
+[${run_user}]
 listen = /dev/shm/php-cgi.sock
 listen.backlog = -1
 listen.allowed_clients = 127.0.0.1
-listen.owner = $run_user
-listen.group = $run_user
+listen.owner = ${run_user}
+listen.group = ${run_user}
 listen.mode = 0666
-user = $run_user
-group = $run_user
+user = ${run_user}
+group = ${run_user}
 
 pm = dynamic
 pm.max_children = 12
@@ -204,42 +203,42 @@ env[TMPDIR] = /tmp
 env[TEMP] = /tmp
 EOF
 
-    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf
+    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' ${php_install_dir}/etc/php-fpm.conf ${oneinstack_dir}/vhost.sh ${oneinstack_dir}/config/nginx.conf
 
     if [ $Mem -le 3000 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
     fi
 
-    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf
+    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then
+  elif [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then
     service httpd restart
   fi
   popd
-  [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php70_ver
+  [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php70_ver}
   popd
 }

+ 82 - 83
include/php-7.1.sh

@@ -2,32 +2,31 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP71() {
-  pushd ${oneinstack_dir}/src
-  
-  tar xzf libiconv-$libiconv_ver.tar.gz
-  patch -d libiconv-$libiconv_ver -p0 < libiconv-glibc-2.16.patch
-  pushd libiconv-$libiconv_ver
+  pushd ${oneinstack_dir}/src > /dev/null
+  tar xzf libiconv-${libiconv_ver}.tar.gz
+  patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
+  pushd libiconv-${libiconv_ver}
   ./configure --prefix=/usr/local
   make -j ${THREAD} && make install
   popd
-  rm -rf libiconv-$libiconv_ver
+  rm -rf libiconv-${libiconv_ver}
   
-  tar xzf curl-$curl_ver.tar.gz
-  pushd curl-$curl_ver
+  tar xzf curl-${curl_ver}.tar.gz
+  pushd curl-${curl_ver}
   ./configure --prefix=/usr/local --with-ssl=${openssl_install_dir}
   make -j ${THREAD} && make install
   popd
-  rm -rf curl-$curl_ver
+  rm -rf curl-${curl_ver}
   
-  tar xzf libmcrypt-$libmcrypt_ver.tar.gz
-  pushd libmcrypt-$libmcrypt_ver
+  tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
+  pushd libmcrypt-${libmcrypt_ver}
   ./configure
   make -j ${THREAD} && make install
   ldconfig
@@ -35,18 +34,18 @@ Install_PHP71() {
   ./configure --enable-ltdl-install
   make -j ${THREAD} && make install
   popd;popd
-  rm -rf libmcrypt-$libmcrypt_ver
+  rm -rf libmcrypt-${libmcrypt_ver}
   
-  tar xzf mhash-$mhash_ver.tar.gz
-  pushd mhash-$mhash_ver
+  tar xzf mhash-${mhash_ver}.tar.gz
+  pushd mhash-${mhash_ver}
   ./configure
   make -j ${THREAD} && make install
   popd
-  rm -rf mhash-$mhash_ver
+  rm -rf mhash-${mhash_ver}
   
   echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
   ldconfig
-  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
+  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "${OS_BIT}" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
   
   tar xzf mcrypt-$mcrypt_ver.tar.gz
   pushd mcrypt-$mcrypt_ver
@@ -56,19 +55,19 @@ Install_PHP71() {
   popd
   rm -rf mcrypt-$mcrypt_ver
   
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   
-  tar xzf php-$php71_ver.tar.gz
-  pushd php-$php71_ver
+  tar xzf php-${php71_ver}.tar.gz
+  pushd php-${php71_ver}
   make clean
   ./buildconf
-  [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir
-  [ "$php_cache" == '1' ] && php_cache_tmp='--enable-opcache' || php_cache_tmp='--disable-opcache'
-  if [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; 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 $php_cache_tmp --disable-fileinfo \
+  [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
+  [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
+  if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; 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 \
     --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -77,9 +76,9 @@ Install_PHP71() {
     --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
     --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options
   else
-    ./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-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $php_cache_tmp --disable-fileinfo \
+    ./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-fpm-user=${run_user} --with-fpm-group=${run_user} --enable-fpm ${phpcache_arg} --disable-fileinfo \
     --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -91,44 +90,44 @@ Install_PHP71() {
   make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
   make install
   
-  if [ -e "$php_install_dir/bin/phpize" ]; then
+  if [ -e "${php_install_dir}/bin/phpize" ]; then
     echo "${CSUCCESS}PHP installed successfully! ${CEND}"
   else
-    rm -rf $php_install_dir
+    rm -rf ${php_install_dir}
     echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
     kill -9 $$
   fi
   
-  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile
-  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile
+  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
+  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
   . /etc/profile
   
   # wget -c http://pear.php.net/go-pear.phar
-  # $php_install_dir/bin/php go-pear.phar
+  # ${php_install_dir}/bin/php go-pear.phar
   
-  [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d
-  /bin/cp php.ini-production $php_install_dir/etc/php.ini
+  [ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
+  /bin/cp php.ini-production ${php_install_dir}/etc/php.ini
   
-  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini
-  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini
-  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini
-  sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini
-  sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini
-  sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini
-  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini
-  sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini
-  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini
-  sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini
-  sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini
-  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
+  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
+  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^max_execution_time.*@max_execution_time = 600@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' ${php_install_dir}/etc/php.ini
+  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
   
-  [ "$php_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF
+  [ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/ext-opcache.ini << EOF
 [opcache]
 zend_extension=opcache.so
 opcache.enable=1
 opcache.enable_cli=1
-opcache.memory_consumption=$Memory_limit
+opcache.memory_consumption=${Memory_limit}
 opcache.interned_strings_buffer=8
 opcache.max_accelerated_files=100000
 opcache.max_wasted_percentage=5
@@ -141,14 +140,14 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [[ ! $apache_ver =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then
+  if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then
     # php-fpm Init Script
     /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
     chmod +x /etc/init.d/php-fpm
     [ "$OS" == 'CentOS' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
     [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d php-fpm defaults
 
-    cat > $php_install_dir/etc/php-fpm.conf <<EOF
+    cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
 ; FPM Configuration ;
 ;;;;;;;;;;;;;;;;;;;;;
@@ -171,15 +170,15 @@ daemonize = yes
 ; Pool Definitions ;
 ;;;;;;;;;;;;;;;;;;;;
 
-[$run_user]
+[${run_user}]
 listen = /dev/shm/php-cgi.sock
 listen.backlog = -1
 listen.allowed_clients = 127.0.0.1
-listen.owner = $run_user
-listen.group = $run_user
+listen.owner = ${run_user}
+listen.group = ${run_user}
 listen.mode = 0666
-user = $run_user
-group = $run_user
+user = ${run_user}
+group = ${run_user}
 
 pm = dynamic
 pm.max_children = 12
@@ -204,42 +203,42 @@ env[TMPDIR] = /tmp
 env[TEMP] = /tmp
 EOF
 
-    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf
+    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' ${php_install_dir}/etc/php-fpm.conf ${oneinstack_dir}/vhost.sh ${oneinstack_dir}/config/nginx.conf
 
     if [ $Mem -le 3000 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
     fi
 
-    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf
+    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then
+  elif [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then
     service httpd restart
   fi
   popd
-  [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php71_ver
+  [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php71_ver}
   popd
 }

+ 79 - 80
include/php-7.2.sh

@@ -2,54 +2,53 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP72() {
-  pushd ${oneinstack_dir}/src
-  
-  tar xzf libiconv-$libiconv_ver.tar.gz
-  patch -d libiconv-$libiconv_ver -p0 < libiconv-glibc-2.16.patch
-  pushd libiconv-$libiconv_ver
+  pushd ${oneinstack_dir}/src > /dev/null
+  tar xzf libiconv-${libiconv_ver}.tar.gz
+  patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
+  pushd libiconv-${libiconv_ver}
   ./configure --prefix=/usr/local
   make -j ${THREAD} && make install
   popd
-  rm -rf libiconv-$libiconv_ver
+  rm -rf libiconv-${libiconv_ver}
   
-  tar xzf curl-$curl_ver.tar.gz
-  pushd curl-$curl_ver
+  tar xzf curl-${curl_ver}.tar.gz
+  pushd curl-${curl_ver}
   ./configure --prefix=/usr/local --with-ssl=${openssl_install_dir}
   make -j ${THREAD} && make install
   popd
-  rm -rf curl-$curl_ver
+  rm -rf curl-${curl_ver}
   
-  tar xzf mhash-$mhash_ver.tar.gz
-  pushd mhash-$mhash_ver
+  tar xzf mhash-${mhash_ver}.tar.gz
+  pushd mhash-${mhash_ver}
   ./configure
   make -j ${THREAD} && make install
   popd
-  rm -rf mhash-$mhash_ver
+  rm -rf mhash-${mhash_ver}
   
   echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
   ldconfig
-  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
+  [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "${OS_BIT}" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; }
   
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   
-  tar xzf php-$php72_ver.tar.gz
-  pushd php-$php72_ver
+  tar xzf php-${php72_ver}.tar.gz
+  pushd php-${php72_ver}
   make clean
   ./buildconf
-  [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir
-  [ "$php_cache" == '1' ] && php_cache_tmp='--enable-opcache' || php_cache_tmp='--disable-opcache'
-  if [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; 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 $php_cache_tmp --disable-fileinfo \
+  [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
+  [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
+  if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; 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 \
     --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -58,9 +57,9 @@ Install_PHP72() {
     --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
     --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options
   else
-    ./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-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $php_cache_tmp --disable-fileinfo \
+    ./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-fpm-user=${run_user} --with-fpm-group=${run_user} --enable-fpm ${phpcache_arg} --disable-fileinfo \
     --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
     --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
     --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
@@ -72,44 +71,44 @@ Install_PHP72() {
   make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
   make install
   
-  if [ -e "$php_install_dir/bin/phpize" ]; then
+  if [ -e "${php_install_dir}/bin/phpize" ]; then
     echo "${CSUCCESS}PHP installed successfully! ${CEND}"
   else
-    rm -rf $php_install_dir
+    rm -rf ${php_install_dir}
     echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
     kill -9 $$
   fi
   
-  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile
-  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile
+  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
+  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
   . /etc/profile
   
   # wget -c http://pear.php.net/go-pear.phar
-  # $php_install_dir/bin/php go-pear.phar
+  # ${php_install_dir}/bin/php go-pear.phar
   
-  [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d
-  /bin/cp php.ini-production $php_install_dir/etc/php.ini
+  [ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
+  /bin/cp php.ini-production ${php_install_dir}/etc/php.ini
   
-  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini
-  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini
-  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini
-  sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini
-  sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini
-  sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini
-  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini
-  sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini
-  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini
-  sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini
-  sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini
-  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
+  sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
+  sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^max_execution_time.*@max_execution_time = 600@' ${php_install_dir}/etc/php.ini
+  sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' ${php_install_dir}/etc/php.ini
+  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
   
-  [ "$php_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF
+  [ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/ext-opcache.ini << EOF
 [opcache]
 zend_extension=opcache.so
 opcache.enable=1
 opcache.enable_cli=1
-opcache.memory_consumption=$Memory_limit
+opcache.memory_consumption=${Memory_limit}
 opcache.interned_strings_buffer=8
 opcache.max_accelerated_files=100000
 opcache.max_wasted_percentage=5
@@ -122,14 +121,14 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [[ ! $apache_ver =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then
+  if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then
     # php-fpm Init Script
     /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
     chmod +x /etc/init.d/php-fpm
     [ "$OS" == 'CentOS' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
     [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d php-fpm defaults
 
-    cat > $php_install_dir/etc/php-fpm.conf <<EOF
+    cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
 ; FPM Configuration ;
 ;;;;;;;;;;;;;;;;;;;;;
@@ -152,15 +151,15 @@ daemonize = yes
 ; Pool Definitions ;
 ;;;;;;;;;;;;;;;;;;;;
 
-[$run_user]
+[${run_user}]
 listen = /dev/shm/php-cgi.sock
 listen.backlog = -1
 listen.allowed_clients = 127.0.0.1
-listen.owner = $run_user
-listen.group = $run_user
+listen.owner = ${run_user}
+listen.group = ${run_user}
 listen.mode = 0666
-user = $run_user
-group = $run_user
+user = ${run_user}
+group = ${run_user}
 
 pm = dynamic
 pm.max_children = 12
@@ -185,42 +184,42 @@ env[TMPDIR] = /tmp
 env[TEMP] = /tmp
 EOF
 
-    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf
+    [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' ${php_install_dir}/etc/php-fpm.conf ${oneinstack_dir}/vhost.sh ${oneinstack_dir}/config/nginx.conf
 
     if [ $Mem -le 3000 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
     elif [ $Mem -gt 8500 ]; then
-      sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf
-      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf
+      sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
     fi
 
-    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf
+    #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [[ $apache_ver =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then
+  elif [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then
     service httpd restart
   fi
   popd
-  [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php72_ver
+  [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php72_ver}
   popd
 }

+ 3 - 3
include/phpmyadmin.sh

@@ -2,14 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_phpMyAdmin() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   tar xzf phpMyAdmin-${phpmyadmin_ver}-all-languages.tar.gz
   /bin/mv phpMyAdmin-${phpmyadmin_ver}-all-languages ${wwwroot_dir}/default/phpMyAdmin
   /bin/cp ${wwwroot_dir}/default/phpMyAdmin/{config.sample.inc.php,config.inc.php}
@@ -17,6 +17,6 @@ Install_phpMyAdmin() {
   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@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
+  chown -R ${run_user}.${run_user} ${wwwroot_dir}/default/phpMyAdmin
   popd
 }

+ 2 - 2
include/postgresql.sh

@@ -2,14 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PostgreSQL() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u postgres >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -d ${pgsql_install_dir} -s /bin/bash postgres 
   mkdir -p ${pgsql_data_dir};chown postgres.postgres -R ${pgsql_data_dir}

+ 4 - 5
include/pureftpd.sh

@@ -2,15 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PureFTPd() {
-  pushd ${oneinstack_dir}/src
-
+  pushd ${oneinstack_dir}/src > /dev/null
   id -u ${run_user} >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
 
@@ -28,7 +27,7 @@ Install_PureFTPd() {
     chmod +x /etc/init.d/pureftpd
     [ "${OS}" == "CentOS" ] && { chkconfig --add pureftpd; chkconfig pureftpd on; }
     [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && { sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd; update-rc.d pureftpd defaults; }
-    [ "${Debian_version}" == '7' ] && sed -i 's@/var/lock/subsys/@/var/lock/@g' /etc/init.d/pureftpd
+    [ "${Debian_ver}" == '7' ] && sed -i 's@/var/lock/subsys/@/var/lock/@g' /etc/init.d/pureftpd
 
     sed -i "s@^PureDB.*@PureDB  ${pureftpd_install_dir}/etc/pureftpd.pdb@" ${pureftpd_install_dir}/etc/pure-ftpd.conf
     sed -i "s@^LimitRecursion.*@LimitRecursion  65535 8@" ${pureftpd_install_dir}/etc/pure-ftpd.conf
@@ -36,7 +35,7 @@ Install_PureFTPd() {
     service pureftpd start
 
     # iptables Ftp
-    if [ "$iptables_yn" == 'y' ]; then
+    if [ "${iptables_yn}" == 'y' ]; then
       if [ "${OS}" == "CentOS" ]; then
         if [ -z "$(grep '20000:30000' /etc/sysconfig/iptables)" ]; then
           iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT

+ 4 - 4
include/python.sh

@@ -2,15 +2,15 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Python() {
-  pushd ${oneinstack_dir}/src
-  if [ "${CentOS_RHEL_version}" == '7' ]; then
+  pushd ${oneinstack_dir}/src > /dev/null
+  if [ "${CentOS_RHEL_ver}" == '7' ]; then
     [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF
 [epel]
 name=Extra Packages for Enterprise Linux 7 - \$basearch
@@ -20,7 +20,7 @@ failovermethod=priority
 enabled=1
 gpgcheck=0
 EOF
-  elif [ "${CentOS_RHEL_version}" == '6' ]; then
+  elif [ "${CentOS_RHEL_ver}" == '6' ]; then
     [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF
 [epel]
 name=Extra Packages for Enterprise Linux 6 - \$basearch

+ 4 - 4
include/redis.sh

@@ -2,17 +2,17 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_redis-server() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   tar xzf redis-${redis_ver}.tar.gz
   pushd redis-${redis_ver}
-  if [ "$OS_BIT" == '32' ]; then
+  if [ "${OS_BIT}" == '32' ]; then
     sed -i '1i\CFLAGS= -march=i686' src/Makefile
     sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings
   fi
@@ -56,7 +56,7 @@ Install_redis-server() {
 }
 
 Install_php-redis() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
     tar xzf redis-$redis_pecl_ver.tgz

+ 11 - 12
include/tengine.sh

@@ -2,17 +2,16 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Tengine() {
-  pushd ${oneinstack_dir}/src
-  
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
+  pushd ${oneinstack_dir}/src > /dev/null
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
   
   tar xzf pcre-$pcre_ver.tar.gz
   tar xzf tengine-$tengine_ver.tar.gz
@@ -25,7 +24,7 @@ Install_Tengine() {
   sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc
   
   [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir
-  ./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
+  ./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 -j ${THREAD} && make install
   if [ -e "$tengine_install_dir/conf/nginx.conf" ]; then
     popd
@@ -47,9 +46,9 @@ Install_Tengine() {
   sed -i "s@/usr/local/nginx@$tengine_install_dir@g" /etc/init.d/nginx
   
   mv $tengine_install_dir/conf/nginx.conf{,_bk}
-  if [[ $apache_ver =~ ^[1-2]$ ]]; then
+  if [[ ${apache_option} =~ ^[1-2]$ ]]; then
     /bin/cp ../config/nginx_apache.conf $tengine_install_dir/conf/nginx.conf
-  elif [[ $tomcat_ver =~ ^[1-2]$ ]] && [ ! -e "$php_install_dir/bin/php" ]; then
+  elif [[ ${tomcat_option} =~ ^[1-2]$ ]] && [ ! -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
@@ -72,9 +71,9 @@ proxy_set_header X-Real-IP \$remote_addr;
 proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
 proxy_set_header X-Forwarded-Proto \$scheme;
 EOF
-  sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $tengine_install_dir/conf/nginx.conf
-  sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $tengine_install_dir/conf/nginx.conf
-  sed -i "s@^user www www@user $run_user $run_user@" $tengine_install_dir/conf/nginx.conf
+  sed -i "s@/data/wwwroot/default@${wwwroot_dir}/default@" $tengine_install_dir/conf/nginx.conf
+  sed -i "s@/data/wwwlogs@${wwwlogs_dir}@g" $tengine_install_dir/conf/nginx.conf
+  sed -i "s@^user www www@user ${run_user} ${run_user}@" $tengine_install_dir/conf/nginx.conf
   uname -r | awk -F'.' '{if ($1$2>=39)S=0;else S=1}{exit S}' && [ -z "`grep 'reuse_port on;' $tengine_install_dir/conf/nginx.conf`" ] && sed -i "s@worker_connections 51200;@worker_connections 51200;\n    reuse_port on;@" $tengine_install_dir/conf/nginx.conf
   
   # worker_cpu_affinity
@@ -82,7 +81,7 @@ EOF
   
   # logrotate nginx log
   cat > /etc/logrotate.d/nginx << EOF
-$wwwlogs_dir/*nginx.log {
+${wwwlogs_dir}/*nginx.log {
   daily
   rotate 5
   missingok

+ 3 - 5
include/tomcat-6.sh

@@ -2,16 +2,15 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Tomcat6() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   . /etc/profile
-
   id -u ${run_user} >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; }
 
@@ -68,12 +67,11 @@ EOF
     chmod +x ./*.sh
     /bin/mv ${tomcat_install_dir}/conf/server.xml{,_bk}
     popd # goto ${oneinstack_dir}/src
-
     /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 [ "$iptables_yn" == 'y' ]; then
+      if [ "${iptables_yn}" == 'y' ]; then
         if [ "${OS}" == "CentOS" ]; then
           if [ -z "$(grep -w '8080' /etc/sysconfig/iptables)" ]; then
             iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT

+ 3 - 5
include/tomcat-7.sh

@@ -2,16 +2,15 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Tomcat7() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   . /etc/profile
-
   id -u ${run_user} >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; }
 
@@ -68,12 +67,11 @@ EOF
     chmod +x ./*.sh
     /bin/mv ${tomcat_install_dir}/conf/server.xml{,_bk}
     popd # goto ${oneinstack_dir}/src
-
     /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 [ "$iptables_yn" == 'y' ]; then
+      if [ "${iptables_yn}" == 'y' ]; then
         if [ "${OS}" == "CentOS" ]; then
           if [ -z "$(grep -w '8080' /etc/sysconfig/iptables)" ]; then
             iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT

+ 3 - 5
include/tomcat-8.sh

@@ -2,16 +2,15 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Tomcat8() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   . /etc/profile
-
   id -u ${run_user} >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; }
 
@@ -68,12 +67,11 @@ EOF
     chmod +x ./*.sh
     /bin/mv ${tomcat_install_dir}/conf/server.xml{,_bk}
     popd # goto ${oneinstack_dir}/src
-
     /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 [ "$iptables_yn" == 'y' ]; then
+      if [ "${iptables_yn}" == 'y' ]; then
         if [ "${OS}" == "CentOS" ]; then
           if [ -z "$(grep -w '8080' /etc/sysconfig/iptables)" ]; then
             iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT

+ 31 - 31
include/upgrade_db.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -10,8 +10,8 @@
 
 Upgrade_DB() {
   pushd ${oneinstack_dir}/src > /dev/null
-  [ ! -e "$db_install_dir/bin/mysql" ] && echo "${CWARNING}MySQL/MariaDB/Percona is not installed on your system! ${CEND}" && exit 1
-  OLD_db_ver_tmp=`$db_install_dir/bin/mysql -V | awk '{print $5}' | awk -F, '{print $1}'`
+  [ ! -e "${db_install_dir}/bin/mysql" ] && echo "${CWARNING}MySQL/MariaDB/Percona is not installed on your system! ${CEND}" && exit 1
+  OLD_db_ver_tmp=`${db_install_dir}/bin/mysql -V | awk '{print $5}' | awk -F, '{print $1}'`
   DB_tmp=`echo $OLD_db_ver_tmp | awk -F'-' '{print $2}'`
   if [ "$DB_tmp" == 'MariaDB' ]; then
     [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=https://mirrors.tuna.tsinghua.edu.cn/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f
@@ -28,13 +28,13 @@ Upgrade_DB() {
 
   #backup
   while :; do
-    $db_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "quit" >/dev/null 2>&1
+    ${db_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "quit" >/dev/null 2>&1
     if [ $? -eq 0 ]; then
       break
     else
       echo
       read -p "Please input the root password of database: " NEW_dbrootpwd
-      $db_install_dir/bin/mysql -uroot -p${NEW_dbrootpwd} -e "quit" >/dev/null 2>&1
+      ${db_install_dir}/bin/mysql -uroot -p${NEW_dbrootpwd} -e "quit" >/dev/null 2>&1
       if [ $? -eq 0 ]; then
         dbrootpwd=$NEW_dbrootpwd
         sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ../options.conf
@@ -47,7 +47,7 @@ Upgrade_DB() {
 
   echo
   echo "${CSUCCESS}Starting $DB backup${CEND}......"
-  $db_install_dir/bin/mysqldump -uroot -p${dbrootpwd} --opt --all-databases > DB_all_backup_$(date +"%Y%m%d").sql
+  ${db_install_dir}/bin/mysqldump -uroot -p${dbrootpwd} --opt --all-databases > DB_all_backup_$(date +"%Y%m%d").sql
   [ -f "DB_all_backup_$(date +"%Y%m%d").sql" ] && echo "$DB backup success, Backup file: ${MSG}`pwd`/DB_all_backup_$(date +"%Y%m%d").sql${CEND}"
   
   #upgrade
@@ -86,26 +86,26 @@ Upgrade_DB() {
       service mysqld stop
       mv ${mariadb_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mariadb_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
-      mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir
+      mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir}
       tar xzf $DB_name.tar.gz
-      [ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir
-      mv mariadb-${NEW_db_ver}-*-${SYS_BIT_b}/* $mariadb_install_dir
-      sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe
-      $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir
-      chown mysql.mysql -R $mariadb_data_dir
+      [ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir}
+      mv mariadb-${NEW_db_ver}-*-${SYS_BIT_b}/* ${mariadb_install_dir}
+      sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe
+      ${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir}
+      chown mysql.mysql -R ${mariadb_data_dir}
       service mysqld start
-      $mariadb_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql
+      ${mariadb_install_dir}/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql
       service mysqld restart
-      $mariadb_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
-      $mariadb_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
+      ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
+      ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
       [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_db_ver${CEND} to ${CMSG}$NEW_db_ver${CEND}"
     elif [ "$DB" == 'Percona' ]; then
       tar xzf $DB_name.tar.gz
       pushd $DB_name
       make clean
       if [ "`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`" == '5.5' ]; then
-        cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \
-        -DMYSQL_DATADIR=$percona_data_dir \
+        cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \
+        -DMYSQL_DATADIR=${percona_data_dir} \
         -DSYSCONFDIR=/etc \
         -DWITH_INNOBASE_STORAGE_ENGINE=1 \
         -DWITH_PARTITION_STORAGE_ENGINE=1 \
@@ -120,8 +120,8 @@ Upgrade_DB() {
         -DDEFAULT_COLLATION=utf8mb4_general_ci \
         -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
       else
-        cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \
-        -DMYSQL_DATADIR=$percona_data_dir \
+        cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \
+        -DMYSQL_DATADIR=${percona_data_dir} \
         -DSYSCONFDIR=/etc \
         -DWITH_INNOBASE_STORAGE_ENGINE=1 \
         -DWITH_PARTITION_STORAGE_ENGINE=1 \
@@ -139,21 +139,21 @@ Upgrade_DB() {
       service mysqld stop
       mv ${percona_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${percona_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
-      [ ! -d "$percona_install_dir" ] && mkdir -p $percona_install_dir
-      mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir
+      [ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir}
+      mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir}
       make install
       popd 
       if [ "`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`" == '5.7' ]; then
-        $percona_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$percona_install_dir --datadir=$percona_data_dir
+        ${percona_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir}
       else
-        $percona_install_dir/scripts/mysql_install_db --user=mysql --basedir=$percona_install_dir --datadir=$percona_data_dir
+        ${percona_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir}
       fi
-      chown mysql.mysql -R $percona_data_dir
+      chown mysql.mysql -R ${percona_data_dir}
       service mysqld start
-      $percona_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql
+      ${percona_install_dir}/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql
       service mysqld restart
-      $percona_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
-      $percona_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
+      ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
+      ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
       [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_db_ver${CEND} to ${CMSG}$NEW_db_ver${CEND}"
     elif [ "$DB" == 'MySQL' ]; then
       tar xzf $DB_name.tar.gz
@@ -161,14 +161,14 @@ Upgrade_DB() {
       mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir
-      mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir
+      mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir}
       mv $DB_name/* $mysql_install_dir/
       sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe
       sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
-      [ "`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`" != '5.7' ] && $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir
-      [ "`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`" == '5.7' ] && $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir
+      [ "`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`" != '5.7' ] && $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=${mysql_data_dir}
+      [ "`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`" == '5.7' ] && $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=${mysql_data_dir}
 
-      chown mysql.mysql -R $mysql_data_dir
+      chown mysql.mysql -R ${mysql_data_dir}
       [ -e "$mysql_install_dir/my.cnf" ] && rm -rf $mysql_install_dir/my.cnf
       service mysqld start
       $mysql_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql

+ 20 - 18
include/upgrade_memcached.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -11,17 +11,18 @@
 Upgrade_Memcached() {
   pushd ${oneinstack_dir}/src > /dev/null
   [ ! -e "${memcached_install_dir}/bin/memcached" ] && echo "${CWARNING}Memcached is not installed on your system! ${CEND}" && exit 1
-  OLD_Memcached_version=`$memcached_install_dir/bin/memcached -V | awk '{print $2}'`
-  Latest_Memcached_version=`curl -s http://memcached.org/downloads | awk -F'>|<' '/\/files\/memcached/{print $3}' | grep -oE "[0-9]\.[0-9]\.[0-9]+"`
-  [ -z "$Latest_Memcached_version" ] && Latest_Memcached_version=1.6.8
-  echo "Current Memcached Version: ${CMSG}$OLD_Memcached_version${CEND}"
+  OLD_memcached_ver=`${memcached_install_dir}/bin/memcached -V | awk '{print $2}'`
+  Latest_memcached_ver=`curl -s https://github.com/memcached/memcached/wiki/ReleaseNotes | grep 'internal present.*ReleaseNotes' |  grep -oE "[0-9]\.[0-9]\.[0-9]+" | head -1`
+  [ -z "${Latest_memcached_ver}" ] && Latest_memcached_ver=1.6.8
+  echo "Current Memcached Version: ${CMSG}${OLD_memcached_ver}${CEND}"
   while :; do echo
-    read -p "Please input upgrade Memcached Version(default: $Latest_Memcached_version): " NEW_Memcached_version
-    [ -z "$NEW_Memcached_version" ] && NEW_Memcached_version=$Latest_Memcached_version
-    if [ "${NEW_Memcached_version}" != "$OLD_Memcached_version" ]; then
-      [ ! -e "memcached-${NEW_Memcached_version}.tar.gz" ] && wget --no-check-certificate -c http://www.memcached.org/files/memcached-${NEW_Memcached_version}.tar.gz > /dev/null 2>&1
-      if [ -e "memcached-${NEW_Memcached_version}.tar.gz" ]; then
-        echo "Download [${CMSG}memcached-${NEW_Memcached_version}.tar.gz${CEND}] successfully! "
+    read -p "Please input upgrade Memcached Version(default: ${Latest_memcached_ver}): " NEW_memcached_ver
+    [ -z "${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
+      [ ! -e "memcached-${NEW_memcached_ver}.tar.gz" ] && wget --no-check-certificate -c ${DOWN_ADDR}/memcached-${NEW_memcached_ver}.tar.gz > /dev/null 2>&1
+      if [ -e "memcached-${NEW_memcached_ver}.tar.gz" ]; then
+        echo "Download [${CMSG}memcached-${NEW_memcached_ver}.tar.gz${CEND}] successfully! "
         break
       else
         echo "${CWARNING}Memcached version does not exist! ${CEND}"
@@ -31,14 +32,15 @@ Upgrade_Memcached() {
     fi
   done
 
-  if [ -e "memcached-${NEW_Memcached_version}.tar.gz" ]; then
-    echo "[${CMSG}memcached-${NEW_Memcached_version}.tar.gz${CEND}] found"
+  if [ -e "memcached-${NEW_memcached_ver}.tar.gz" ]; then
+    echo "[${CMSG}memcached-${NEW_memcached_ver}.tar.gz${CEND}] found"
     echo "Press Ctrl+c to cancel or Press any key to continue..."
     char=`get_char`
-    tar xzf memcached-${NEW_Memcached_version}.tar.gz
-    pushd memcached-${NEW_Memcached_version}
+    tar xzf memcached-${NEW_memcached_ver}.tar.gz
+    pushd memcached-${NEW_memcached_ver}
     make clean
-    ./configure --prefix=${memcached_install_dir}
+    [ "${OS}" == "CentOS" ] && libevent_arg='--with-libevent=/usr/local'
+    ./configure --prefix=${memcached_install_dir} ${libevent_arg}
     make -j ${THREAD}
 
     if [ -e "memcached" ]; then
@@ -47,8 +49,8 @@ Upgrade_Memcached() {
       make install
       service memcached start
       popd > /dev/null
-      echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Memcached_version${CEND} to ${CWARNING}${NEW_Memcached_version}${CEND}"
-      rm -rf memcached-${NEW_Memcached_version}
+      echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}${OLD_memcached_ver}${CEND} to ${CWARNING}${NEW_memcached_ver}${CEND}"
+      rm -rf memcached-${NEW_memcached_ver}
     else
       echo "${CFAILURE}Upgrade Memcached failed! ${CEND}"
     fi

+ 2 - 1
include/upgrade_oneinstack.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -15,6 +15,7 @@ Upgrade_OneinStack() {
   if [ "$oneinstack_md5" != "$Latest_OneinStack_MD5" ]; then
     /bin/mv options.conf /tmp
     /bin/mv backup*.sh /tmp
+    sed -i '/oneinstack_dir=/d' /tmp/options.conf
     [ -e /tmp/oneinstack.tar.gz ] && rm -rf /tmp/oneinstack.tar.gz
     wget -c http://mirrors.linuxeye.com/oneinstack.tar.gz -O /tmp/oneinstack.tar.gz > /dev/null 2>&1 
     tar xzf /tmp/oneinstack.tar.gz -C ../

+ 1 - 1
include/upgrade_php.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com

+ 2 - 2
include/upgrade_phpmyadmin.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -43,7 +43,7 @@ Upgrade_phpMyAdmin() {
     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@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
+    chown -R ${run_user}.${run_user} ${wwwroot_dir}/default/phpMyAdmin
     echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_phpmyadmin_ver${CEND} to ${CWARNING}$NEW_phpmyadmin_ver${CEND}"
   fi
   popd > /dev/null

+ 18 - 18
include/upgrade_redis.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -11,17 +11,17 @@
 Upgrade_Redis() {
   pushd ${oneinstack_dir}/src > /dev/null
   [ ! -d "$redis_install_dir" ] && echo "${CWARNING}Redis is not installed on your system! ${CEND}" && exit 1
-  OLD_Redis_version=`$redis_install_dir/bin/redis-cli --version | awk '{print $2}'`
-  Latest_Redis_version=`curl -s http://download.redis.io/redis-stable/00-RELEASENOTES | awk '/Released/{print $2}' | head -1`
-  [ -z "$Latest_Redis_version" ] && Latest_Redis_version=4.2.8
-  echo "Current Redis Version: ${CMSG}$OLD_Redis_version${CEND}"
+  OLD_redis_ver=`$redis_install_dir/bin/redis-cli --version | awk '{print $2}'`
+  Latest_redis_ver=`curl -s http://download.redis.io/redis-stable/00-RELEASENOTES | awk '/Released/{print $2}' | head -1`
+  [ -z "$Latest_redis_ver" ] && Latest_redis_ver=4.2.8
+  echo "Current Redis Version: ${CMSG}$OLD_redis_ver${CEND}"
   while :; do echo
-    read -p "Please input upgrade Redis Version(default: $Latest_Redis_version): " NEW_Redis_version
-    [ -z "$NEW_Redis_version" ] && NEW_Redis_version=$Latest_Redis_version
-    if [ "$NEW_Redis_version" != "$OLD_Redis_version" ]; then
-      [ ! -e "redis-$NEW_Redis_version.tar.gz" ] && wget --no-check-certificate -c http://download.redis.io/releases/redis-$NEW_Redis_version.tar.gz > /dev/null 2>&1
-      if [ -e "redis-$NEW_Redis_version.tar.gz" ]; then
-        echo "Download [${CMSG}redis-$NEW_Redis_version.tar.gz${CEND}] successfully! "
+    read -p "Please input upgrade Redis Version(default: $Latest_redis_ver): " NEW_redis_ver
+    [ -z "$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
+      if [ -e "redis-$NEW_redis_ver.tar.gz" ]; then
+        echo "Download [${CMSG}redis-$NEW_redis_ver.tar.gz${CEND}] successfully! "
         break
       else
         echo "${CWARNING}Redis version does not exist! ${CEND}"
@@ -31,14 +31,14 @@ Upgrade_Redis() {
     fi
   done
 
-  if [ -e "redis-$NEW_Redis_version.tar.gz" ]; then
-    echo "[${CMSG}redis-$NEW_Redis_version.tar.gz${CEND}] found"
+  if [ -e "redis-$NEW_redis_ver.tar.gz" ]; then
+    echo "[${CMSG}redis-$NEW_redis_ver.tar.gz${CEND}] found"
     echo "Press Ctrl+c to cancel or Press any key to continue..."
     char=`get_char`
-    tar xzf redis-$NEW_Redis_version.tar.gz
-    pushd redis-$NEW_Redis_version
+    tar xzf redis-$NEW_redis_ver.tar.gz
+    pushd redis-$NEW_redis_ver
     make clean
-    if [ "$OS_BIT" == '32' ]; then
+    if [ "${OS_BIT}" == '32' ]; then
       sed -i '1i\CFLAGS= -march=i686' src/Makefile
       sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings
     fi
@@ -51,8 +51,8 @@ Upgrade_Redis() {
       /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/
       service redis-server start
       popd > /dev/null
-      echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Redis_version${CEND} to ${CWARNING}$NEW_Redis_version${CEND}"
-      rm -rf redis-$NEW_Redis_version
+      echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_redis_ver${CEND} to ${CWARNING}$NEW_redis_ver${CEND}"
+      rm -rf redis-$NEW_redis_ver
     else
       echo "${CFAILURE}Upgrade Redis failed! ${CEND}"
     fi

+ 37 - 37
include/upgrade_web.sh

@@ -2,7 +2,7 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
@@ -69,22 +69,22 @@ Upgrade_Nginx() {
 Upgrade_Tengine() {
   pushd ${oneinstack_dir}/src > /dev/null
   [ ! -e "$tengine_install_dir/sbin/nginx" ] && echo "${CWARNING}Tengine is not installed on your system! ${CEND}" && exit 1
-  OLD_Tengine_version_tmp=`$tengine_install_dir/sbin/nginx -v 2>&1`
-  OLD_Tengine_version="`echo ${OLD_Tengine_version_tmp#*/} | awk '{print $1}'`"
-  Latest_Tengine_version=`curl -s http://tengine.taobao.org/changelog.html | grep -oE "[0-9]\.[0-9]\.[0-9]+" | head -1`
+  OLD_tengine_ver_tmp=`$tengine_install_dir/sbin/nginx -v 2>&1`
+  OLD_tengine_ver="`echo ${OLD_tengine_ver_tmp#*/} | awk '{print $1}'`"
+  Latest_tengine_ver=`curl -s http://tengine.taobao.org/changelog.html | grep -oE "[0-9]\.[0-9]\.[0-9]+" | head -1`
   echo
-  echo "Current Tengine Version: ${CMSG}$OLD_Tengine_version${CEND}"
+  echo "Current Tengine Version: ${CMSG}$OLD_tengine_ver${CEND}"
   while :; do echo
-    read -p "Please input upgrade Tengine Version(default: $Latest_Tengine_version): " NEW_Tengine_version
-    [ -z "$NEW_Tengine_version" ] && NEW_Tengine_version=$Latest_Tengine_version
-    if [ "$NEW_Tengine_version" != "$OLD_Tengine_version" ]; then
-      [ ! -e "tengine-$NEW_Tengine_version.tar.gz" ] && wget --no-check-certificate -c http://tengine.taobao.org/download/tengine-$NEW_Tengine_version.tar.gz > /dev/null 2>&1
-      if [ -e "tengine-$NEW_Tengine_version.tar.gz" ]; then
+    read -p "Please input upgrade Tengine Version(default: $Latest_tengine_ver): " NEW_tengine_ver
+    [ -z "$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
+      if [ -e "tengine-$NEW_tengine_ver.tar.gz" ]; then
         src_url=https://www.openssl.org/source/openssl-$openssl_ver.tar.gz && Download_src
         src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_ver.tar.gz && Download_src
         tar xzf openssl-$openssl_ver.tar.gz
         tar xzf pcre-$pcre_ver.tar.gz
-        echo "Download [${CMSG}tengine-$NEW_Tengine_version.tar.gz${CEND}] successfully! "
+        echo "Download [${CMSG}tengine-$NEW_tengine_ver.tar.gz${CEND}] successfully! "
         break
       else
         echo "${CWARNING}Tengine version does not exist! ${CEND}"
@@ -94,12 +94,12 @@ Upgrade_Tengine() {
     fi
   done
 
-  if [ -e "tengine-$NEW_Tengine_version.tar.gz" ]; then
-    echo "[${CMSG}tengine-$NEW_Tengine_version.tar.gz${CEND}] found"
+  if [ -e "tengine-$NEW_tengine_ver.tar.gz" ]; then
+    echo "[${CMSG}tengine-$NEW_tengine_ver.tar.gz${CEND}] found"
     echo "Press Ctrl+c to cancel or Press any key to continue..."
     char=`get_char`
-    tar xzf tengine-$NEW_Tengine_version.tar.gz
-    pushd tengine-$NEW_Tengine_version
+    tar xzf tengine-$NEW_tengine_ver.tar.gz
+    pushd tengine-$NEW_tengine_ver
     make clean
     sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc # close debug
     $tengine_install_dir/sbin/nginx -V &> $$
@@ -119,8 +119,8 @@ Upgrade_Tengine() {
       sleep 1
       kill -QUIT `cat /var/run/nginx.pid.oldbin`
       popd > /dev/null
-      echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Tengine_version${CEND} to ${CWARNING}$NEW_Tengine_version${CEND}"
-      rm -rf tengine-$NEW_Tengine_version
+      echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_tengine_ver${CEND} to ${CWARNING}$NEW_tengine_ver${CEND}"
+      rm -rf tengine-$NEW_tengine_ver
     else
       echo "${CFAILURE}Upgrade Tengine failed! ${CEND}"
     fi
@@ -131,22 +131,22 @@ Upgrade_Tengine() {
 Upgrade_OpenResty() {
   pushd ${oneinstack_dir}/src > /dev/null
   [ ! -e "$openresty_install_dir/nginx/sbin/nginx" ] && echo "${CWARNING}OpenResty is not installed on your system! ${CEND}" && exit 1
-  OLD_OpenResty_version_tmp=`$openresty_install_dir/nginx/sbin/nginx -v 2>&1`
-  OLD_OpenResty_version="`echo ${OLD_OpenResty_version_tmp#*/} | awk '{print $1}'`"
-  Latest_OpenResty_version=`curl -s https://openresty.org/en/download.html | awk '/download\/openresty-/{print $0}' |  grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | head -1`
+  OLD_openresy_ver_tmp=`$openresty_install_dir/nginx/sbin/nginx -v 2>&1`
+  OLD_openresy_ver="`echo ${OLD_openresy_ver_tmp#*/} | awk '{print $1}'`"
+  Latest_openresy_ver=`curl -s https://openresty.org/en/download.html | awk '/download\/openresty-/{print $0}' |  grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | head -1`
   echo
-  echo "Current OpenResty Version: ${CMSG}$OLD_OpenResty_version${CEND}"
+  echo "Current OpenResty Version: ${CMSG}$OLD_openresy_ver${CEND}"
   while :; do echo
-    read -p "Please input upgrade OpenResty Version(default: $Latest_OpenResty_version): " NEW_OpenResty_version
-    [ -z "$NEW_OpenResty_version" ] && NEW_OpenResty_version=$Latest_OpenResty_version
-    if [ "$NEW_OpenResty_version" != "$OLD_OpenResty_version" ]; then
-      [ ! -e "openresty-$NEW_OpenResty_version.tar.gz" ] && wget --no-check-certificate -c https://openresty.org/download/openresty-$NEW_OpenResty_version.tar.gz > /dev/null 2>&1
-      if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ]; then
+    read -p "Please input upgrade OpenResty Version(default: $Latest_openresy_ver): " NEW_openresy_ver
+    [ -z "$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
+      if [ -e "openresty-$NEW_openresy_ver.tar.gz" ]; then
         src_url=https://www.openssl.org/source/openssl-$openssl_ver.tar.gz && Download_src
         src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_ver.tar.gz && Download_src
         tar xzf openssl-$openssl_ver.tar.gz
         tar xzf pcre-$pcre_ver.tar.gz
-        echo "Download [${CMSG}openresty-$NEW_OpenResty_version.tar.gz${CEND}] successfully! "
+        echo "Download [${CMSG}openresty-$NEW_openresy_ver.tar.gz${CEND}] successfully! "
         break
       else
         echo "${CWARNING}OpenResty version does not exist! ${CEND}"
@@ -156,17 +156,17 @@ Upgrade_OpenResty() {
     fi
   done
 
-  if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ]; then
-    echo "[${CMSG}openresty-$NEW_OpenResty_version.tar.gz${CEND}] found"
+  if [ -e "openresty-$NEW_openresy_ver.tar.gz" ]; then
+    echo "[${CMSG}openresty-$NEW_openresy_ver.tar.gz${CEND}] found"
     echo "Press Ctrl+c to cancel or Press any key to continue..."
     char=`get_char`
-    tar xzf openresty-$NEW_OpenResty_version.tar.gz
-    pushd openresty-$NEW_OpenResty_version
+    tar xzf openresty-$NEW_openresy_ver.tar.gz
+    pushd openresty-$NEW_openresy_ver
     make clean
-    openresty_ver_tmp=${NEW_OpenResty_version%.*}
+    openresty_ver_tmp=${NEW_openresy_ver%.*}
     sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_ver_tmp/auto/cc/gcc # close debug
     $openresty_install_dir/nginx/sbin/nginx -V &> $$
-    ./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 
+    ./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}
     if [ -f "build/nginx-$openresty_ver_tmp/objs/nginx" ]; then
       /bin/mv $openresty_install_dir/nginx/sbin/nginx{,`date +%m%d`}
@@ -175,8 +175,8 @@ Upgrade_OpenResty() {
       sleep 1
       kill -QUIT `cat /var/run/nginx.pid.oldbin`
       popd > /dev/null
-      echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_OpenResty_version${CEND} to ${CWARNING}$NEW_OpenResty_version${CEND}"
-      rm -rf openresty-$NEW_OpenResty_version
+      echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_openresy_ver${CEND} to ${CWARNING}$NEW_openresy_ver${CEND}"
+      rm -rf openresty-$NEW_openresy_ver
     else
       echo "${CFAILURE}Upgrade OpenResty failed! ${CEND}"
     fi
@@ -186,7 +186,7 @@ Upgrade_OpenResty() {
 
 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
+  [ ! -e "${apache_install_dir}/bin/httpd" ] && echo "${CWARNING}Apache is not installed on your system! ${CEND}" && exit 1
   OLD_apache_ver="`/usr/local/apache/bin/httpd -v | grep version | awk -F'/| ' '{print $4}'`"
   Apache_flag="`echo $OLD_apache_ver | awk -F. '{print $1 $2}'`"
   Latest_apache_ver=`curl -s http://httpd.apache.org/download.cgi | awk "/#apache$Apache_flag/{print $2}" | head -1 | grep -oE "2\.[24]\.[0-9]+"`
@@ -226,7 +226,7 @@ Upgrade_Apache() {
       /bin/cp -R ../apr-util-${apr_util_ver} ./srclib/apr-util
       LDFLAGS=-ldl LD_LIBRARY_PATH=${openssl_install_dir}/lib ./configure --prefix=${apache_install_dir} --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-dav --enable-rewrite --enable-ssl --with-ssl=${openssl_install_dir} --enable-http2 --with-nghttp2=/usr/local --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all
     elif [ "$Apache_flag" == '22' ]; then
-      [ "${Ubuntu_version}" == "12" ] && sed -i '@SSL_PROTOCOL_SSLV2@d' modules/ssl/ssl_engine_io.c
+      [ "${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 --with-included-apr --enable-headers --enable-deflate --enable-so --enable-rewrite --enable-ssl--with-ssl=${openssl_install_dir} --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all
     fi
     make -j ${THREAD}

+ 2 - 2
include/xcache.sh

@@ -2,14 +2,14 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_XCache() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
   tar xzf xcache-${xcache_ver}.tar.gz
   pushd xcache-${xcache_ver}

+ 9 - 9
include/zendopcache.sh

@@ -2,23 +2,23 @@
 # Author:  yeho <lj2007331 AT gmail.com>
 # BLOG:  https://blog.linuxeye.cn
 #
-# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+# Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_ZendOPcache() {
-  pushd ${oneinstack_dir}/src
+  pushd ${oneinstack_dir}/src > /dev/null
   phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
-  PHP_detail_version=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
-  PHP_main_version=${PHP_detail_version%.*}
-  if [[ "${PHP_main_version}" =~ ^5.[3-4]$ ]]; then
+  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 xvf zendopcache-${zendopcache_ver}.tgz
     pushd zendopcache-${zendopcache_ver}
   else
-    tar xvf php-${PHP_detail_version}.tar.gz
-    pushd php-${PHP_detail_version}/ext/opcache
+    tar xvf php-${PHP_detail_ver}.tar.gz
+    pushd php-${PHP_detail_ver}/ext/opcache
   fi
 
   ${php_install_dir}/bin/phpize
@@ -27,7 +27,7 @@ Install_ZendOPcache() {
   popd
   if [ -f "${phpExtensionDir}/opcache.so" ]; then
     # write opcache configs
-    if [[ "${PHP_main_version}" =~ ^5.[3-4]$ ]]; then
+    if [[ "${PHP_main_ver}" =~ ^5.[3-4]$ ]]; then
       # For php 5.3 5.4
       cat > ${php_install_dir}/etc/php.d/ext-opcache.ini << EOF
 [opcache]
@@ -64,7 +64,7 @@ EOF
     fi
 
     echo "${CSUCCESS}PHP OPcache module installed successfully! ${CEND}"
-    rm -rf zendopcache-${zendopcache_ver} php-${PHP_detail_version}
+    rm -rf zendopcache-${zendopcache_ver} php-${PHP_detail_ver}
   else
     echo "${CFAILURE}PHP OPcache module install failed, Please contact the author! ${CEND}"
   fi

+ 169 - 165
install.sh

@@ -16,10 +16,11 @@ printf "
 #       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
+# Check if user is root
+[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
 
-# get pwd
-sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf
-
+oneinstack_dir=$(dirname "`readlink -f $0`")
+pushd ${oneinstack_dir} > /dev/null
 . ./versions.txt
 . ./options.conf
 . ./include/color.sh
@@ -28,36 +29,33 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf
 . ./include/download.sh
 . ./include/get_char.sh
 
-# Check if user is root
-[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
-
-mkdir -p $wwwroot_dir/default $wwwlogs_dir
+mkdir -p ${wwwroot_dir}/default ${wwwlogs_dir}
 [ -d /data ] && chmod 755 /data
 
 # Use default SSH port 22. If you use another SSH port on your server
 if [ -e "/etc/ssh/sshd_config" ]; then
   [ -z "`grep ^Port /etc/ssh/sshd_config`" ] && now_ssh_port=22 || now_ssh_port=`grep ^Port /etc/ssh/sshd_config | awk '{print $2}'`
   while :; do echo
-    read -p "Please input SSH port(Default: $now_ssh_port): " ssh_port
-    [ -z "$ssh_port" ] && ssh_port=$now_ssh_port
-    if [ $ssh_port -eq 22 >/dev/null 2>&1 -o $ssh_port -gt 1024 >/dev/null 2>&1 -a $ssh_port -lt 65535 >/dev/null 2>&1 ]; then
+    read -p "Please input SSH port(Default: ${now_ssh_port}): " ssh_port
+    [ -z "${ssh_port}" ] && ssh_port=${now_ssh_port}
+    if [ ${ssh_port} -eq 22 >/dev/null 2>&1 -o ${ssh_port} -gt 1024 >/dev/null 2>&1 -a ${ssh_port} -lt 65535 >/dev/null 2>&1 ]; then
       break
     else
       echo "${CWARNING}input error! Input range: 22,1025~65534${CEND}"
     fi
   done
 
-  if [ -z "`grep ^Port /etc/ssh/sshd_config`" -a "$ssh_port" != '22' ]; then
-    sed -i "s@^#Port.*@&\nPort $ssh_port@" /etc/ssh/sshd_config
+  if [ -z "`grep ^Port /etc/ssh/sshd_config`" -a "${ssh_port}" != '22' ]; then
+    sed -i "s@^#Port.*@&\nPort ${ssh_port}@" /etc/ssh/sshd_config
   elif [ -n "`grep ^Port /etc/ssh/sshd_config`" ]; then
-    sed -i "s@^Port.*@Port $ssh_port@" /etc/ssh/sshd_config
+    sed -i "s@^Port.*@Port ${ssh_port}@" /etc/ssh/sshd_config
   fi
 fi
 
 # check iptables
 while :; do echo
   read -p "Do you want to enable iptables? [y/n]: " iptables_yn
-  if [[ ! $iptables_yn =~ ^[y,n]$ ]]; then
+  if [[ ! ${iptables_yn} =~ ^[y,n]$ ]]; then
     echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
   else
     break
@@ -67,10 +65,10 @@ done
 # check Web server
 while :; do echo
   read -p "Do you want to install Web server? [y/n]: " web_yn
-  if [[ ! $web_yn =~ ^[y,n]$ ]]; then
+  if [[ ! ${web_yn} =~ ^[y,n]$ ]]; then
     echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
   else
-    if [ "$web_yn" == 'y' ]; then
+    if [ "${web_yn}" == 'y' ]; then
       # Nginx/Tegine/OpenResty
       while :; do echo
         echo 'Please select Nginx server:'
@@ -78,14 +76,14 @@ while :; do echo
         echo -e "\t${CMSG}2${CEND}. Install Tengine"
         echo -e "\t${CMSG}3${CEND}. Install OpenResty"
         echo -e "\t${CMSG}4${CEND}. Do not install"
-        read -p "Please input a number:(Default 1 press Enter) " nginx_ver
-        [ -z "$nginx_ver" ] && nginx_ver=1
-        if [[ ! $nginx_ver =~ ^[1-4]$ ]]; then
+        read -p "Please input a number:(Default 1 press Enter) " nginx_option
+        [ -z "${nginx_option}" ] && nginx_option=1
+        if [[ ! ${nginx_option} =~ ^[1-4]$ ]]; then
           echo "${CWARNING}input error! Please only input number 1~4${CEND}"
         else
-          [ "$nginx_ver" != '4' -a -e "$nginx_install_dir/sbin/nginx" ] && { echo "${CWARNING}Nginx already installed! ${CEND}"; nginx_ver=Other; }
-          [ "$nginx_ver" != '4' -a -e "$tengine_install_dir/sbin/nginx" ] && { echo "${CWARNING}Tengine already installed! ${CEND}"; nginx_ver=Other; }
-          [ "$nginx_ver" != '4' -a -e "$openresty_install_dir/nginx/sbin/nginx" ] && { echo "${CWARNING}OpenResty already installed! ${CEND}"; nginx_ver=Other; }
+          [ "${nginx_option}" != '4' -a -e "$nginx_install_dir/sbin/nginx" ] && { echo "${CWARNING}Nginx already installed! ${CEND}"; nginx_option=Other; }
+          [ "${nginx_option}" != '4' -a -e "$tengine_install_dir/sbin/nginx" ] && { echo "${CWARNING}Tengine already installed! ${CEND}"; nginx_option=Other; }
+          [ "${nginx_option}" != '4' -a -e "$openresty_install_dir/nginx/sbin/nginx" ] && { echo "${CWARNING}OpenResty already installed! ${CEND}"; nginx_option=Other; }
           break
         fi
       done
@@ -95,12 +93,12 @@ while :; do echo
         echo -e "\t${CMSG}1${CEND}. Install Apache-2.4"
         echo -e "\t${CMSG}2${CEND}. Install Apache-2.2"
         echo -e "\t${CMSG}3${CEND}. Do not install"
-        read -p "Please input a number:(Default 3 press Enter) " apache_ver
-        [ -z "$apache_ver" ] && apache_ver=3
-        if [[ ! $apache_ver =~ ^[1-3]$ ]]; then
+        read -p "Please input a number:(Default 3 press Enter) " apache_option
+        [ -z "${apache_option}" ] && apache_option=3
+        if [[ ! ${apache_option} =~ ^[1-3]$ ]]; then
           echo "${CWARNING}input error! Please only input number 1~3${CEND}"
         else
-          [ "$apache_ver" != '3' -a -e "$apache_install_dir/conf/httpd.conf" ] && { echo "${CWARNING}Aapche already installed! ${CEND}"; apache_ver=Other; }
+          [ "${apache_option}" != '3' -a -e "$apache_install_dir/conf/httpd.conf" ] && { echo "${CWARNING}Aapche already installed! ${CEND}"; apache_option=Other; }
           break
         fi
       done
@@ -111,47 +109,47 @@ while :; do echo
         echo -e "\t${CMSG}2${CEND}. Install Tomcat-7"
         echo -e "\t${CMSG}3${CEND}. Install Tomcat-6"
         echo -e "\t${CMSG}4${CEND}. Do not install"
-        read -p "Please input a number:(Default 4 press Enter) " tomcat_ver
-        [ -z "$tomcat_ver" ] && tomcat_ver=4
-        if [[ ! $tomcat_ver =~ ^[1-4]$ ]]; then
+        read -p "Please input a number:(Default 4 press Enter) " tomcat_option
+        [ -z "${tomcat_option}" ] && tomcat_option=4
+        if [[ ! ${tomcat_option} =~ ^[1-4]$ ]]; then
           echo "${CWARNING}input error! Please only input number 1~4${CEND}"
         else
-          [ "$tomcat_ver" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; tomcat_ver=Other; }
-          if [ "$tomcat_ver" == '1' ]; then
+          [ "${tomcat_option}" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; tomcat_option=Other; }
+          if [ "${tomcat_option}" == '1' ]; then
             while :; do echo
               echo 'Please select JDK version:'
               echo -e "\t${CMSG}1${CEND}. Install JDK-1.8"
               echo -e "\t${CMSG}2${CEND}. Install JDK-1.7"
-              read -p "Please input a number:(Default 2 press Enter) " jdk_version
-              [ -z "$jdk_version" ] && jdk_version=2
-              if [[ ! $jdk_version =~ ^[1-2]$ ]]; then
+              read -p "Please input a number:(Default 2 press Enter) " jdk_option
+              [ -z "${jdk_option}" ] && jdk_option=2
+              if [[ ! ${jdk_option} =~ ^[1-2]$ ]]; then
                 echo "${CWARNING}input error! Please only input number 1~2${CEND}"
               else
                 break
               fi
             done
-          elif [ "$tomcat_ver" == '2' ]; then
+          elif [ "${tomcat_option}" == '2' ]; then
             while :; do echo
               echo 'Please select JDK version:'
               echo -e "\t${CMSG}1${CEND}. Install JDK-1.8"
               echo -e "\t${CMSG}2${CEND}. Install JDK-1.7"
               echo -e "\t${CMSG}3${CEND}. Install JDK-1.6"
-              read -p "Please input a number:(Default 2 press Enter) " jdk_version
-              [ -z "$jdk_version" ] && jdk_version=2
-              if [[ ! $jdk_version =~ ^[1-3]$ ]]; then
+              read -p "Please input a number:(Default 2 press Enter) " jdk_option
+              [ -z "${jdk_option}" ] && jdk_option=2
+              if [[ ! ${jdk_option} =~ ^[1-3]$ ]]; then
                 echo "${CWARNING}input error! Please only input number 1~3${CEND}"
               else
                 break
               fi
             done
-          elif [ "$tomcat_ver" == '3' ]; then
+          elif [ "${tomcat_option}" == '3' ]; then
             while :; do echo
               echo 'Please select JDK version:'
               echo -e "\t${CMSG}2${CEND}. Install JDK-1.7"
               echo -e "\t${CMSG}3${CEND}. Install JDK-1.6"
-              read -p "Please input a number:(Default 2 press Enter) " jdk_version
-              [ -z "$jdk_version" ] && jdk_version=2
-              if [[ ! $jdk_version =~ ^[2-3]$ ]]; then
+              read -p "Please input a number:(Default 2 press Enter) " jdk_option
+              [ -z "${jdk_option}" ] && jdk_option=2
+              if [[ ! ${jdk_option} =~ ^[2-3]$ ]]; then
                 echo "${CWARNING}input error! Please only input number 2~3${CEND}"
               else
                 break
@@ -169,11 +167,10 @@ done
 # choice database
 while :; do echo
   read -p "Do you want to install Database? [y/n]: " db_yn
-  if [[ ! $db_yn =~ ^[y,n]$ ]]; then
+  if [[ ! ${db_yn} =~ ^[y,n]$ ]]; then
     echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
   else
-    if [ "$db_yn" == 'y' ]; then
-      [ -d "$db_install_dir/support-files" -a -e "${pgsql_install_dir}/bin/psql" -a -e "${mongo_install_dir}/bin/mongo" ] && { echo "${CWARNING}Database already installed! ${CEND}"; db_yn=Other; break; }
+    if [ "${db_yn}" == 'y' ]; then
       while :; do echo
         echo 'Please select a version of the Database:'
         echo -e "\t${CMSG} 1${CEND}. Install MySQL-5.7"
@@ -189,22 +186,29 @@ while :; do echo
         echo -e "\t${CMSG}11${CEND}. Install AliSQL-5.6"
         echo -e "\t${CMSG}12${CEND}. Install PostgreSQL"
         echo -e "\t${CMSG}13${CEND}. Install MongoDB"
-        read -p "Please input a number:(Default 2 press Enter) " db_ver
-        [ -z "$db_ver" ] && db_ver=2
-        [ "$db_ver" == '13' -a "$OS_BIT" == '32' ] && { echo "${CWARNING}By not supporting 32-bit! ${CEND}"; continue; }
-        if [[ "${db_ver}" =~ ^[1-9]$|^1[0-3]$ ]]; then
+        read -p "Please input a number:(Default 2 press Enter) " db_option
+        [ -z "${db_option}" ] && db_option=2
+        [ "${db_option}" == '13' -a "$OS_BIT" == '32' ] && { echo "${CWARNING}By not supporting 32-bit! ${CEND}"; continue; }
+        if [ ${db_option} -ge 1 >/dev/null 2>&1 -a ${db_option} -le 13 >/dev/null 2>&1 ]; then
+          if [ "${db_option}" == '12' ]; then
+            [ -e "${pgsql_install_dir}/bin/psql" ] && { echo "${CWARNING}PostgreSQL already installed! ${CEND}"; db_yn=Other; break; }
+          elif [ "${db_option}" == '13' ]; then
+            [ -e "${mongo_install_dir}/bin/mongo" ] && { echo "${CWARNING}MongoDB already installed! ${CEND}"; db_yn=Other; break; }
+          else
+            [ -d "${db_install_dir}/support-files" ] && { echo "${CWARNING}MySQL already installed! ${CEND}"; db_yn=Other; break; }
+          fi
           while :; do
-            if [ "$db_ver" == '12' ]; then
+            if [ "${db_option}" == '12' ]; then
               read -p "Please input the postgres password of database: " dbrootpwd
             else
               read -p "Please input the root password of database: " dbrootpwd
             fi
             [ -n "`echo $dbrootpwd | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; }
             if (( ${#dbrootpwd} >= 5 )); then
-              if [ "$db_ver" == '12' ]; then
+              if [ "${db_option}" == '12' ]; then
                 sed -i "s+^dbpostgrespwd.*+dbpostgrespwd='$dbrootpwd'+" ./options.conf
                 dbpostgrespwd="$dbrootpwd"
-              elif [ "$db_ver" == '13' ]; then
+              elif [ "${db_option}" == '13' ]; then
                 sed -i "s+^dbmongopwd.*+dbmongopwd='$dbrootpwd'+" ./options.conf
                 dbmongopwd="$dbrootpwd"
               else
@@ -217,14 +221,14 @@ while :; do echo
 
           done
           # choose install methods
-          if [[ "${db_ver}" =~ ^[1-9]$|^10$ ]]; then 
+          if [ ${db_option} -ge 1 >/dev/null 2>&1 -a ${db_option} -le 10 >/dev/null 2>&1 ]; then
             while :; do echo
               echo "Please choose installation of the database:"
               echo -e "\t${CMSG}1${CEND}. Install database from binary package."
               echo -e "\t${CMSG}2${CEND}. Install database from source package."
               read -p "Please input a number:(Default 1 press Enter) " dbinstallmethod
-              [ -z "$dbinstallmethod" ] && dbinstallmethod=1
-              if [[ ! $dbinstallmethod =~ ^[1-2]$ ]]; then
+              [ -z "${dbinstallmethod}" ] && dbinstallmethod=1
+              if [[ ! ${dbinstallmethod} =~ ^[1-2]$ ]]; then
                 echo "${CWARNING}input error! Please only input number 1~2${CEND}"
               else
                 break
@@ -244,11 +248,11 @@ done
 # check PHP
 while :; do echo
   read -p "Do you want to install PHP? [y/n]: " php_yn
-  if [[ ! $php_yn =~ ^[y,n]$ ]]; then
+  if [[ ! ${php_yn} =~ ^[y,n]$ ]]; then
     echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
   else
-    if [ "$php_yn" == 'y' ]; then
-      [ -e "$php_install_dir/bin/phpize" ] && { echo "${CWARNING}PHP already installed! ${CEND}"; php_yn=Other; break; }
+    if [ "${php_yn}" == 'y' ]; then
+      [ -e "${php_install_dir}/bin/phpize" ] && { echo "${CWARNING}PHP already installed! ${CEND}"; php_yn=Other; break; }
       while :; do echo
         echo 'Please select a version of the PHP:'
         echo -e "\t${CMSG}1${CEND}. Install php-5.3"
@@ -258,108 +262,108 @@ while :; do echo
         echo -e "\t${CMSG}5${CEND}. Install php-7.0"
         echo -e "\t${CMSG}6${CEND}. Install php-7.1"
         echo -e "\t${CMSG}7${CEND}. Install php-7.2"
-        read -p "Please input a number:(Default 5 press Enter) " php_ver
-        [ -z "$php_ver" ] && php_ver=5
-        if [[ ! $php_ver =~ ^[1-7]$ ]]; then
+        read -p "Please input a number:(Default 5 press Enter) " php_option
+        [ -z "${php_option}" ] && php_option=5
+        if [[ ! ${php_option} =~ ^[1-7]$ ]]; then
           echo "${CWARNING}input error! Please only input number 1~7${CEND}"
         else
           while :; do echo
-            read -p "Do you want to install opcode cache of the PHP? [y/n]: " php_cache_yn
-            if [[ ! $php_cache_yn =~ ^[y,n]$ ]]; then
+            read -p "Do you want to install opcode cache of the PHP? [y/n]: " phpcache_yn
+            if [[ ! ${phpcache_yn} =~ ^[y,n]$ ]]; then
                 echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
             else
-              if [ "$php_cache_yn" == 'y' ]; then
-                if [ $php_ver == 1 ]; then
+              if [ "${phpcache_yn}" == 'y' ]; then
+                if [ ${php_option} == 1 ]; then
                   while :; do
                     echo 'Please select a opcode cache of the PHP:'
                     echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
                     echo -e "\t${CMSG}2${CEND}. Install XCache"
                     echo -e "\t${CMSG}3${CEND}. Install APCU"
                     echo -e "\t${CMSG}4${CEND}. Install eAccelerator-0.9"
-                    read -p "Please input a number:(Default 1 press Enter) " php_cache
-                    [ -z "$php_cache" ] && php_cache=1
-                    if [[ ! $php_cache =~ ^[1-4]$ ]]; then
+                    read -p "Please input a number:(Default 1 press Enter) " phpcache_option
+                    [ -z "${phpcache_option}" ] && phpcache_option=1
+                    if [[ ! ${phpcache_option} =~ ^[1-4]$ ]]; then
                       echo "${CWARNING}input error! Please only input number 1~4${CEND}"
                     else
                       break
                     fi
                   done
                 fi
-                if [ $php_ver == 2 ]; then
+                if [ ${php_option} == 2 ]; then
                   while :; do
                     echo 'Please select a opcode cache of the PHP:'
                     echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
                     echo -e "\t${CMSG}2${CEND}. Install XCache"
                     echo -e "\t${CMSG}3${CEND}. Install APCU"
                     echo -e "\t${CMSG}4${CEND}. Install eAccelerator-1.0-dev"
-                    read -p "Please input a number:(Default 1 press Enter) " php_cache
-                    [ -z "$php_cache" ] && php_cache=1
-                    if [[ ! $php_cache =~ ^[1-4]$ ]]; then
+                    read -p "Please input a number:(Default 1 press Enter) " phpcache_option
+                    [ -z "${phpcache_option}" ] && phpcache_option=1
+                    if [[ ! ${phpcache_option} =~ ^[1-4]$ ]]; then
                       echo "${CWARNING}input error! Please only input number 1~4${CEND}"
                     else
                       break
                     fi
                   done
                 fi
-                if [ $php_ver == 3 ]; then
+                if [ ${php_option} == 3 ]; then
                   while :; do
                     echo 'Please select a opcode cache of the PHP:'
                     echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
                     echo -e "\t${CMSG}2${CEND}. Install XCache"
                     echo -e "\t${CMSG}3${CEND}. Install APCU"
-                    read -p "Please input a number:(Default 1 press Enter) " php_cache
-                    [ -z "$php_cache" ] && php_cache=1
-                    if [[ ! $php_cache =~ ^[1-3]$ ]]; then
+                    read -p "Please input a number:(Default 1 press Enter) " phpcache_option
+                    [ -z "${phpcache_option}" ] && phpcache_option=1
+                    if [[ ! ${phpcache_option} =~ ^[1-3]$ ]]; then
                       echo "${CWARNING}input error! Please only input number 1~3${CEND}"
                     else
                       break
                     fi
                   done
                 fi
-                if [ $php_ver == 4 ]; then
+                if [ ${php_option} == 4 ]; then
                   while :; do
                     echo 'Please select a opcode cache of the PHP:'
                     echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
                     echo -e "\t${CMSG}2${CEND}. Install XCache"
                     echo -e "\t${CMSG}3${CEND}. Install APCU"
-                    read -p "Please input a number:(Default 1 press Enter) " php_cache
-                    [ -z "$php_cache" ] && php_cache=1
-                    if [[ ! $php_cache =~ ^[1-3]$ ]]; then
+                    read -p "Please input a number:(Default 1 press Enter) " phpcache_option
+                    [ -z "${phpcache_option}" ] && phpcache_option=1
+                    if [[ ! ${phpcache_option} =~ ^[1-3]$ ]]; then
                       echo "${CWARNING}input error! Please only input number 1~3${CEND}"
                     else
                       break
                     fi
                   done
                 fi
-                if [[ $php_ver =~ ^[5-6]$ ]]; then 
+                if [[ ${php_option} =~ ^[5-6]$ ]]; then 
                   while :; do
                     echo 'Please select a opcode cache of the PHP:'
                     echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
                     echo -e "\t${CMSG}3${CEND}. Install APCU"
-                    read -p "Please input a number:(Default 1 press Enter) " php_cache
-                    [ -z "$php_cache" ] && php_cache=1
-                    if [[ ! $php_cache =~ ^[1,3]$ ]]; then
+                    read -p "Please input a number:(Default 1 press Enter) " phpcache_option
+                    [ -z "${phpcache_option}" ] && phpcache_option=1
+                    if [[ ! ${phpcache_option} =~ ^[1,3]$ ]]; then
                       echo "${CWARNING}input error! Please only input number 1,3${CEND}"
                     else
                       break
                     fi
                   done
                 fi
-                [ $php_ver == 7 ] && php_cache=1
+                [ ${php_option} == 7 ] && phpcache_option=1
               fi
               break
             fi
           done
-          if [ "$php_cache" == '2' ]; then
+          if [ "${phpcache_option}" == '2' ]; then
             while :; do
               read -p "Please input xcache admin password: " xcache_admin_pass
               (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}"
             done
           fi
-          if [[ $php_ver =~ ^[1-4]$ ]] && [ "$php_cache" != '1' -a "${armplatform}" != "y" ]; then
+          if [[ ${php_option} =~ ^[1-4]$ ]] && [ "${phpcache_option}" != '1' -a "${armplatform}" != "y" ]; then
             while :; do echo
               read -p "Do you want to install ZendGuardLoader? [y/n]: " zendguardloader_yn
-              if [[ ! $zendguardloader_yn =~ ^[y,n]$ ]]; then
+              if [[ ! ${zendguardloader_yn} =~ ^[y,n]$ ]]; then
                 echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
               else
                 break
@@ -371,7 +375,7 @@ while :; do echo
           if [ "${TARGET_ARCH}" != "arm64" ]; then
             while :; do echo
               read -p "Do you want to install ionCube? [y/n]: " ioncube_yn
-              if [[ ! $ioncube_yn =~ ^[y,n]$ ]]; then
+              if [[ ! ${ioncube_yn} =~ ^[y,n]$ ]]; then
                 echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
               else
                 break
@@ -382,21 +386,21 @@ while :; do echo
           # ImageMagick or GraphicsMagick
           while :; do echo
             read -p "Do you want to install ImageMagick or GraphicsMagick? [y/n]: " magick_yn
-            if [[ ! $magick_yn =~ ^[y,n]$ ]]; then
+            if [[ ! ${magick_yn} =~ ^[y,n]$ ]]; then
               echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
             else
               break
             fi
           done
 
-          if [ "$magick_yn" == 'y' ]; then
+          if [ "${magick_yn}" == 'y' ]; then
             while :; do
               echo 'Please select ImageMagick or GraphicsMagick:'
               echo -e "\t${CMSG}1${CEND}. Install ImageMagick"
               echo -e "\t${CMSG}2${CEND}. Install GraphicsMagick"
-              read -p "Please input a number:(Default 1 press Enter) " magick
-              [ -z "$magick" ] && magick=1
-              if [[ ! $magick =~ ^[1-2]$ ]]; then
+              read -p "Please input a number:(Default 1 press Enter) " magick_option
+              [ -z "${magick_option}" ] && magick_option=1
+              if [[ ! ${magick_option} =~ ^[1-2]$ ]]; then
                 echo "${CWARNING}input error! Please only input number 1~2${CEND}"
               else
                 break
@@ -414,22 +418,22 @@ done
 # check Pureftpd
 while :; do echo
   read -p "Do you want to install Pure-FTPd? [y/n]: " ftp_yn
-  if [[ ! $ftp_yn =~ ^[y,n]$ ]]; then
+  if [[ ! ${ftp_yn} =~ ^[y,n]$ ]]; then
     echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
   else
-    [ "$ftp_yn" == 'y' -a -e "$pureftpd_install_dir/sbin/pure-ftpwho" ] && { echo "${CWARNING}Pure-FTPd already installed! ${CEND}"; ftp_yn=Other; }
+    [ "${ftp_yn}" == 'y' -a -e "${pureftpd_install_dir}/sbin/pure-ftpwho" ] && { echo "${CWARNING}Pure-FTPd already installed! ${CEND}"; ftp_yn=Other; }
     break
   fi
 done
 
 # check phpMyAdmin
-if [[ $php_ver =~ ^[1-7]$ ]] || [ -e "$php_install_dir/bin/phpize" ]; then
+if [[ ${php_option} =~ ^[1-7]$ ]] || [ -e "${php_install_dir}/bin/phpize" ]; then
   while :; do echo
     read -p "Do you want to install phpMyAdmin? [y/n]: " phpmyadmin_yn
-    if [[ ! $phpmyadmin_yn =~ ^[y,n]$ ]]; then
+    if [[ ! ${phpmyadmin_yn} =~ ^[y,n]$ ]]; then
       echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
     else
-      [ "$phpmyadmin_yn" == 'y' -a -d "$wwwroot_dir/default/phpMyAdmin" ] && { echo "${CWARNING}phpMyAdmin already installed! ${CEND}"; phpmyadmin_yn=Other; }
+      [ "${phpmyadmin_yn}" == 'y' -a -d "${wwwroot_dir}/default/phpMyAdmin" ] && { echo "${CWARNING}phpMyAdmin already installed! ${CEND}"; phpmyadmin_yn=Other; }
       break
     fi
   done
@@ -438,7 +442,7 @@ fi
 # check redis
 while :; do echo
   read -p "Do you want to install redis? [y/n]: " redis_yn
-  if [[ ! $redis_yn =~ ^[y,n]$ ]]; then
+  if [[ ! ${redis_yn} =~ ^[y,n]$ ]]; then
     echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
   else
     break
@@ -448,7 +452,7 @@ done
 # check memcached
 while :; do echo
   read -p "Do you want to install memcached? [y/n]: " memcached_yn
-  if [[ ! $memcached_yn =~ ^[y,n]$ ]]; then
+  if [[ ! ${memcached_yn} =~ ^[y,n]$ ]]; then
     echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
   else
     break
@@ -457,10 +461,10 @@ done
 
 while :; do echo
   read -p "Do you want to install HHVM? [y/n]: " hhvm_yn
-  if [[ ! $hhvm_yn =~ ^[y,n]$ ]]; then
+  if [[ ! ${hhvm_yn} =~ ^[y,n]$ ]]; then
     echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
   else
-    if [ "$hhvm_yn" == 'y' ]; then
+    if [ "${hhvm_yn}" == 'y' ]; then
       [ -e "/usr/bin/hhvm" ] && { echo "${CWARNING}HHVM already installed! ${CEND}"; hhvm_yn=Other; break; }
       if [ "$OS" == 'CentOS' -a "$OS_BIT" == '64' ] && [ -n "`grep -E ' 7\.| 6\.[5-9]' /etc/redhat-release`" ]; then
         break
@@ -482,6 +486,11 @@ PUBLIC_IPADDR=`./include/get_public_ipaddr.py`
 IPADDR_COUNTRY_ISP=`./include/get_ipaddr_state.py $PUBLIC_IPADDR`
 IPADDR_COUNTRY=`echo $IPADDR_COUNTRY_ISP | awk '{print $1}'`
 
+# Check download source packages
+. ./include/check_download.sh
+downloadDepsSrc=1
+checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log
+
 # del openssl for jcloud
 [ -e "/usr/local/bin/openssl" ] && rm -rf /usr/local/bin/openssl
 [ -e "/usr/local/include/openssl" ] && rm -rf /usr/local/include/openssl
@@ -516,28 +525,23 @@ case "${OS}" in
     ;;
 esac
 
-# Check download source packages
-. ./include/check_download.sh
-downloadDepsSrc=1
-checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log
-
 # Install dependencies from source package
 installDepsBySrc 2>&1 | tee -a ${oneinstack_dir}/install.log
 
 # Jemalloc
-if [[ $nginx_ver =~ ^[1-3]$ ]] || [ "$db_yn" == 'y' ]; then
+if [[ ${nginx_option} =~ ^[1-3]$ ]] || [ "${db_yn}" == 'y' ]; then
   . include/jemalloc.sh
-  Install_Jemalloc | tee -a $oneinstack_dir/install.log
+  Install_Jemalloc | tee -a ${oneinstack_dir}/install.log
 fi
 
 # openSSL 
 . ./include/openssl.sh
-if [[ $tomcat_ver =~ ^[1-3]$ ]] || [[ $apache_ver =~ ^[1-2]$ ]] || [[ $php_ver =~ ^[1-7]$ ]]; then
-  Install_openSSL102 | tee -a $oneinstack_dir/install.log
+if [[ ${tomcat_option} =~ ^[1-3]$ ]] || [[ ${apache_option} =~ ^[1-2]$ ]] || [[ ${php_option} =~ ^[1-7]$ ]]; then
+  Install_openSSL102 | tee -a ${oneinstack_dir}/install.log
 fi
 
 # Database
-case "${db_ver}" in
+case "${db_option}" in
   1)
     if [ "${dbinstallmethod}" == "2" ]; then
       . include/boost.sh
@@ -596,29 +600,29 @@ case "${db_ver}" in
     ;;
   11)
     . include/alisql-5.6.sh
-    Install_AliSQL56 2>&1 | tee -a $oneinstack_dir/install.log
+    Install_AliSQL56 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
   12)
     . include/postgresql.sh
-    Install_PostgreSQL 2>&1 | tee -a $oneinstack_dir/install.log
+    Install_PostgreSQL 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
   13)
     . include/mongodb.sh
-    Install_MongoDB 2>&1 | tee -a $oneinstack_dir/install.log
+    Install_MongoDB 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
 esac
 
 # Apache
-if [ "$apache_ver" == '1' ]; then
+if [ "${apache_option}" == '1' ]; then
   . include/apache-2.4.sh
-  Install_Apache24 2>&1 | tee -a $oneinstack_dir/install.log
-elif [ "$apache_ver" == '2' ]; then
+  Install_Apache24 2>&1 | tee -a ${oneinstack_dir}/install.log
+elif [ "${apache_option}" == '2' ]; then
   . include/apache-2.2.sh
-  Install_Apache22 2>&1 | tee -a $oneinstack_dir/install.log
+  Install_Apache22 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 
 # PHP
-case "${php_ver}" in
+case "${php_option}" in
   1)
     . include/php-5.3.sh
     Install_PHP53 2>&1 | tee -a ${oneinstack_dir}/install.log
@@ -650,38 +654,38 @@ case "${php_ver}" in
 esac
 
 # pecl_pgsql
-if [ "${db_ver}" == '12' -a -e "${php_install_dir}/bin/phpize" ]; then
+if [ "${db_option}" == '12' -a -e "${php_install_dir}/bin/phpize" ]; then
   . include/pecl_pgsql.sh
-  Install_pecl-pgsql 2>&1 | tee -a $oneinstack_dir/install.log
+  Install_pecl-pgsql 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 
 # pecl_mongodb
-if [ "${db_ver}" == '13' -a -e "${php_install_dir}/bin/phpize" ]; then
+if [ "${db_option}" == '13' -a -e "${php_install_dir}/bin/phpize" ]; then
   . include/pecl_mongodb.sh
-  Install_pecl-mongodb 2>&1 | tee -a $oneinstack_dir/install.log
+  Install_pecl-mongodb 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 
 # ImageMagick or GraphicsMagick
-if [ "$magick" == '1' ]; then
+if [ "${magick_option}" == '1' ]; then
   . include/ImageMagick.sh
-  [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick 2>&1 | tee -a $oneinstack_dir/install.log
-  [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/imagick.so" ] && Install_php-imagick 2>&1 | tee -a $oneinstack_dir/install.log
-elif [ "$magick" == '2' ]; then
+  [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick 2>&1 | tee -a ${oneinstack_dir}/install.log
+  [ ! -e "`${php_install_dir}/bin/php-config --extension-dir`/imagick.so" ] && Install_php-imagick 2>&1 | tee -a ${oneinstack_dir}/install.log
+elif [ "${magick_option}" == '2' ]; then
   . include/GraphicsMagick.sh
-  [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick 2>&1 | tee -a $oneinstack_dir/install.log
-  [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/gmagick.so" ] && Install_php-gmagick 2>&1 | tee -a $oneinstack_dir/install.log
+  [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick 2>&1 | tee -a ${oneinstack_dir}/install.log
+  [ ! -e "`${php_install_dir}/bin/php-config --extension-dir`/gmagick.so" ] && Install_php-gmagick 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 
 # ionCube
-if [ "$ioncube_yn" == 'y' ]; then
+if [ "${ioncube_yn}" == 'y' ]; then
   . include/ioncube.sh
-  Install_ionCube 2>&1 | tee -a $oneinstack_dir/install.log
+  Install_ionCube 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 
 # PHP opcode cache
-case "${php_cache}" in
+case "${phpcache_option}" in
   1)
-    if [[ "${php_ver}" =~ ^[1,2]$ ]]; then
+    if [[ "${php_option}" =~ ^[1,2]$ ]]; then
       . include/zendopcache.sh
       Install_ZendOPcache 2>&1 | tee -a ${oneinstack_dir}/install.log
     fi
@@ -695,7 +699,7 @@ case "${php_cache}" in
     Install_APCU 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
   4)
-    if [[ "${php_ver}" =~ ^[1,2]$ ]]; then
+    if [[ "${php_option}" =~ ^[1,2]$ ]]; then
       . include/eaccelerator.sh
       Install_eAccelerator 2>&1 | tee -a ${oneinstack_dir}/install.log
     fi
@@ -703,13 +707,13 @@ case "${php_cache}" in
 esac
 
 # ZendGuardLoader (php <= 5.6)
-if [ "$zendguardloader_yn" == 'y' ]; then
+if [ "${zendguardloader_yn}" == 'y' ]; then
   . include/ZendGuardLoader.sh
-  Install_ZendGuardLoader 2>&1 | tee -a $oneinstack_dir/install.log
+  Install_ZendGuardLoader 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 
 # Web server
-case "${nginx_ver}" in
+case "${nginx_option}" in
   1)
     . include/nginx.sh
     Install_Nginx 2>&1 | tee -a ${oneinstack_dir}/install.log
@@ -725,7 +729,7 @@ case "${nginx_ver}" in
 esac
 
 # JDK
-case "${jdk_version}" in
+case "${jdk_option}" in
   1)
     . include/jdk-1.8.sh
     Install-JDK18 2>&1 | tee -a ${oneinstack_dir}/install.log
@@ -740,7 +744,7 @@ case "${jdk_version}" in
     ;;
 esac
 
-case "${tomcat_ver}" in
+case "${tomcat_option}" in
   1)
     . include/tomcat-8.sh
     Install_Tomcat8 2>&1 | tee -a ${oneinstack_dir}/install.log
@@ -804,31 +808,31 @@ endTime=`date +%s`
 ((installTime=($endTime-$startTime)/60))
 echo "####################Congratulations########################"
 echo "Total OneinStack Install Time: ${CQUESTION}${installTime}${CEND} minutes"
-[ "${web_yn}" == 'y' -a "${nginx_ver}" != '4' -a "${apache_ver}" == '3' ] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}"
-[ "${web_yn}" == 'y' -a "${nginx_ver}" != '4' -a "${apache_ver}" != '3' ] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}\n$(printf "%-32s" "Apache install  dir":)${CMSG}${apache_install_dir}${CEND}"
-[ "${web_yn}" == 'y' -a "${nginx_ver}" == '4' -a "${apache_ver}" != '3' ] && echo -e "\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}"
-[[ "${tomcat_ver}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Tomcat install dir":)${CMSG}${tomcat_install_dir}${CEND}"
-[[ "${db_ver}" =~ ^[1-9]$|^1[0-1]$ ]] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}"
-[[ "${db_ver}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}"
-[[ "${db_ver}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}"
-[[ "${db_ver}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}"
-[ "${db_ver}" == '12' ] && echo -e "\n$(printf "%-32s" "PostgreSQL install dir:")${CMSG}${pgsql_install_dir}${CEND}"
-[ "${db_ver}" == '12' ] && echo "$(printf "%-32s" "PostgreSQL data dir:")${CMSG}${pgsql_data_dir}${CEND}"
-[ "${db_ver}" == '12' ] && echo "$(printf "%-32s" "PostgreSQL user:")${CMSG}postgres${CEND}"
-[ "${db_ver}" == '12' ] && echo "$(printf "%-32s" "postgres password:")${CMSG}${dbpostgrespwd}${CEND}"
-[ "${db_ver}" == '13' ] && echo -e "\n$(printf "%-32s" "MongoDB install dir:")${CMSG}${mongo_install_dir}${CEND}"
-[ "${db_ver}" == '13' ] && echo "$(printf "%-32s" "MongoDB data dir:")${CMSG}${mongo_data_dir}${CEND}"
-[ "${db_ver}" == '13' ] && echo "$(printf "%-32s" "MongoDB user:")${CMSG}root${CEND}"
-[ "${db_ver}" == '13' ] && echo "$(printf "%-32s" "MongoDB password:")${CMSG}${dbmongopwd}${CEND}"
+[ "${web_yn}" == 'y' -a "${nginx_option}" != '4' -a "${apache_option}" == '3' ] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}"
+[ "${web_yn}" == 'y' -a "${nginx_option}" != '4' -a "${apache_option}" != '3' ] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}\n$(printf "%-32s" "Apache install  dir":)${CMSG}${apache_install_dir}${CEND}"
+[ "${web_yn}" == 'y' -a "${nginx_option}" == '4' -a "${apache_option}" != '3' ] && echo -e "\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}"
+[[ "${tomcat_option}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Tomcat install dir":)${CMSG}${tomcat_install_dir}${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}"
+[ "${db_option}" == '12' ] && echo -e "\n$(printf "%-32s" "PostgreSQL install dir:")${CMSG}${pgsql_install_dir}${CEND}"
+[ "${db_option}" == '12' ] && echo "$(printf "%-32s" "PostgreSQL data dir:")${CMSG}${pgsql_data_dir}${CEND}"
+[ "${db_option}" == '12' ] && echo "$(printf "%-32s" "PostgreSQL user:")${CMSG}postgres${CEND}"
+[ "${db_option}" == '12' ] && echo "$(printf "%-32s" "postgres password:")${CMSG}${dbpostgrespwd}${CEND}"
+[ "${db_option}" == '13' ] && echo -e "\n$(printf "%-32s" "MongoDB install dir:")${CMSG}${mongo_install_dir}${CEND}"
+[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "MongoDB data dir:")${CMSG}${mongo_data_dir}${CEND}"
+[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "MongoDB user:")${CMSG}root${CEND}"
+[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "MongoDB password:")${CMSG}${dbmongopwd}${CEND}"
 [ "${php_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "PHP install dir:")${CMSG}${php_install_dir}${CEND}"
-[ "${php_cache}" == '1' ] && echo "$(printf "%-32s" "Opcache Control Panel URL:")${CMSG}http://${IPADDR}/ocp.php${CEND}"
-[ "${php_cache}" == '2' ] && echo "$(printf "%-32s" "xcache Control Panel URL:")${CMSG}http://${IPADDR}/xcache${CEND}"
-[ "${php_cache}" == '2' ] && echo "$(printf "%-32s" "xcache user:")${CMSG}admin${CEND}"
-[ "${php_cache}" == '2' ] && echo "$(printf "%-32s" "xcache password:")${CMSG}${xcache_admin_pass}${CEND}"
-[ "${php_cache}" == '3' ] && echo "$(printf "%-32s" "APC Control Panel URL:")${CMSG}http://${IPADDR}/apc.php${CEND}"
-[ "${php_cache}" == '4' ] && echo "$(printf "%-32s" "eAccelerator Control Panel URL:")${CMSG}http://${IPADDR}/control.php${CEND}"
-[ "${php_cache}" == '4' ] && echo "$(printf "%-32s" "eAccelerator user:")${CMSG}admin${CEND}"
-[ "${php_cache}" == '4' ] && echo "$(printf "%-32s" "eAccelerator password:")${CMSG}eAccelerator${CEND}"
+[ "${phpcache_option}" == '1' ] && echo "$(printf "%-32s" "Opcache Control Panel URL:")${CMSG}http://${IPADDR}/ocp.php${CEND}"
+[ "${phpcache_option}" == '2' ] && echo "$(printf "%-32s" "xcache Control Panel URL:")${CMSG}http://${IPADDR}/xcache${CEND}"
+[ "${phpcache_option}" == '2' ] && echo "$(printf "%-32s" "xcache user:")${CMSG}admin${CEND}"
+[ "${phpcache_option}" == '2' ] && echo "$(printf "%-32s" "xcache password:")${CMSG}${xcache_admin_pass}${CEND}"
+[ "${phpcache_option}" == '3' ] && echo "$(printf "%-32s" "APC Control Panel URL:")${CMSG}http://${IPADDR}/apc.php${CEND}"
+[ "${phpcache_option}" == '4' ] && echo "$(printf "%-32s" "eAccelerator Control Panel URL:")${CMSG}http://${IPADDR}/control.php${CEND}"
+[ "${phpcache_option}" == '4' ] && echo "$(printf "%-32s" "eAccelerator user:")${CMSG}admin${CEND}"
+[ "${phpcache_option}" == '4' ] && echo "$(printf "%-32s" "eAccelerator password:")${CMSG}eAccelerator${CEND}"
 [ "${ftp_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "Pure-FTPd install dir:")${CMSG}${pureftpd_install_dir}${CEND}"
 [ "${ftp_yn}" == 'y' ] && echo "$(printf "%-32s" "Create FTP virtual script:")${CMSG}./pureftpd_vhost.sh${CEND}"
 [ "${phpmyadmin_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "phpMyAdmin dir:")${CMSG}${wwwroot_dir}/default/phpMyAdmin${CEND}"

+ 0 - 3
options.conf

@@ -1,6 +1,3 @@
-# operating environment for the current working directory
-oneinstack_dir=
-
 # Nginx Apache and PHP-FPM process is run as $run_user(Default "www"), you can freely specify
 run_user=www
 

+ 12 - 11
pureftpd_vhost.sh

@@ -17,20 +17,21 @@ printf "
 #       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
+# Check if user is root
+[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
 
+oneinstack_dir=$(dirname "`readlink -f $0`")
+pushd ${oneinstack_dir} > /dev/null
 . ./options.conf
 . ./include/color.sh
 
-# Check if user is root
-[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
-
-[ ! -d "$pureftpd_install_dir" ] && { echo "${CFAILURE}FTP server does not exist! ${CEND}"; exit 1; }
+[ ! -d "${pureftpd_install_dir}" ] && { echo "${CFAILURE}FTP server does not exist! ${CEND}"; exit 1; }
 
-FTP_conf=$pureftpd_install_dir/etc/pure-ftpd.conf
-FTP_tmp_passfile=$pureftpd_install_dir/etc/pureftpd_psss.tmp
-Puredbfile=$pureftpd_install_dir/etc/pureftpd.pdb
-Passwdfile=$pureftpd_install_dir/etc/pureftpd.passwd
-FTP_bin=$pureftpd_install_dir/bin/pure-pw
+FTP_conf=${pureftpd_install_dir}/etc/pure-ftpd.conf
+FTP_tmp_passfile=${pureftpd_install_dir}/etc/pureftpd_psss.tmp
+Puredbfile=${pureftpd_install_dir}/etc/pureftpd.pdb
+Passwdfile=${pureftpd_install_dir}/etc/pureftpd.passwd
+FTP_bin=${pureftpd_install_dir}/bin/pure-pw
 [ -z "`grep ^PureDB $FTP_conf`" ] && { echo "${CFAILURE}pure-ftpd is not own password database${CEND}" ; exit 1; }
 
 USER() {
@@ -59,9 +60,9 @@ done
 
 DIRECTORY() {
 while :; do echo
-  read -p "Please input the directory(Default directory: $wwwroot_dir): " Directory
+  read -p "Please input the directory(Default directory: ${wwwroot_dir}): " Directory
   if [ -z "$Directory" ]; then
-    Directory="$wwwroot_dir"
+    Directory="${wwwroot_dir}"
   fi
   if [ ! -d "$Directory" ]; then
     echo "${CWARNING}The directory does not exist${CEND}"

+ 5 - 6
reset_db_root_password.sh

@@ -17,15 +17,14 @@ printf "
 #       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
-
-OIS_FOLDER=$(dirname "`readlink -f $0`")
-pushd $OIS_FOLDER > /dev/null
+oneinstack_dir=$(dirname "`readlink -f $0`")
+pushd ${oneinstack_dir} > /dev/null
 . ./options.conf
 . ./include/color.sh
 . ./include/check_dir.sh
 
 Input_db_root_password() {
-  [ ! -d "$db_install_dir" ] && { echo "${CFAILURE}Database is not installed on your system! ${CEND}"; exit 1; }
+  [ ! -d "${db_install_dir}" ] && { echo "${CFAILURE}Database is not installed on your system! ${CEND}"; exit 1; }
   while :; do echo
     read -p "Please input the root password of database: " New_dbrootpwd
     [ -n "`echo $New_dbrootpwd | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and &${CEND}"; continue; }
@@ -34,9 +33,9 @@ Input_db_root_password() {
 }
   
 Reset_db_root_password() {
-  $db_install_dir/bin/mysqladmin -uroot -p"$dbrootpwd" password "$New_dbrootpwd" -h localhost > /dev/null 2>&1
+  ${db_install_dir}/bin/mysqladmin -uroot -p"$dbrootpwd" password "$New_dbrootpwd" -h localhost > /dev/null 2>&1
   status_Localhost=`echo $?`
-  $db_install_dir/bin/mysqladmin -uroot -p"$dbrootpwd" password "$New_dbrootpwd" -h 127.0.0.1 > /dev/null 2>&1
+  ${db_install_dir}/bin/mysqladmin -uroot -p"$dbrootpwd" password "$New_dbrootpwd" -h 127.0.0.1 > /dev/null 2>&1
   status_127=`echo $?`
   if [ $status_Localhost == '0' -a $status_127 == '0' ]; then
     sed -i "s+^dbrootpwd.*+dbrootpwd='$New_dbrootpwd'+" ./options.conf

+ 21 - 23
ss.sh

@@ -18,11 +18,11 @@ printf "
 #       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
+# Check if user is root
+[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
 
-# get pwd
-sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf
-
-pushd src > /dev/null
+oneinstack_dir=$(dirname "`readlink -f $0`")
+pushd ${oneinstack_dir}/src > /dev/null
 . ../options.conf
 . ../versions.txt
 . ../include/color.sh
@@ -30,16 +30,13 @@ pushd src > /dev/null
 . ../include/download.sh
 . ../include/python.sh
 
-# Check if user is root
-[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
-
 PUBLIC_IPADDR=$(../include/get_public_ipaddr.py)
 
-[ "${CentOS_RHEL_version}" == '5' ] && { echo "${CWARNING}SS only support CentOS6,7 or Debian or Ubuntu! ${CEND}"; exit 1; }
+[ "${CentOS_RHEL_ver}" == '5' ] && { echo "${CWARNING}SS only support CentOS6,7 or Debian or Ubuntu! ${CEND}"; exit 1; }
 
 Check_SS() {
-  [ -f /usr/local/bin/ss-server ] && SS_version=1
-  [ -f ${python_install_dir}/bin/ssserver ] && SS_version=2
+  [ -f /usr/local/bin/ss-server ] && ss_option=1
+  [ -f ${python_install_dir}/bin/ssserver ] && ss_option=2
 }
 
 AddUser_SS() {
@@ -94,9 +91,9 @@ Def_parameter() {
     echo "Please select SS server version:"
     echo -e "\t${CMSG}1${CEND}. Install SS-libev"
     echo -e "\t${CMSG}2${CEND}. Install SS-python"
-    read -p "Please input a number:(Default 1 press Enter) " SS_version
-    [ -z "${SS_version}" ] && SS_version=1
-    if [[ ! "${SS_version}" =~ ^[1-2]$ ]]; then
+    read -p "Please input a number:(Default 1 press Enter) " ss_option
+    [ -z "${ss_option}" ] && ss_option=1
+    if [[ ! "${ss_option}" =~ ^[1-2]$ ]]; then
       echo "${CWARNING}input error! Please only input number 1~2${CEND}"
     else
       break
@@ -140,19 +137,20 @@ Install_SS-python() {
 Install_SS-libev() {
   src_url=http://mirrors.linuxeye.com/oneinstack/src/shadowsocks-libev-3.1.3.tar.gz && Download_src
   src_url=http://mirrors.linuxeye.com/oneinstack/src/libsodium-1.0.16.tar.gz && Download_src
-  src_url=http://mirrors.linuxeye.com/oneinstack/src/mbedtls-2.7.1.tgz && Download_src
+  src_url=http://mirrors.linuxeye.com/oneinstack/src/mbedtls-2.7.0-apache.tgz && Download_src
   tar xzf shadowsocks-libev-3.1.3.tar.gz
   tar xzf libsodium-1.0.16.tar.gz
-  tar xzf mbedtls-2.7.1.tgz 
+  tar xzf mbedtls-2.7.0-apache.tgz 
   pushd libsodium-1.0.16
   ./configure
   make -j ${THREAD} && make install
   popd
-  pushd mbedtls-2.7.1
+  pushd mbedtls-2.7.0
   make SHARED=1 CFLAGS=-fPIC
   make DESTDIR=/usr install
   popd
   pushd shadowsocks-libev-3.1.3
+  make clean
   ./configure
   make -j ${THREAD} && make install
   popd
@@ -189,7 +187,7 @@ Uninstall_SS() {
     [ "${OS}" == "CentOS" ] && chkconfig --del shadowsocks
     [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d -f shadowsocks remove
     rm -rf /etc/shadowsocks /var/run/shadowsocks.pid /etc/init.d/shadowsocks
-    if [ "${SS_version}" == '1' ]; then
+    if [ "${ss_option}" == '1' ]; then
       rm -f /usr/local/bin/{ss-local,ss-tunnel,ss-server,ss-manager,ss-redir}
       rm -f /usr/local/lib/libshadowsocks.*
       rm -f /usr/local/include/shadowsocks.h
@@ -200,7 +198,7 @@ Uninstall_SS() {
       else
         echo "${CFAILURE}SS-libev uninstall failed! ${CEND}"
       fi
-    elif [ "${SS_version}" == '2' ]; then
+    elif [ "${ss_option}" == '2' ]; then
       ${python_install_dir}/bin/pip uninstall -y shadowsocks
       if [ $? -eq 0 ]; then
         echo "${CSUCCESS}SS-python uninstall successful! ${CEND}"
@@ -213,7 +211,7 @@ Uninstall_SS() {
 
 Config_SS() {
   [ ! -d "/etc/shadowsocks" ] && mkdir /etc/shadowsocks
-  [ "${SS_version}" == '1' ] && cat > /etc/shadowsocks/config.json << EOF
+  [ "${ss_option}" == '1' ] && cat > /etc/shadowsocks/config.json << EOF
 {
     "server":"0.0.0.0",
     "server_port":${SS_port},
@@ -225,7 +223,7 @@ Config_SS() {
 }
 EOF
 
-  [ "${SS_version}" == '2' ] && cat > /etc/shadowsocks/config.json << EOF
+  [ "${ss_option}" == '2' ] && cat > /etc/shadowsocks/config.json << EOF
 {
     "server":"0.0.0.0",
     "local_address":"127.0.0.1",
@@ -259,15 +257,15 @@ Your Encryption Method: ${CMSG}aes-256-cfb${CEND}
 case "$1" in
 install)
   Def_parameter
-  [ "${SS_version}" == '1' ] && Install_SS-libev
-  [ "${SS_version}" == '2' ] && Install_SS-python
+  [ "${ss_option}" == '1' ] && Install_SS-libev
+  [ "${ss_option}" == '2' ] && Install_SS-python
   Config_SS
   service shadowsocks start
   Print_User_SS
   ;;
 adduser)
   Check_SS
-  if [ "${SS_version}" == '2' ]; then
+  if [ "${ss_option}" == '2' ]; then
     AddUser_SS
     Iptables_set
     AddUser_Config_SS

+ 8 - 8
tools/db_bk.sh

@@ -12,14 +12,14 @@
 . ../include/check_dir.sh
 
 DBname=$1
-LogFile=$backup_dir/db.log
-DumpFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d_%H).sql
-NewFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d_%H).tgz
-OldFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d --date="$expired_days days ago")*.tgz
+LogFile=${backup_dir}/db.log
+DumpFile=${backup_dir}/DB_${DBname}_$(date +%Y%m%d_%H).sql
+NewFile=${backup_dir}/DB_${DBname}_$(date +%Y%m%d_%H).tgz
+OldFile=${backup_dir}/DB_${DBname}_$(date +%Y%m%d --date="$expired_days days ago")*.tgz
 
-[ ! -e "$backup_dir" ] && mkdir -p $backup_dir
+[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}
 
-DB_tmp=`$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep $DBname`
+DB_tmp=`${db_install_dir}/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep $DBname`
 [ -z "$DB_tmp" ] && { echo "[$DBname] not exist" >> $LogFile ;  exit 1 ; }
 
 if [ -n "`ls $OldFile 2>/dev/null`" ]; then
@@ -32,8 +32,8 @@ fi
 if [ -e "$NewFile" ]; then
   echo "[$NewFile] The Backup File is exists, Can't Backup" >> $LogFile
 else
-  $db_install_dir/bin/mysqldump -uroot -p$dbrootpwd --databases $DBname > $DumpFile
-  cd $backup_dir
+  ${db_install_dir}/bin/mysqldump -uroot -p$dbrootpwd --databases $DBname > $DumpFile
+  cd ${backup_dir}
   tar czf $NewFile ${DumpFile##*/} >> $LogFile 2>&1
   echo "[$NewFile] Backup success ">> $LogFile
   /bin/rm -f $DumpFile

+ 2 - 2
tools/mabs.sh

@@ -26,7 +26,7 @@ ignore_init() {
   fi
 }
 
-show_version() {
+show_ver() {
   echo "version: 1.0"
   echo "updated date: 2014-06-08"
 }
@@ -63,7 +63,7 @@ while :; do
       show_usage; exit 0
       ;;
     -v|-V|--version)
-      show_version; exit 0
+      show_ver; exit 0
       ;;
     -l|--iplist)
       IPLIST=$2; shift 2

+ 5 - 5
tools/website_bk.sh

@@ -11,10 +11,10 @@
 . ../options.conf
 
 WebSite=$1
-LogFile=$backup_dir/web.log
-NewFile=$backup_dir/Web_${WebSite}_$(date +%Y%m%d_%H).tgz
-OldFile=$backup_dir/Web_${WebSite}_$(date +%Y%m%d --date="$expired_days days ago")*.tgz
-[ ! -e "$backup_dir" ] && mkdir -p $backup_dir
+LogFile=${backup_dir}/web.log
+NewFile=${backup_dir}/Web_${WebSite}_$(date +%Y%m%d_%H).tgz
+OldFile=${backup_dir}/Web_${WebSite}_$(date +%Y%m%d --date="$expired_days days ago")*.tgz
+[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}
 [ ! -e "$wwwroot_dir/$WebSite" ] && { echo "[$wwwroot_dir/$WebSite] not exist" >> $LogFile ;  exit 1 ; }
 
 if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ]; then
@@ -34,5 +34,5 @@ if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ]; then
     popd > /dev/null
   fi
 else
-  rsync -crazP --delete $wwwroot_dir/$WebSite $backup_dir
+  rsync -crazP --delete $wwwroot_dir/$WebSite ${backup_dir}
 fi

+ 6 - 6
uninstall.sh

@@ -17,16 +17,16 @@ printf "
 #       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
+# Check if user is root
+[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
 
+oneinstack_dir=$(dirname "`readlink -f $0`")
+pushd ${oneinstack_dir} > /dev/null
 . ./options.conf
 . ./include/color.sh
 . ./include/get_char.sh
 . ./include/check_dir.sh
 
-# Check if user is root
-[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
-
-
 Usage(){
   printf "
 Usage: $0 [  ${CMSG}all${CEND} | ${CMSG}web${CEND} | ${CMSG}mysql${CEND} | ${CMSG}postgresql${CEND} | ${CMSG}mongodb${CEND} | ${CMSG}php${CEND} | ${CMSG}hhvm${CEND} | ${CMSG}pureftpd${CEND} | ${CMSG}redis${CEND} | ${CMSG}memcached${CEND} ]
@@ -185,12 +185,12 @@ Uninstall_HHVM() {
 }
 
 Print_PureFtpd() {
-  [ -e "$pureftpd_install_dir" ] && echo "$pureftpd_install_dir"
+  [ -e "${pureftpd_install_dir}" ] && echo "${pureftpd_install_dir}"
   [ -e "/etc/init.d/pureftpd" ] && echo "/etc/init.d/pureftpd"
 }
 
 Uninstall_PureFtpd() {
-  [ -e "$pureftpd_install_dir" ] && { service pureftpd stop > /dev/null 2>&1; rm -rf $pureftpd_install_dir /etc/init.d/pureftpd; }
+  [ -e "${pureftpd_install_dir}" ] && { service pureftpd stop > /dev/null 2>&1; rm -rf ${pureftpd_install_dir} /etc/init.d/pureftpd; }
   echo "${CMSG}Pureftpd uninstall completed${CEND}"
 }
 

+ 4 - 5
upgrade.sh

@@ -17,9 +17,11 @@ printf "
 #       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
-# get pwd
-sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf
+# Check if user is root
+[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
 
+oneinstack_dir=$(dirname "`readlink -f $0`")
+pushd ${oneinstack_dir} > /dev/null
 . ./versions.txt
 . ./options.conf
 . ./include/color.sh
@@ -35,9 +37,6 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf
 . ./include/upgrade_phpmyadmin.sh
 . ./include/upgrade_oneinstack.sh
 
-# Check if user is root
-[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
-
 # get the IP information
 PUBLIC_IPADDR=`./include/get_public_ipaddr.py`
 IPADDR_COUNTRY=`./include/get_ipaddr_state.py $PUBLIC_IPADDR | awk '{print $1}'`

+ 6 - 6
versions.txt

@@ -1,4 +1,4 @@
-# newest software ver
+# newest software version
 # Web
 nginx_ver=1.12.2
 tengine_ver=2.2.2
@@ -58,15 +58,15 @@ mhash_ver=0.9.9.9
 imagemagick_ver=6.9.9-37
 imagick_ver=3.4.3
 graphicsmagick_ver=1.3.28
-gmagick_for_php7_version=2.0.5RC1
-gmagick_version=1.1.7RC3
+gmagick_for_php7_ver=2.0.5RC1
+gmagick_ver=1.1.7RC3
 zendopcache_ver=7.0.5
 xcache_ver=3.2.0
 apcu_ver=4.0.11
 apcu_for_php7_ver=5.1.10
 eaccelerator_ver=0.9.6.1
-swoole_ver=2.1.0
-xdebug_ver=2.5.5
+swoole_ver=2.1.1
+xdebug_ver=2.6.0
 
 # Ftp
 pureftpd_ver=1.0.47
@@ -83,7 +83,7 @@ memcached_pecl_php7_ver=3.0.4
 memcache_pecl_ver=3.0.8
 
 # MongoDB
-mongodb_pecl_ver=1.4.0
+mongodb_pecl_ver=1.4.2
 mongo_pecl_ver=1.6.16
 
 # phpMyadmin

+ 4 - 3
vhost.sh

@@ -16,16 +16,17 @@ printf "
 #       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
+# Check if user is root
+[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
 
+oneinstack_dir=$(dirname "`readlink -f $0`")
+pushd ${oneinstack_dir} > /dev/null
 . ./options.conf
 . ./include/color.sh
 . ./include/check_dir.sh
 . ./include/check_os.sh
 . ./include/get_char.sh
 
-# Check if user is root
-[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
-
 Usage() {
   printf "
 Usage: $0 [ ${CMSG}add${CEND} | ${CMSG}del${CEND} | ${CMSG}list${CEND} ]