summarylogtreecommitdiffstats
path: root/postgresql.install
diff options
context:
space:
mode:
authormnovick19882016-02-08 02:00:18 -0500
committermnovick19882016-02-08 02:00:18 -0500
commit195db79358c2ff64ded7af5f38ee53db67d2852a (patch)
treeed4f2651576bd767a8f19f722d19b3ef5b768192 /postgresql.install
downloadaur-195db79358c2ff64ded7af5f38ee53db67d2852a.tar.gz
Initial import
Diffstat (limited to 'postgresql.install')
-rw-r--r--postgresql.install39
1 files changed, 39 insertions, 0 deletions
diff --git a/postgresql.install b/postgresql.install
new file mode 100644
index 000000000000..699efe692afd
--- /dev/null
+++ b/postgresql.install
@@ -0,0 +1,39 @@
+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
+ systemd-tmpfiles --create postgresql.conf
+ 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
+ if [ $(vercmp $2 '9.2.1-2') -lt 0 ]; then
+ echo "Note: The Unix domain socket location has changed; be sure to"
+ echo " restart any local applications using libpq.so."
+ fi
+}
+
+post_remove() {
+ if getent passwd postgres >/dev/null; then
+ userdel postgres
+ fi
+ if getent group postgres >/dev/null; then
+ groupdel postgres
+ fi
+}