initial import
This commit is contained in:
49
opensmtpd/opensmtpd.install
Normal file
49
opensmtpd/opensmtpd.install
Normal file
@@ -0,0 +1,49 @@
|
||||
post_install() {
|
||||
# create users
|
||||
if ! getent group smtpd &>/dev/null; then
|
||||
groupadd -r smtpd >/dev/null
|
||||
fi
|
||||
if ! getent group smtpq &>/dev/null; then
|
||||
groupadd -r smtpq >/dev/null
|
||||
fi
|
||||
if ! getent passwd smtpd &>/dev/null; then
|
||||
useradd -r -c "SMTP Daemon" -d /var/empty --uid 91 --gid smtpd --shell /bin/nologin smtpd >/dev/null
|
||||
fi
|
||||
if ! getent passwd smtpq &>/dev/null; then
|
||||
useradd -r -c "SMTP Queue" -d /var/empty --uid 92 --gid smtpq --shell /bin/nologin smtpq >/dev/null
|
||||
fi
|
||||
# Fix ownership of smtpctl
|
||||
chown smtpd:smtpq /usr/sbin/smtpctl
|
||||
chmod 2555 /usr/sbin/smtpctl
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
if (( $(vercmp $2 6.0.3p1-2.hyperbola3) < 0 )); then
|
||||
post_remove
|
||||
fi
|
||||
post_install
|
||||
if (( $(vercmp $2 5.3.3p1-1) < 0 )); then
|
||||
echo 'Configuration files have been moved to /etc/smtpd.'
|
||||
echo 'New users have been added.'
|
||||
echo 'Check your configuration!'
|
||||
elif (( $(vercmp $2 5.4) < 0 )); then
|
||||
echo 'User smtpf is no more required. It will be removed!'
|
||||
echo 'Check your configuration!'
|
||||
userdel -f smtpf >/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
if getent passwd smtpd &>/dev/null; then
|
||||
userdel smtpd >/dev/null
|
||||
fi
|
||||
if getent passwd smtpq &>/dev/null; then
|
||||
userdel smtpq >/dev/null
|
||||
fi
|
||||
if getent group smtpd &>/dev/null; then
|
||||
groupdel smtpd >/dev/null
|
||||
fi
|
||||
if getent group smtpq &>/dev/null; then
|
||||
groupdel smtpq >/dev/null
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user