blob: 1407a0ef4047d4b50385a349685a92f8e7aaf387 [file] [log] [blame]
#!/bin/sh
# preinst script for nlsr
#
# see: dh_installdeb(1)
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>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
# Now we have to ensure the following state:
# /etc/passwd: nlsr:x:YYY:ZZZ:NLSR User:/nonexistent:/bin/false
# /etc/group: nlsr:x:ZZZ:
#
# Sadly there could any state be present on the system so we have to
# modify everything carefully i.e. not doing a chown before creating
# the user etc...
# creating nlsr group if he isn't already there
if ! getent group nlsr >/dev/null; then
# Adding system group: nlsr.
addgroup --system nlsr >/dev/null
fi
# creating nlsr user if he isn't already there
if ! getent passwd nlsr >/dev/null; then
# Adding system user: nlsr.
adduser \
--system \
--disabled-login \
--ingroup nlsr \
--home /nonexistent \
--gecos "NLSR User" \
--shell /bin/false \
nlsr >/dev/null
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0