#!/bin/sh set -e if [ $# -ne 2 ] then echo "Usage: $0 " exit 1 fi UNIX_USER="$1" HOST="$2" DB_NAME="fixmystreet" # Check that the arguments we've been passed are sensible: IP_ADDRESS_FOR_HOST="$(dig +short $HOST)" if [ x = x"$IP_ADDRESS_FOR_HOST" ] then echo "The hostname $HOST didn't resolve to an IP address" exit 1 fi if ! id "$UNIX_USER" 2> /dev/null > /dev/null then echo "The user '$UNIX_USER' didn't exist." echo "(You should have run \"sudo pre-install-as-root '$UNIX_USER' '$HOST'\" before this.)" exit 1 fi if [ "$(whoami)" != "$UNIX_USER" ] then echo "This script should be run by the user '$UNIX_USER'." exit 1 fi FMS_DIRECTORY="/var/www/$HOST" FMS_REPOSITORY="$FMS_DIRECTORY/fixmystreet" FMS_LINK_DESTINATION="$HOME/fixmystreet" ln -sfn "$FMS_REPOSITORY" $FMS_LINK_DESTINATION cd "$FMS_REPOSITORY" # Add regularly scheduled tasks to cron: TEMPORARY_CRONTAB=$(mktemp) echo crontab file is $TEMPORARY_CRONTAB cat > $TEMPORARY_CRONTAB < conf/general.yml # Install the required Perl modules - this may take a very long time: cd "$FMS_REPOSITORY" bin/install_perl_modules # Generate po and mo files (these invocations taken from Kagee's script): ./bin/cron-wrapper ./bin/make_emptyhomes_po ./bin/cron-wrapper ./bin/make_emptyhomes_welsh_po commonlib/bin/gettext-makemo FixMyStreet # Tell the user what to do next: echo Installation complete - you should now be able to view the site at: echo http://$HOST/ echo Or you can run the tests by switching to the "'$UNIX_USER'" user and echo running: $FMS_REPOSITORY/bin/cron-wrapper prove -r t