| 1 |
#!/bin/sh -e
|
| 2 |
|
| 3 |
# postinst for Mixmaster
|
| 4 |
|
| 5 |
REMAILCONFIGFILE=/etc/mixmaster/remailer.conf
|
| 6 |
UPDATECONFIG=/etc/mixmaster/update.conf
|
| 7 |
|
| 8 |
. /usr/share/debconf/confmodule
|
| 9 |
|
| 10 |
# whitespace for some grep magic
|
| 11 |
WS="[ `printf \\\t`]"
|
| 12 |
|
| 13 |
convert_bool() {
|
| 14 |
if [ "$RET" = "false" ] ; then
|
| 15 |
RET="n"
|
| 16 |
else
|
| 17 |
RET="y"
|
| 18 |
fi;
|
| 19 |
}
|
| 20 |
|
| 21 |
|
| 22 |
# Make sure the mixmaster user exists
|
| 23 |
getent passwd mixmaster >/dev/null 2>&1 || (
|
| 24 |
echo Adding mixmaster user
|
| 25 |
adduser --system --shell /bin/bash --group --home /var/lib/mixmaster --gecos "Anonymous Remailer" mixmaster )
|
| 26 |
|
| 27 |
# Fix permissions on /var/lib/mixmaster - the mixmaster's homedirectory
|
| 28 |
# The user may have too strict permissions as default in adduser.conf
|
| 29 |
if ( ! dpkg-statoverride --list /var/lib/mixmaster > /dev/null ); then
|
| 30 |
dpkg-statoverride --update --add mixmaster mixmaster 02755 /var/lib/mixmaster
|
| 31 |
fi
|
| 32 |
# Give the mixmaster user write permissions to /var/log/mixmaster
|
| 33 |
if ( ! dpkg-statoverride --list /var/log/mixmaster > /dev/null ); then
|
| 34 |
dpkg-statoverride --update --add root mixmaster 02770 /var/log/mixmaster
|
| 35 |
fi
|
| 36 |
# Give the mixmaster user write permissions to /var/run/mixmaster
|
| 37 |
if ( ! dpkg-statoverride --list /var/run/mixmaster > /dev/null ); then
|
| 38 |
dpkg-statoverride --update --add root mixmaster 02775 /var/run/mixmaster
|
| 39 |
fi
|
| 40 |
# Fix permissions on /etc/mixmaster/remailer.conf
|
| 41 |
if ( ! dpkg-statoverride --list $REMAILCONFIGFILE > /dev/null ); then
|
| 42 |
dpkg-statoverride --update --add root mixmaster 00640 $REMAILCONFIGFILE
|
| 43 |
fi
|
| 44 |
|
| 45 |
|
| 46 |
########################################
|
| 47 |
# setup all needed directories and files
|
| 48 |
########################################
|
| 49 |
if [ ! -e /var/lib/mixmaster/Mix ]; then
|
| 50 |
mkdir /var/lib/mixmaster/Mix
|
| 51 |
chown mixmaster: /var/lib/mixmaster/Mix
|
| 52 |
chmod 2700 /var/lib/mixmaster/Mix
|
| 53 |
ln -s $REMAILCONFIGFILE /var/lib/mixmaster/Mix/mix.cfg
|
| 54 |
ln -s $UPDATECONFIG /var/lib/mixmaster/Mix/update.conf
|
| 55 |
if [ -e /var/lib/mixmaster/Mix/dest.blk ]; then
|
| 56 |
DESTBLOCK /var/lib/mixmaster/Mix/dest.blk
|
| 57 |
chown mixmaster: /var/lib/mixmaster/Mix/dest.blk
|
| 58 |
fi
|
| 59 |
fi
|
| 60 |
if [ ! -e /var/lib/mixmaster/.Mix ]; then
|
| 61 |
ln -s Mix /var/lib/mixmaster/.Mix
|
| 62 |
fi
|
| 63 |
if [ ! -e /var/lib/mixmaster/stats ]; then
|
| 64 |
mkdir /var/lib/mixmaster/stats
|
| 65 |
chown mixmaster: /var/lib/mixmaster/stats
|
| 66 |
chmod 2755 /var/lib/mixmaster/stats
|
| 67 |
|
| 68 |
# The stats are probably way tooo old, but better than nothing
|
| 69 |
FILLIN MLIST /var/lib/mixmaster/stats/mlist.txt
|
| 70 |
FILLIN RLIST /var/lib/mixmaster/stats/rlist.txt
|
| 71 |
FILLIN PUBRINGMIX /var/lib/mixmaster/stats/pubring.mix
|
| 72 |
FILLIN PUBRINGASC /var/lib/mixmaster/stats/pubring.asc
|
| 73 |
|
| 74 |
chown mixmaster: /var/lib/mixmaster/stats/mlist.txt \
|
| 75 |
/var/lib/mixmaster/stats/rlist.txt \
|
| 76 |
/var/lib/mixmaster/stats/pubring.mix \
|
| 77 |
/var/lib/mixmaster/stats/pubring.asc
|
| 78 |
fi
|
| 79 |
if [ ! -e /var/lib/mixmaster/used-stats ]; then
|
| 80 |
ln -s stats /var/lib/mixmaster/used-stats
|
| 81 |
fi
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
#DEBHELPER#
|
| 86 |
|
| 87 |
|
| 88 |
########################################################################
|
| 89 |
# Configuration reprise
|
| 90 |
########################################################################
|
| 91 |
if [ "$1" = "configure" ]; then
|
| 92 |
db_get mixmaster/stats-update || true
|
| 93 |
if [ "$RET" = "true" ]; then
|
| 94 |
# Get resent stats _NOW_
|
| 95 |
su mixmaster -c "/usr/bin/mixmaster-update" || echo "Getting stats failed" >&2
|
| 96 |
# But don't do it again unless the user asks for it
|
| 97 |
db_set mixmaster/stats-update false
|
| 98 |
fi
|
| 99 |
fi
|
| 100 |
|
| 101 |
db_stop
|
| 102 |
|
| 103 |
# vim:set ts=4:
|
| 104 |
# vim:set shiftwidth=4:
|