From faae328530ec403eb864a96cc1b0af734dc82f19 Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Thu, 27 Sep 2012 21:06:10 +0100 Subject: Switch install script to use nginx This commit also reorganizes the files in conf/ --- bin/install-as-user | 60 +++++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 27 deletions(-) (limited to 'bin/install-as-user') diff --git a/bin/install-as-user b/bin/install-as-user index ecd2d99b6..c5e68764b 100755 --- a/bin/install-as-user +++ b/bin/install-as-user @@ -1,10 +1,22 @@ #!/bin/sh set -e +set -x + +DEFAULT_SERVER=false +if [ x"$1" = x"--default" ] +then + DEFAULT_SERVER=true + shift +fi if [ $# -ne 2 ] then - echo "Usage: $0 " + cat >&2 < +--default means to install as the default site for this server, +rather than a virtualhost for HOST. +EOUSAGE exit 1 fi @@ -35,7 +47,12 @@ then exit 1 fi -FMS_DIRECTORY="/var/www/$HOST" +if [ $DEFAULT_SERVER = true ] +then + FMS_DIRECTORY="/var/www/fixmystreet" +else + FMS_DIRECTORY="/var/www/$HOST" +fi FMS_REPOSITORY="$FMS_DIRECTORY/fixmystreet" FMS_LINK_DESTINATION="$HOME/fixmystreet" @@ -48,32 +65,12 @@ TEMPORARY_CRONTAB=$(mktemp) echo crontab file is $TEMPORARY_CRONTAB -cat > $TEMPORARY_CRONTAB < conf/general.yml +# Create the database if it doesn't exist: +if ! psql -l | egrep "^ *$DB_NAME *\|" > /dev/null +then + createdb --owner "$UNIX_USER" "$DB_NAME" + echo 'CREATE LANGUAGE plpgsql;' | psql -U "$UNIX_USER" "$DB_NAME" || true + psql -U "$UNIX_USER" "$DB_NAME" < "$FMS_REPOSITORY"/db/schema.sql + psql -U "$UNIX_USER" "$DB_NAME" < "$FMS_REPOSITORY"/db/alert_types.sql +fi + # Install the required Perl modules - this may take a very long time: cd "$FMS_REPOSITORY" -- cgit v1.2.3