Files
extra/postfix/postfix.install
2025-06-22 20:39:04 -05:00

45 lines
1.2 KiB
Plaintext

post_install() {
if ! getent group postdrop &>/dev/null; then
groupadd -g 75 postdrop >/dev/null
fi
if ! getent group postfix &>/dev/null; then
groupadd -g 73 postfix >/dev/null
fi
if ! getent passwd postfix &>/dev/null; then
useradd -u 73 -d /var/spool/postfix -g postfix -G adm -s /bin/nologin postfix >/dev/null
fi
if ! groups postfix | grep adm &>/dev/null; then
gpasswd -a postfix adm >/dev/null
fi
postfix_shell=$(getent passwd postfix | cut -d: -f7)
if [ "$postfix_shell" != '/bin/nologin' ]; then
chsh -s /bin/nologin postfix &>/dev/null
fi
if [ ! -d /var/spool/postfix/public/pickup ]; then
mkfifo /var/spool/postfix/public/pickup
fi
}
post_upgrade() {
post_install
if [[ $(vercmp $2 3.0.0-3) -eq -1 ]]; then
echo '==> The postfix daemon binaries have moved.'
echo '==> Please restart postfix as soon as possible.'
elif [[ $(vercmp $2 3.0.1-1) -eq -1 ]]; then
echo '==> Several Postfix-internal protocols have changed.'
echo '==> Please restart postfix as soon as possible.'
fi
}
post_remove() {
if getent passwd postfix &>/dev/null; then
userdel postfix >/dev/null
fi
if getent group postfix &>/dev/null; then
groupdel postfix >/dev/null
fi
if getent group postdrop &>/dev/null; then
groupdel postdrop >/dev/null
fi
}