summarylogtreecommitdiffstats
path: root/postgresql.install
diff options
context:
space:
mode:
authorGreg White2016-09-30 08:26:29 -0400
committerGreg White2016-09-30 08:26:29 -0400
commitb4a4b545b76ca243c574ce2c59c0afc237b46921 (patch)
treea3f900b3f6f2f1ac178a1b0b09d7b6e89a0e9e55 /postgresql.install
downloadaur-b4a4b545b76ca243c574ce2c59c0afc237b46921.tar.gz
Init
Diffstat (limited to 'postgresql.install')
-rw-r--r--postgresql.install25
1 files changed, 25 insertions, 0 deletions
diff --git a/postgresql.install b/postgresql.install
new file mode 100644
index 000000000000..0d23d474a0c2
--- /dev/null
+++ b/postgresql.install
@@ -0,0 +1,25 @@
+post_install() {
+ if [ ! -d '/var/lib/postgres' ]; then
+ mkdir -p '/var/lib/postgres'
+ fi
+ if ! getent group postgres >/dev/null; then
+ groupadd -g 88 postgres
+ fi
+ if ! getent passwd postgres >/dev/null; then
+ useradd -c 'PostgreSQL user' -u 88 -g postgres -d '/var/lib/postgres' -s /bin/bash postgres
+ passwd -l postgres >/dev/null
+ fi
+ if [ ! -d '/var/lib/postgres/data' ]; then
+ mkdir -p '/var/lib/postgres/data'
+ chown postgres:postgres '/var/lib/postgres/data'
+ fi
+}
+
+post_upgrade() {
+ post_install $1
+ # FS#23858, fix postgres user shell issue
+ postgres_shell=$(getent passwd postgres | cut -d: -f7)
+ if [ "$postgres_shell" = "/sbin/nologin" ]; then
+ chsh -s /bin/bash postgres
+ fi
+}