summaryrefslogtreecommitdiff
path: root/system/postgresql/setup.postgresql
diff options
context:
space:
mode:
authorAdis Nezirovic <adis _at_ linux.org.ba>2010-05-11 15:18:43 +0200
committerMichiel van Wessem <michiel@slackbuilds.org>2010-05-11 15:18:43 +0200
commitbae18fdb80148edcdae1b2576e950bd40bcbea4d (patch)
tree853acf5d4399911d51721f78e7cccd52e748755e /system/postgresql/setup.postgresql
parentfa2426f410d0f29f621d095e5e71b89f3f032252 (diff)
downloadslackbuilds-bae18fdb80148edcdae1b2576e950bd40bcbea4d.tar.gz
system/postgresql: Initial import
Diffstat (limited to 'system/postgresql/setup.postgresql')
-rw-r--r--system/postgresql/setup.postgresql33
1 files changed, 33 insertions, 0 deletions
diff --git a/system/postgresql/setup.postgresql b/system/postgresql/setup.postgresql
new file mode 100644
index 0000000000..0c52cbf949
--- /dev/null
+++ b/system/postgresql/setup.postgresql
@@ -0,0 +1,33 @@
+#!/bin/bash
+#BLURB="PostgreSQL"
+
+PG_HOME=/var/lib/pgsql
+PG_USER=postgres
+PG_USER_ID=26
+PG_GROUP=postgres
+PG_GROUP_ID=26
+
+echo "Adding PostgreSQL user and group..."
+groupadd -g $PG_GROUP_ID $PG_GROUP
+useradd -g $PG_GROUP -u $PG_USER_ID -d $PG_HOME -c PostgreSQL $PG_USER
+mkdir -p $PG_HOME/data
+
+## default permissions
+echo "Setting up permissions..."
+chown -R $PG_USER:$PG_GROUP $PG_HOME
+chmod 700 $PG_HOME
+chmod 700 $PG_HOME/data
+
+## database cluster
+if [ ! -f $PG_HOME/data/PG_VERSION ]; then
+ echo "Creating database cluster in $PG_HOME/data..."
+ su $PG_USER -c "initdb -D $PG_HOME/data"
+else
+ echo "*** WARNING ***" >&2
+ echo " There is already a database cluster in $PG_HOME/data." >&2
+ echo " If you are upgrading from an older version of PostgreSQL" >&2
+ echo " you will have to 'dump' and 'restore' your database." >&2
+ echo " See PostgreSQL manual for more details." >&2
+fi
+
+echo "PostgreSQL post-installation setup completed"