summaryrefslogtreecommitdiff
path: root/testing/postgresql/postgresql.install
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2011-09-27 23:14:33 +0000
committerroot <root@rshg054.dnsready.net>2011-09-27 23:14:33 +0000
commitccb9d72bbf1ee4f7a54113eac76a16b0b5014869 (patch)
treeb54ca3606d7cff4133dac1e84183328e555f4085 /testing/postgresql/postgresql.install
parentabcf87c553a18aec8372de7f690b5aa91a7a0d24 (diff)
Tue Sep 27 23:14:33 UTC 2011
Diffstat (limited to 'testing/postgresql/postgresql.install')
-rw-r--r--testing/postgresql/postgresql.install26
1 files changed, 26 insertions, 0 deletions
diff --git a/testing/postgresql/postgresql.install b/testing/postgresql/postgresql.install
new file mode 100644
index 000000000..c52432271
--- /dev/null
+++ b/testing/postgresql/postgresql.install
@@ -0,0 +1,26 @@
+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() {
+ if getent passwd postgres >/dev/null; then
+ userdel postgres
+ fi
+ if getent group postgres >/dev/null; then
+ groupdel postgres
+ fi
+}