Debian Codegraph @

debian/snmpd.postinst

raw
1 #!/bin/sh
2
3 SNMP_DIR="/var/lib/snmp"
4 SNMP_USER="Debian-snmp"
5 SNMP_GROUP="$SNMP_USER"
6 SNMP_SHELL="/bin/false"
7 SNMPD_CONF="/etc/snmp/snmpd.conf"
8
9 set -e
10
11 case "$1" in
12 configure)
13
14 . /usr/share/debconf/confmodule
15 db_version 2.0
16
17 adduser --quiet --system --group --home "$SNMP_DIR" \
18 --disabled-password --disabled-login \
19 --shell "$SNMP_SHELL" --force-badname "$SNMP_USER"
20
21 # care if SNMP_DIR is used by previous "snmp" user
22 chown "$SNMP_USER":"$SNMP_GROUP" "$SNMP_DIR"
23 if [ -f "$SNMP_DIR/snmpd.conf" ]; then
24 chown "$SNMP_USER":"$SNMP_GROUP" "$SNMP_DIR/snmpd.conf"
25 fi
26
27 # Change group of snmpd.conf to SNMP_GROUP #998152
28 # This is so its group readable for snmpd reload
29 if [ -f $SNMPD_CONF ]; then
30 chgrp "$SNMP_GROUP" $SNMPD_CONF
31 fi
32
33 # Bug#709087
34 DOCDIR=/usr/share/doc/snmpd
35 DOCLINK=libsnmp30
36
37 if [ -d $DOCDIR ] && [ ! -L $DOCDIR ]; then
38 rmdir $DOCDIR
39 ln -s $DOCLINK $DOCDIR
40 fi
41 ;;
42
43 abort-upgrade|abort-remove|abort-deconfigure)
44 ;;
45
46 *)
47 echo "postinst called with unknown argument \`$1'" >&2
48 exit 1
49 ;;
50 esac
51
52 # dh_installdeb will replace this with shell code automatically
53 # generated by other debhelper scripts.
54
55 #DEBHELPER#
56
57 exit 0