summaryrefslogtreecommitdiff
path: root/extra/postgresql/postgresql.install
blob: c3fa4fc3ef5110ba2b7575b60cadfc34fb3cc9d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
post_install() {
  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
}