|
@@ -173,7 +173,7 @@ while :; do echo
|
|
|
echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
|
|
|
else
|
|
|
if [ "$DB_yn" == 'y' ]; then
|
|
|
- [ -d "$db_install_dir/support-files" ] && { echo "${CWARNING}Database already installed! ${CEND}"; DB_yn=Other; break; }
|
|
|
+ [ -d "$db_install_dir/support-files" -a -e "${pgsql_install_dir}/bin/psql" ] && { echo "${CWARNING}Database already installed! ${CEND}"; DB_yn=Other; break; }
|
|
|
while :; do echo
|
|
|
echo 'Please select a version of the Database:'
|
|
|
echo -e "\t${CMSG} 1${CEND}. Install MySQL-5.7"
|
|
@@ -187,13 +187,24 @@ while :; do echo
|
|
|
echo -e "\t${CMSG} 9${CEND}. Install Percona-5.6"
|
|
|
echo -e "\t${CMSG}10${CEND}. Install Percona-5.5"
|
|
|
echo -e "\t${CMSG}11${CEND}. Install AliSQL-5.6"
|
|
|
+ echo -e "\t${CMSG}12${CEND}. Install PostgreSQL"
|
|
|
read -p "Please input a number:(Default 2 press Enter) " DB_version
|
|
|
[ -z "$DB_version" ] && DB_version=2
|
|
|
- if [ ${DB_version} -ge 1 >/dev/null 2>&1 -a ${DB_version} -le 11 >/dev/null 2>&1 ]; then
|
|
|
+ if [ ${DB_version} -ge 1 >/dev/null 2>&1 -a ${DB_version} -le 12 >/dev/null 2>&1 ]; then
|
|
|
while :; do
|
|
|
- read -p "Please input the root password of database: " dbrootpwd
|
|
|
+ if [ "$DB_version" == '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; }
|
|
|
- (( ${#dbrootpwd} >= 5 )) && sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf && break || echo "${CWARNING}database root password least 5 characters! ${CEND}"
|
|
|
+ if (( ${#dbrootpwd} >= 5 )); then
|
|
|
+ [ "$DB_version" == '12' ] && { sed -i "s+^dbpostgrespwd.*+dbpostgrespwd='$dbrootpwd'+" ./options.conf; dbpostgrespwd="$dbrootpwd"; } || sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf
|
|
|
+ break
|
|
|
+ else
|
|
|
+ echo "${CWARNING}password least 5 characters! ${CEND}"
|
|
|
+ fi
|
|
|
+
|
|
|
done
|
|
|
# choose install methods
|
|
|
if [ ${DB_version} -ge 1 >/dev/null 2>&1 -a ${DB_version} -le 10 >/dev/null 2>&1 ]; then
|
|
@@ -212,7 +223,7 @@ while :; do echo
|
|
|
fi
|
|
|
break
|
|
|
else
|
|
|
- echo "${CWARNING}input error! Please only input number 1~11${CEND}"
|
|
|
+ echo "${CWARNING}input error! Please only input number 1~12${CEND}"
|
|
|
fi
|
|
|
done
|
|
|
fi
|
|
@@ -578,6 +589,10 @@ case "${DB_version}" in
|
|
|
. include/alisql-5.6.sh
|
|
|
Install_AliSQL56 2>&1 | tee -a $oneinstack_dir/install.log
|
|
|
;;
|
|
|
+ 12)
|
|
|
+ . include/postgresql.sh
|
|
|
+ Install_PostgreSQL 2>&1 | tee -a $oneinstack_dir/install.log
|
|
|
+ ;;
|
|
|
esac
|
|
|
|
|
|
# Apache
|
|
@@ -668,6 +683,12 @@ if [ "$ZendGuardLoader_yn" == 'y' ]; then
|
|
|
Install_ZendGuardLoader 2>&1 | tee -a $oneinstack_dir/install.log
|
|
|
fi
|
|
|
|
|
|
+# pecl_pgsql
|
|
|
+if [ "$DB_version" == '12' ] && [ -e "${php_install_dir}/bin/phpize" ]; then
|
|
|
+ . include/pecl_pgsql.sh
|
|
|
+ Install_pecl-pgsql 2>&1 | tee -a $oneinstack_dir/install.log
|
|
|
+fi
|
|
|
+
|
|
|
# Web server
|
|
|
case "${Nginx_version}" in
|
|
|
1)
|
|
@@ -768,10 +789,14 @@ echo "Total OneinStack Install Time: ${CQUESTION}${installTime}${CEND} minutes"
|
|
|
[ "${Web_yn}" == 'y' -a "${Nginx_version}" != '4' -a "${Apache_version}" != '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_version}" == '4' -a "${Apache_version}" != '3' ] && echo -e "\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}"
|
|
|
[[ "${Tomcat_version}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Tomcat install dir":)${CMSG}${tomcat_install_dir}${CEND}"
|
|
|
-[ "${DB_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}"
|
|
|
-[ "${DB_yn}" == 'y' ] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}"
|
|
|
-[ "${DB_yn}" == 'y' ] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}"
|
|
|
-[ "${DB_yn}" == 'y' ] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}"
|
|
|
+[[ "${DB_version}" =~ ^[1-9]$|^1[0-1]$ ]] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}"
|
|
|
+[[ "${DB_version}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}"
|
|
|
+[[ "${DB_version}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}"
|
|
|
+[[ "${DB_version}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}"
|
|
|
+[ "${DB_version}" == '12' ] && echo -e "\n$(printf "%-32s" "PostgreSQL install dir:")${CMSG}${pgsql_install_dir}${CEND}"
|
|
|
+[ "${DB_version}" == '12' ] && echo "$(printf "%-32s" "PostgreSQL data dir:")${CMSG}${pgsql_data_dir}${CEND}"
|
|
|
+[ "${DB_version}" == '12' ] && echo "$(printf "%-32s" "PostgreSQL user:")${CMSG}postgres${CEND}"
|
|
|
+[ "${DB_version}" == '12' ] && echo "$(printf "%-32s" "postgres password:")${CMSG}${dbpostgrespwd}${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}"
|