aboutsummaryrefslogtreecommitdiffstats
path: root/script/site-specific-install.sh
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-10-30 12:02:55 +0000
committerMark Longair <mhl@pobox.com>2013-10-31 11:46:04 +0000
commitd41c5a64379951953adc2542434a2d5ef83aef6d (patch)
tree5d684c864fcd49bc6efb03f6c180d83f5c39bec9 /script/site-specific-install.sh
parent2dd8cf2a1e91703352228d8696e96c01806e71ca (diff)
Drop PostgreSQL superuser permissions after loading sample data
Diffstat (limited to 'script/site-specific-install.sh')
-rwxr-xr-xscript/site-specific-install.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index c7ec1e59e..f23210f03 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -114,11 +114,17 @@ install_website_packages
# Make the PostgreSQL user a superuser to avoid the irritating error:
# PG::Error: ERROR: permission denied: "RI_ConstraintTrigger_16564" is a system trigger
+# This is only needed for loading the sample data, so the superuser
+# permissions are dropped below.
add_postgresql_user --superuser
export DEVELOPMENT_INSTALL
su -c "$BIN_DIRECTORY/install-as-user '$UNIX_USER' '$HOST' '$DIRECTORY'" "$UNIX_USER"
+# Now that the install-as-user script has loaded the sample data, we
+# no longer need the PostgreSQL user to be a superuser:
+echo "ALTER USER \"$UNIX_USER\" WITH NOSUPERUSER;" | su -l -c 'psql' postgres
+
if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
install_sysvinit_script
fi