mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-04 05:57:14 +08:00
34 lines
896 B
Plaintext
34 lines
896 B
Plaintext
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
|
|
echo ">>> Please edit the file /etc/conf.d/postgresql"
|
|
echo ">>> and remove the trailing hash sign in front of"
|
|
echo '>>> PGROOT="/var/lib/postgres"'
|
|
}
|
|
|
|
post_remove() {
|
|
if getent passwd postgres >/dev/null; then
|
|
userdel postgres
|
|
fi
|
|
|
|
if getent group postgres >/dev/null; then
|
|
groupdel postgres
|
|
fi
|
|
}
|
|
|
|
# vim:set ts=2 sw=2 et:
|