aboutsummaryrefslogtreecommitdiffstats
path: root/bin/site-specific-install.sh
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2012-10-04 15:03:44 +0100
committerMark Longair <mhl@pobox.com>2012-10-04 16:02:02 +0100
commit00b1e242cab3e194f8252b117e1218a78ebf592b (patch)
treecde4958bbd600cab5c54b8d40b766a9fc7e9131b /bin/site-specific-install.sh
parent61bfbbe92a3225869520dbcb32f35069431fa84e (diff)
Remove common install script code
pre-install-as-root is no longer the way that you should invoke the install script; instead you should call the install-site.sh script in commonlib/bin.
Diffstat (limited to 'bin/site-specific-install.sh')
-rw-r--r--bin/site-specific-install.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/bin/site-specific-install.sh b/bin/site-specific-install.sh
new file mode 100644
index 000000000..002413cfb
--- /dev/null
+++ b/bin/site-specific-install.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+PARENT_SCRIPT_URL=https://github.com/mysociety/commonlib/blob/master/bin/install-site.sh
+
+misuse() {
+ echo The variable $1 was not defined, and it should be.
+ echo This script should not be run directly - instead, please run:
+ echo $PARENT_SCRIPT_URL
+ exit 1
+}
+
+# Strictly speaking we don't need to check all of these, but it might
+# catch some errors made when changing install-site.sh
+
+[ -z "$DIRECTORY" ] && misuse DIRECTORY
+[ -z "$UNIX_USER" ] && misuse UNIX_USER
+[ -z "$REPOSITORY" ] && misuse REPOSITORY
+[ -z "$REPOSITORY_URL" ] && misuse REPOSITORY_URL
+[ -z "$BRANCH" ] && misuse BRANCH
+[ -z "$SITE" ] && misuse SITE
+[ -z "$DEFAULT_SERVER" ] && misuse DEFAULT_SERVER
+[ -z "$EC2_HOSTNAME" ] && misuse EC2_HOSTNAME
+[ -z "$HOST" ] && misuse HOST
+[ -z "$DISTRIBUTION" ] && misuse DISTRIBUTION
+[ -z "$VERSION" ] && misuse VERSION
+
+install_nginx
+
+install_website_packages
+
+su -l -c "touch '$DIRECTORY/admin-htpasswd'" "$UNIX_USER"
+
+add_website_to_nginx
+
+add_postgresql_user
+
+su -l -c "$REPOSITORY/bin/install-as-user '$UNIX_USER' '$HOST' '$DIRECTORY'" "$UNIX_USER"
+
+install_sysvinit_script
+
+if [ $DEFAULT_SERVER = true ] && [ x != x$EC2_HOSTNAME ]
+then
+ # If we're setting up as the default on an EC2 instance,
+ # make sure the ec2-rewrite-conf script is called from
+ # /etc/rc.local
+ overwrite_rc_local
+fi
+
+# 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: $REPOSITORY/bin/cron-wrapper prove -r t