summaryrefslogtreecommitdiff
path: root/staging/postgresql/postgresql.install
diff options
context:
space:
mode:
Diffstat (limited to 'staging/postgresql/postgresql.install')
-rw-r--r--staging/postgresql/postgresql.install22
1 files changed, 22 insertions, 0 deletions
diff --git a/staging/postgresql/postgresql.install b/staging/postgresql/postgresql.install
new file mode 100644
index 000000000..d65bb6a7f
--- /dev/null
+++ b/staging/postgresql/postgresql.install
@@ -0,0 +1,22 @@
+post_install() {
+ if [ ! -d '/var/lib/postgres' ]; then
+ mkdir -p '/var/lib/postgres'
+ fi
+ getent group postgres >/dev/null || groupadd -g 88 postgres
+ getent passwd postgres >/dev/null || useradd -c 'PostgreSQL user' -u 88 -g postgres -d '/var/lib/postgres' -s /bin/bash postgres
+ passwd -l postgres >/dev/null
+}
+
+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
+}
+
+post_remove() {
+ getent passwd postgres >/dev/null && userdel postgres
+ getent group postgres >/dev/null && groupdel postgres
+}