diff options
author | banzay | 2017-10-09 01:18:47 +0300 |
---|---|---|
committer | banzay | 2017-10-09 01:18:47 +0300 |
commit | f002a0e2dfb2ec7bcd992440b47dc1af1d2f832e (patch) | |
tree | da923a50484870971a2f2966f122efa34f6e389b /postgresql.install | |
parent | da68a5ca3893c50fdcdb9b073a1f223affd03964 (diff) | |
download | aur-f002a0e2dfb2ec7bcd992440b47dc1af1d2f832e.tar.gz |
package update
Diffstat (limited to 'postgresql.install')
-rw-r--r-- | postgresql.install | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/postgresql.install b/postgresql.install index 203e0040fda8..0d23d474a0c2 100644 --- a/postgresql.install +++ b/postgresql.install @@ -1,36 +1,25 @@ -# This is a default template for a post-install scriptlet. -# Uncomment only required functions and remove any functions -# you don't need (and this header). - -## arg 1: the new package version -#pre_install() { - # do something here -#} - -## arg 1: the new package version post_install() { - ldconfig - grep -q postgres /etc/passwd && useradd -d /var/lib/postgres -m postgres && su - postgres -c 'initdb -D /var/lib/postgres/data' + 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 + if [ ! -d '/var/lib/postgres/data' ]; then + mkdir -p '/var/lib/postgres/data' + chown postgres:postgres '/var/lib/postgres/data' + fi } -## arg 1: the new package version -## arg 2: the old package version -#pre_upgrade() { - # do something here -#} - -## arg 1: the new package version -## arg 2: the old package version -#post_upgrade() { - # do something here -#} - -## arg 1: the old package version -#pre_remove() { - # do something here -#} - -## arg 1: the old package version -post_remove() { - ldconfig +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 } |