456919ac1a3a1e086b321b3462935c76839c2d66
[munin-cn.git] / debian / postinst
1 #!/bin/sh
2 # postinst script for bind9-cn
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7
8 # summary of how this script can be called:
9 #        * <postinst> `configure' <most-recently-configured-version>
10 #        * <old-postinst> `abort-upgrade' <new version>
11 #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12 #          <new-version>
13 #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
14 #          <failed-install-package> <version> `removing'
15 #          <conflicting-package> <version>
16 # for details, see http://www.debian.org/doc/debian-policy/ or
17 # the debian-policy package
18 #
19
20 case "$1" in
21     configure|reconfigure)
22       # continue below
23     ;;
24
25     *)
26         exit 0
27     ;;
28 esac
29
30 # import CN-functions
31 . /usr/share/carnet-tools/functions.sh
32
33 # variables
34 CARNET_HOSTNAME=`hostname`
35 CARNET_DOMAINNAME=`hostname --domain`
36
37 # fix the hostname in munin/munin-node configuration
38 cp_check_and_sed 'localhost.localdomain' \
39     "s/localhost.localdomain/$CARNET_HOSTNAME.$CARNET_DOMAINNAME/g" \
40     /etc/munin/munin.conf || true
41 cp_check_and_sed 'localhost.localdomain' \
42     "s/localhost.localdomain/$CARNET_HOSTNAME.$CARNET_DOMAINNAME/g" \
43     /etc/munin/munin-node.conf || true
44
45 # restart the services
46 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
47         invoke-rc.d munin-node restart || exit $?
48 else
49         /etc/init.d/munin-node restart || exit $?
50 fi
51
52 # dh_installdeb will replace this with shell code automatically
53 # generated by other debhelper scripts.
54
55 #DEBHELPER#
56
57 exit 0