More work on base install script

This commit is contained in:
Duncan Sommerville 2014-12-11 16:42:05 -05:00
parent 065d8da4f4
commit 369b18cb98
1 changed files with 8 additions and 5 deletions

13
installer/install Normal file → Executable file
View File

@ -19,7 +19,7 @@ showhelp () {
More output More output
-q, --quiet, --silent -q, --quiet, --silent
No output except errors No output except errors
-n, --non-interactive -f, --force
Turn off interactive prompts Turn off interactive prompts
-w, --web-user=WEB_USER -w, --web-user=WEB_USER
Set the default apache web user Set the default apache web user
@ -98,7 +98,7 @@ while :; do
-q|--quiet|--silent) -q|--quiet|--silent)
_q=1 _q=1
;; ;;
-n|--non-interactive) -f|--force)
_i=0 _i=0
;; ;;
-a|--apache) -a|--apache)
@ -287,11 +287,12 @@ loud "-----------------------------------------------------"
loudCmd "apt-get -y --force-yes install postgresql php5-pgsql" loudCmd "apt-get -y --force-yes install postgresql php5-pgsql"
setupAirtimePostgresUser() { setupAirtimePostgresUser() {
su postgres su postgres <<'EOF'
psql -d postgres -tAc "CREATE USER airtime WITH ENCRYPTED PASSWORD 'airtime'; ALTER USER airtime CREATEDB;" psql -d postgres -tAc "CREATE USER airtime WITH ENCRYPTED PASSWORD 'airtime'; ALTER USER airtime CREATEDB;"
EOF
} }
if [ ${create_postgres_user} = "t" ]; then if [ "$create_postgres_user" = "t" ]; then
setupAirtimePostgresUser setupAirtimePostgresUser
elif [ ${_i} -eq 1 ]; then elif [ ${_i} -eq 1 ]; then
echo -e "Create default airtime postgres user? (Y/n): \c" echo -e "Create default airtime postgres user? (Y/n): \c"
@ -312,7 +313,7 @@ RABBITMQ_USER=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^user/ ) print $2}' ${
RABBITMQ_PASSWORD=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^password/ ) print $2}' ${AIRTIMEROOT}/airtime_mvc/build/airtime.example.conf) RABBITMQ_PASSWORD=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^password/ ) print $2}' ${AIRTIMEROOT}/airtime_mvc/build/airtime.example.conf)
EXCHANGES="airtime-pypo|pypo-fetch|airtime-media-monitor|media-monitor" EXCHANGES="airtime-pypo|pypo-fetch|airtime-media-monitor|media-monitor"
rabbitmqctl list_vhosts | grep -w ${RABBITMQ_VHOST} > /dev/null rabbitmqctl list_vhosts | grep -w ${RABBITMQ_VHOST}
RESULT="$?" RESULT="$?"
# Only run these if the user doesn't exist # Only run these if the user doesn't exist
@ -334,7 +335,9 @@ if [ ! -d "/etc/airtime" ]; then
loud "-----------------------------------------------------" loud "-----------------------------------------------------"
verbose "\n * Creating /etc/airtime/ directory..." verbose "\n * Creating /etc/airtime/ directory..."
mkdir -p /srv/airtime
mkdir /etc/airtime mkdir /etc/airtime
chown -R ${web_user}:${web_user} /srv/airtime
chown -R ${web_user}:${web_user} /etc/airtime chown -R ${web_user}:${web_user} /etc/airtime
fi fi