aboutsummaryrefslogtreecommitdiff
path: root/postgresql/setup.postgresql
diff options
context:
space:
mode:
authorSlack Coder <slackcoder@server.ky>2023-11-29 10:35:20 -0500
committerSlack Coder <slackcoder@server.ky>2024-03-12 16:38:56 -0500
commitb9eaaf853abd4250a6bc424914dae5189bc23de6 (patch)
tree873ca2d04e4c7f5516876822dafd0f0b38b01f5b /postgresql/setup.postgresql
parentd978a115ef800c22e5cc1a30d075b26c896cabad (diff)
downloadslackbuilds-b9eaaf853abd4250a6bc424914dae5189bc23de6.tar.xz
Add GNU Taler
Add the following packages and dependencies to build them from their git source repositories. - taler-exchange - taler-merchant - libeufin
Diffstat (limited to 'postgresql/setup.postgresql')
-rw-r--r--postgresql/setup.postgresql35
1 files changed, 35 insertions, 0 deletions
diff --git a/postgresql/setup.postgresql b/postgresql/setup.postgresql
new file mode 100644
index 0000000..2f0ec5f
--- /dev/null
+++ b/postgresql/setup.postgresql
@@ -0,0 +1,35 @@
+#!/bin/bash
+#BLURB="PostgreSQL @PG_VERSION@"
+
+PG_HOME=/var/lib/pgsql
+PG_USER=postgres
+PG_USER_ID=@UID@
+PG_GROUP=postgres
+PG_GROUP_ID=@GID@
+PG_VERSION=@PG_VERSION@
+
+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/$PG_VERSION/data
+
+## default permissions
+echo "Setting up permissions..."
+chown -R $PG_USER:$PG_GROUP $PG_HOME
+chmod 700 $PG_HOME
+chmod 700 $PG_HOME/$PG_VERSION
+chmod 700 $PG_HOME/$PG_VERSION/data
+
+## database cluster
+if [ ! -f $PG_HOME/$PG_VERSION/data/PG_VERSION ]; then
+ echo "Creating database cluster in $PG_HOME/$PG_VERSION/data..."
+ su $PG_USER -c "initdb -D $PG_HOME/$PG_VERSION/data --locale=en_US.UTF-8 -A md5 -W"
+else
+ echo "*** WARNING ***" >&2
+ echo " There is already a database cluster in $PG_HOME/$PG_VERSION/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"