postinst is in smtpprox-loopprevent 0.1-1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #!/bin/sh
# preinst script for smtpprox-loopprevent
set -e
NAME=smtpprox-loopprevent
if [ "${1}" = "configure" ] ; then
[ -f "/etc/default/${NAME}" ] && . /etc/default/${NAME}
# Sane defaults:
[ -z "$_HOME" ] && _HOME=/var/lib/${NAME}
[ -z "$_USER" ] && _USER=loopprevent
[ -z "$_NAME" ] && _NAME="${NAME} system account"
[ -z "$_GROUP" ] && _GROUP=loopprevent
# create user to avoid running server as root
# 1. create group if not existing
if ! getent group | grep -q "^$_GROUP:" ; then
echo -n "Adding group $_GROUP.."
addgroup --quiet --system $_GROUP 2>/dev/null ||true
echo "..done"
fi
# 2. create homedir if not existing
test -d $_HOME || mkdir $_HOME
# 3. create user if not existing
if ! getent passwd | grep -q "^$_USER:"; then
echo -n "Adding system user $_USER.."
adduser --quiet \
--system \
--ingroup $_GROUP \
--no-create-home \
--disabled-password \
$_USER 2>/dev/null || true
echo "..done"
fi
# 4. adjust passwd entry
usermod -c "$_NAME" \
-d $_HOME \
-g $_GROUP \
$_USER
# 5. adjust file and directory permissions
if ! dpkg-statoverride --list $_HOME >/dev/null
then
chown -R $_USER:adm $_HOME
chmod u=rwx,g=rxs,o= $_HOME
fi
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_installinit
if [ -x "/etc/init.d/smtpprox-loopprevent" ]; then
update-rc.d smtpprox-loopprevent defaults >/dev/null
fi
if [ -x "/etc/init.d/smtpprox-loopprevent" ] || [ -e "/etc/init/smtpprox-loopprevent.conf" ]; then
invoke-rc.d smtpprox-loopprevent start || exit $?
fi
# End automatically added section
exit 0
|