blob: edceb2a63158a4e8103477d34877de720ca1b984 [file] [log] [blame]
Shock Jiang010a4ae2014-11-26 14:55:19 -08001#!/bin/sh
2# preinst script for nfd
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9# * <new-preinst> `install'
10# * <new-preinst> `install' <old-version>
11# * <new-preinst> `upgrade' <old-version>
12# * <old-preinst> `abort-upgrade' <new-version>
13# for details, see http://www.debian.org/doc/debian-policy/ or
14# the debian-policy package
15
16
17case "$1" in
18 install|upgrade)
19 # Now we have to ensure the following state:
20 # /etc/passwd: ndns:x:YYY:ZZZ:NDNS User:/nonexistent:/bin/false
21 # /etc/group: ndns:x:ZZZ:
22 #
23 # Sadly there could any state be present on the system so we have to
24 # modify everything carefully i.e. not doing a chown before creating
25 # the user etc...
26
27 # creating ndns group if he isn't already there
28 if ! getent group ndns >/dev/null; then
29 # Adding system group: ndns.
30 addgroup --system ndns >/dev/null
31 fi
32
33 # creating ndns user if he isn't already there
34 if ! getent passwd ndns >/dev/null; then
35 # Adding system user: ndns.
36 adduser \
37 --system \
38 --disabled-login \
39 --ingroup ndns \
40 --home /var/lib/ndns \
41 --gecos "NDNS User" \
42 --shell /bin/bash \
43 ndns >/dev/null
44 fi
45 ;;
46
47 abort-upgrade)
48 ;;
49
50 *)
51 echo "preinst called with unknown argument \`$1'" >&2
52 exit 1
53 ;;
54esac
55
56# dh_installdeb will replace this with shell code automatically
57# generated by other debhelper scripts.
58
59#DEBHELPER#
60
61exit 0