Merge 3aea573e60 into 247dfcbbbe
This commit is contained in:
commit
13b02c7b2a
|
|
@ -3,7 +3,7 @@
|
|||
#Process command line options only if we haven't been processed once
|
||||
if [ -z "$CPU_CHECK" ]; then
|
||||
export script_name=`basename "$0"`
|
||||
ARGS=$(getopt -n '$script_name' -o h -l help,use-switch-source,use-switch-package-all,use-switch-master,use-switch-package-unofficial-arm,use-system-master,no-cpu-check -- "$@")
|
||||
ARGS=$(getopt -n '$script_name' -o h -l help,use-switch-source,use-switch-package-all,use-switch-master,use-switch-package-unofficial-arm,use-system-master,use-postgres-bdr,no-cpu-check -- "$@")
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
error "Failed parsing options."
|
||||
|
|
@ -15,6 +15,7 @@ if [ -z "$CPU_CHECK" ]; then
|
|||
export USE_SWITCH_PACKAGE_UNOFFICIAL_ARM=false
|
||||
export USE_SWITCH_MASTER=false
|
||||
export USE_SYSTEM_MASTER=false
|
||||
export USE_POSTGRES_BDR=false
|
||||
export CPU_CHECK=true
|
||||
HELP=false
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ if [ -z "$CPU_CHECK" ]; then
|
|||
--use-switch-package-all ) export USE_SWITCH_PACKAGE_ALL=true; shift ;;
|
||||
--use-switch-master ) export USE_SWITCH_MASTER=true; shift ;;
|
||||
--use-system-master ) export USE_SYSTEM_MASTER=true; shift ;;
|
||||
--use-postgres-bdr ) export USE_POSTGRES_BDR=true; shift ;;
|
||||
--no-cpu-check ) export CPU_CHECK=false; shift ;;
|
||||
-h | --help ) HELP=true; shift ;;
|
||||
-- ) shift; break ;;
|
||||
|
|
@ -38,6 +40,7 @@ if [ -z "$CPU_CHECK" ]; then
|
|||
warning " --use-switch-package-unofficial-arm if your system is arm and you are using packages, use the unofficial arm repo"
|
||||
warning " --use-switch-master will use master branch/packages for the switch instead of ${green}(default:stable)"
|
||||
warning " --use-system-master will use master branch/packages for the system instead of ${green}(default:stable)"
|
||||
warning " --use-postgres-bdr will install postgress-bdr from the 2nd quadrant repo ${green}(default:no)"
|
||||
warning " --no-cpu-check disable the cpu check ${green}(default:check)"
|
||||
exit;
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,22 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
#move to script directory so all relative paths work
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
. ./colors.sh
|
||||
. ./arguments.sh
|
||||
|
||||
#send a message
|
||||
echo "Install PostgreSQL"
|
||||
verbose "Installing PostgreSQL"
|
||||
|
||||
#generate a random password
|
||||
password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64)
|
||||
|
||||
#Postgres
|
||||
echo "Install PostgreSQL and create the database and users\n"
|
||||
apt-get install -y --force-yes sudo postgresql
|
||||
|
||||
#Add PostgreSQL and BDR REPO
|
||||
#echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' >> /etc/apt/sources.list.d/postgresql.list
|
||||
#echo 'deb http://packages.2ndquadrant.com/bdr/apt/ jessie-2ndquadrant main' >> /etc/apt/sources.list.d/2ndquadrant.list
|
||||
#/usr/bin/wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
|
||||
#/usr/bin/wget --quiet -O - http://packages.2ndquadrant.com/bdr/apt/AA7A6805.asc | apt-key add -
|
||||
#apt-get update && apt-get upgrade -y
|
||||
#apt-get install -y --force-yes sudo postgresql-bdr-9.4 postgresql-bdr-9.4-bdr-plugin postgresql-bdr-contrib-9.4
|
||||
if [ $USE_POSTGRES_BDR = true ]; then
|
||||
verbose "Installing PostgreSQL BDR support from 2ndquadrant"
|
||||
echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' >> /etc/apt/sources.list.d/postgresql.list
|
||||
echo 'deb http://packages.2ndquadrant.com/bdr/apt/ jessie-2ndquadrant main' >> /etc/apt/sources.list.d/2ndquadrant.list
|
||||
/usr/bin/wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
|
||||
/usr/bin/wget --quiet -O - http://packages.2ndquadrant.com/bdr/apt/AA7A6805.asc | apt-key add -
|
||||
apt-get update && apt-get upgrade -y
|
||||
apt-get install -y --force-yes sudo postgresql-bdr-9.4 postgresql-bdr-9.4-bdr-plugin postgresql-bdr-contrib-9.4
|
||||
else
|
||||
apt-get install -y --force-yes sudo postgresql
|
||||
fi
|
||||
|
||||
#systemd
|
||||
systemctl daemon-reload
|
||||
|
|
@ -25,6 +31,8 @@ systemctl restart postgresql
|
|||
#init.d
|
||||
#/usr/sbin/service postgresql restart
|
||||
|
||||
verbose "Creating the database and users"
|
||||
|
||||
#move to /tmp to prevent a red herring error when running sudo with psql
|
||||
cwd=$(pwd)
|
||||
cd /tmp
|
||||
|
|
@ -45,8 +53,8 @@ server_address=$(hostname -I)
|
|||
#Show database password
|
||||
echo ""
|
||||
echo ""
|
||||
echo "PostgreSQL"
|
||||
echo " Database name: fusionpbx"
|
||||
echo " Database username: fusionpbx"
|
||||
echo " Database password: $password"
|
||||
verbose "PostgreSQL configuration :-"
|
||||
verbose " Database name: ${yellow}fusionpbx"
|
||||
verbose " Database username: ${yellow}fusionpbx"
|
||||
verbose " Database password: ${yellow}$password"
|
||||
echo ""
|
||||
|
|
|
|||
Loading…
Reference in New Issue