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
|
#!/bin/sh
CONFIGFILE=/etc/default/postsrsd
set -e
. /usr/share/debconf/confmodule
if [ "$1" = "configure" ]; then
if [ ! -f /etc/postsrsd.secret ]; then
echo "postsrsd: Generating initial /etc/postsrsd.secret" >&2
( umask 0077 ; dd if=/dev/urandom bs=24 count=1 2>/dev/null | base64 -w0 > /etc/postsrsd.secret )
fi
# We'll only write the configured domain to the config file if it doesn't
# exist yet, or we're called by dpkg-reconfigure.
db_get postsrsd/domain; DOMAIN="$RET"
if [ ! -e $CONFIGFILE ]; then
cp -a -f /usr/share/postsrsd/postsrsd.template $CONFIGFILE.tmp
# strip comment from SRS_DOMAIN and write configured domain to config file (but only if the domain is not empty)
if [ ! -z "$DOMAIN" ]; then
sed -i "s/^#SRS_DOMAIN=.*/SRS_DOMAIN=$DOMAIN/" $CONFIGFILE.tmp
fi
mv -f $CONFIGFILE.tmp $CONFIGFILE
fi
if [ "$DEBCONF_RECONFIGURE" = "1" -a ! -z "$DOMAIN" ]; then
cp -a -f $CONFIGFILE $CONFIGFILE.tmp
sed -i "s/^\( *\|#\)SRS_DOMAIN=.*/SRS_DOMAIN=$DOMAIN/" $CONFIGFILE.tmp
mv -f $CONFIGFILE.tmp $CONFIGFILE
fi
# Create user
if ! getent passwd postsrsd > /dev/null; then
adduser --quiet --system --group --no-create-home --home /var/lib/postsrsd postsrsd
fi
fi
# Stop communcation with debconf, as the daemon might get confused with the extra file
# descriptor if we use an init system that doesn't close it.
db_stop
#DEBHELPER#
|