summaryrefslogtreecommitdiff
path: root/extra/pgbouncer/pgbouncer.install
blob: 6374fdf9479bbccfd2448fe4ffdcaa32c3bc6418 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
post_install() {
  if ! getent group pgbouncer >/dev/null; then
    groupadd -r pgbouncer
  fi
  if ! getent passwd pgbouncer >/dev/null; then
    useradd -c 'PGBouncer user' -r -g pgbouncer -d '/etc/pgbouncer' -s /bin/bash pgbouncer
    passwd -l pgbouncer >/dev/null
  fi
  chown pgbouncer:pgbouncer /var/log/pgbouncer
  systemd-tmpfiles --create pgbouncer.conf
  post_upgrade
}

post_upgrade() {
  gpasswd -a pgbouncer postgres
}

post_remove() {
  if getent passwd pgbouncer >/dev/null; then
    userdel pgbouncer
  fi
  if getent group pgbouncer >/dev/null; then
    groupdel pgbouncer
  fi
}