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
|
#!/bin/sh
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
case "$1" in
install|upgrade)
SPECTERUSER=specter
SPECTERGROUP=specter
# 1. create group if not existing
if ! getent group | grep -q "^$SPECTERGROUP:" ; then
addgroup --quiet --system $SPECTERGROUP 2>/dev/null || true
fi
# 2. create user if not existing
if ! getent passwd | grep -q "^$SPECTERUSER:"; then
adduser --quiet \
--system \
--ingroup $SPECTERGROUP \
--no-create-home \
--disabled-password \
$SPECTERUSER 2>/dev/null || true
fi
# 3. adjust passwd entry
usermod -c "Specter Logging Facility" \
-g $SPECTERGROUP \
-d /var/log \
$SPECTERUSER
# 4. Creating logs. Debian specter works over specter user privileges.
# Its very imporatant to remember that specter creates required log files
# in /var/log _before_ it drops root privileges, so log files are created with
# uid 0, gid 0 permissions. In that case it causes problem while SIGHUPing
# specter. This script creates _all_ used by specter files in /var and sets
# correct permissions.
touch /var/log/specter.log
touch /var/log/specter.logemu
touch /var/log/specter.oprint
touch /var/log/specter.pcap
chown $SPECTERUSER.$SPECTERGROUP /var/log/specter*
;;
configure)
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
|