postinst is in qpsmtpd 0.94-2.
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | #!/bin/sh
set -e
RUNAS=qpsmtpd
SPOOLDIR=/var/spool/qpsmtpd
GREYLISTDIR=/var/lib/qpsmtpd/greylisting
LOGDIR=/var/log/qpsmtpd
PIDDIR=/var/run/qpsmtpd
if [ -e /etc/qpsmtpd/debconf-settings ] ; then
. /etc/qpsmtpd/debconf-settings
fi
if [ -e /usr/share/debconf/confmodule ] ; then
. /usr/share/debconf/confmodule
fi
setup_debconf()
{
# extract the configuration from debconf and write it where qpsmtpd
# can find it, now that the destination exists
db_get qpsmtpd/startup_enabled
ENABLED="$RET"
db_get qpsmtpd/server_type
SERVER="$RET"
db_get qpsmtpd/listen_interfaces
INTERFACES="$RET"
db_get qpsmtpd/queue_plugin
QUEUE_PLUGIN="$RET"
db_get qpsmtpd/queue_maildir_destination
QUEUE_MAILDIR_DESTINATION="$RET"
db_get qpsmtpd/queue_smtp_proxy_destination
QUEUE_PROXY_DESTINATION="$RET"
db_get qpsmtpd/rcpthosts
RCPTHOSTS="$RET"
TMP=`mktemp /etc/qpsmtpd/.tmp.debconf-settings.$$.XXXXXX`
( echo "# auto-generated by $0 at `date`" ; cat <<"EOT"
#
# This is a copy of the qpsmtpd debconf settings for use at startup time.
# Please don't edit it directly -- if you need to change any of these
# settings, run 'dpkg-reconfigure qpsmtpd'.
EOT
echo "ENABLED=\"$ENABLED\""
echo "SERVER=\"$SERVER\""
echo "INTERFACES=\"$INTERFACES\""
echo "QUEUE_PLUGIN=\"$QUEUE_PLUGIN\""
echo "QUEUE_MAILDIR_DESTINATION=\"$QUEUE_MAILDIR_DESTINATION\""
echo "QUEUE_PROXY_DESTINATION=\"$QUEUE_PROXY_DESTINATION\""
) > "$TMP"
mv -f "$TMP" "/etc/qpsmtpd/debconf-settings" || ( rm -f "$TMP" && false )
chmod 0644 "/etc/qpsmtpd/debconf-settings"
TMP=`mktemp /etc/qpsmtpd/.tmp.debconf-queue-select.$$.XXXXXX`
( echo "# auto-generated by $0 at `date`" ; cat <<"EOT"
#
# This is the qpsmtpd queue plugin selection generated by debconf at
# package installation. It reflects the choice of queue method selected
# by the debconf UI. Please do not edit it directly -- it will be overwritten
# on subsequent package upgrades. To change the queueing/delivery
# method, either run 'dpkg-reconfigure qpsmtpd' and pick a different method,
# or edit /etc/qpsmtpd/plugins to remove the $include reference to this file,
# then pick whatever queue plugin you prefer.
EOT
if [ "$QUEUE_PLUGIN" = "exim" ] ; then
echo "queue/exim-bsmtp"
elif [ "$QUEUE_PLUGIN" = "postfix" ] ; then
echo "queue/postfix-queue"
elif [ "$QUEUE_PLUGIN" = "proxy" ] ; then
echo -n "queue/smtp-forward "
echo "$QUEUE_PROXY_DESTINATION" | tr ":" " "
elif [ "$QUEUE_PLUGIN" = "qmail" ] ; then
echo "queue/qmail-queue /usr/sbin/qmail-queue"
elif [ "$QUEUE_PLUGIN" = "maildir" ] ; then
echo "queue/maildir $QUEUE_MAILDIR_DESTINATION"
fi
echo
) > "$TMP"
mv -f "$TMP" "/etc/qpsmtpd/debian-queue-method"
chmod 0644 "/etc/qpsmtpd/debian-queue-method"
TMP=`mktemp /etc/qpsmtpd/.tmp.debconf-rcpthosts.$$.XXXXXX`
( echo "# auto-generated by $0 at `date`" ; cat <<"EOT"
#
# This is the Debian-specific qpsmtpd rcpthosts setting, containing the list of
# host and domain names for which qpsmtpd will accept mail. It should include
# all locally-delivered domain names as well as those for which you wish to
# relay mail. This file was generated by debconf when qpsmtpd was installed or
# (re)configured. To alter it, please run 'dpkg-reconfigure qpsmtpd'. If you
# prefer to edit the rcpthosts list manually, edit /etc/qpstmpd/rcpthosts and
# remove the $include reference to this file.
EOT
echo "$RCPTHOSTS" | perl -pe 's/[\s,]+/\n/g'
) > "$TMP"
mv -f "$TMP" "/etc/qpsmtpd/debian-rcpthosts"
chmod 0644 "/etc/qpsmtpd/debian-rcpthosts"
}
setup_user()
{
if ( ! getent passwd "$RUNAS" > /dev/null ) ; then
adduser --quiet \
--system --home "$SPOOLDIR" \
--gecos "qpsmtpd daemon user" \
--group "$RUNAS"
fi
if [ "x$QUEUE_PLUGIN" = "xpostfix" ] ; then
if ( ! getent group "postdrop" | \
tr ":" "\n" | \
grep -q "^$RUNAS\$" ) ; then
adduser --quiet "$RUNAS" "postdrop"
fi
fi
}
setup_perms()
{
if ( ! dpkg-statoverride --list "$SPOOLDIR" > /dev/null ) ; then
dpkg-statoverride --update --add "$RUNAS" "$RUNAS" 2700 "$SPOOLDIR"
fi
if ( ! dpkg-statoverride --list "$GREYLISTDIR" > /dev/null ) ; then
dpkg-statoverride --update --add "$RUNAS" "$RUNAS" 2700 "$GREYLISTDIR"
fi
if ( ! dpkg-statoverride --list "$LOGDIR" > /dev/null ) ; then
dpkg-statoverride --update --add "$RUNAS" adm 2750 "$LOGDIR"
fi
if ( ! dpkg-statoverride --list "$PIDDIR" > /dev/null ) ; then
dpkg-statoverride --update --add "$RUNAS" adm 2755 "$PIDDIR"
fi
}
setup_maildir_spool()
{
if [ "x$QUEUE_PLUGIN" = "xmaildir" -a \
"x$QUEUE_MAILDIR_DESTINATION" != "x" ] ; then
if [ ! -d "$QUEUE_MAILDIR_DESTINATION" ] ; then
[ -d "`dirname "$QUEUE_MAILDIR_DESTINATION"`" ] || \
mkdir -m 0755 -p "`dirname "$QUEUE_MAILDIR_DESTINATION"`"
[ -d "$QUEUE_MAILDIR_DESTINATION" ] || \
mkdir -m 0700 -p "$QUEUE_MAILDIR_DESTINATION"
for d in "$QUEUE_MAILDIR_DESTINATION/new" \
"$QUEUE_MAILDIR_DESTINATION/cur" \
"$QUEUE_MAILDIR_DESTINATION/tmp" ; do
if [ ! -d "$d" ] ; then
mkdir -m 0700 "$d"
fi
done
chown -R $RUNAS "$QUEUE_MAILDIR_DESTINATION"
fi
fi
}
upgrade_config()
{
from_version="$1" ; shift
if dpkg --compare-versions "$from_version" lt 0.32 ; then
if [ -f /var/log/qpsmtpd/qpsmtpd.log ] ; then
chown qpsmtpd /var/log/qpsmtpd/qpsmtpd.log
fi
fi
if dpkg --compare-versions "$from_version" le 0.94-1 ; then
# "check_" prefix was removed in upstream change
# b1c2fa16b5fda84f361abf15764501fd11e84022
db_input high qpsmtpd/pre094_checkplugin_warning || true
db_go
fi
}
case "$1" in
configure)
previous="$2"
setup_debconf
setup_user
setup_perms
setup_maildir_spool
upgrade_config "$previous"
;;
abort-upgrade|abort-remove|abort-deconfigure)
# no-op
;;
*)
echo "Unrecognized postinst argument '$1'"
;;
esac
# Automatically added by dh_installinit
if [ -x "/etc/init.d/qpsmtpd" ]; then
update-rc.d qpsmtpd defaults >/dev/null
fi
if [ -x "/etc/init.d/qpsmtpd" ] || [ -e "/etc/init/qpsmtpd.conf" ]; then
invoke-rc.d qpsmtpd start || exit $?
fi
# End automatically added section
db_stop
exit 0
|