1 #!/bin/sh
2 # postinst script for nagvis
3 #
4 # see: dh_installdeb(1)
6 set -e
8 . /usr/share/debconf/confmodule
9 if [ -f /usr/share/dbconfig-common/dpkg/frontend.postinst.mysql ]; then
10 . /usr/share/dbconfig-common/dpkg/frontend.postinst.mysql
11 dbc_generate_include='template:/etc/nagvis/config.ini.php'
12 dbc_generate_include_owner='www-data:www-data'
13 dbc_generate_include_args='--ucf -o template_infile=/usr/share/nagvis/debian/config.ini.php.dist'
14 dbc_go nagvis $@
15 fi
16 db_stop
18 # summary of how this script can be called:
19 # * <postinst> `configure' <most-recently-configured-version>
20 # * <old-postinst> `abort-upgrade' <new version>
21 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
22 # <new-version>
23 # * <postinst> `abort-remove'
24 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
25 # <failed-install-package> <version> `removing'
26 # <conflicting-package> <version>
27 # for details, see http://www.debian.org/doc/debian-policy/ or
28 # the debian-policy package
30 setperm() { # thx 2 nagios2/debian/nagios2-common.postinst
31 local user="$1"
32 local group="$2"
33 local mode="$3"
34 local file="$4"
35 shift 4
36 # only do something when no setting exists
37 if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
38 chown "$user":"$group" "$file"
39 chmod "$mode" "$file"
40 fi
43 }
45 case "$1" in
46 configure)
47 for f in `find /usr/share/nagvis/htdocs -type f -o -type d 2>/dev/null`; do
48 test -f $f && setperm www-data www-data 0644 $f
49 test -d $f && setperm www-data www-data 0755 $f
50 done
51 setperm www-data www-data 0775 /usr/share/nagvis/htdocs/nagvis/images/maps
52 setperm www-data www-data 0775 /usr/share/nagvis/htdocs/nagvis/etc/maps
54 ucf /usr/share/nagvis/debian/apache.conf /etc/nagvis/apache.conf
55 ;;
57 abort-upgrade|abort-remove|abort-deconfigure)
58 ;;
60 *)
61 echo "postinst called with unknown argument \`$1'" >&2
62 exit 1
63 ;;
64 esac
66 # dh_installdeb will replace this with shell code automatically
67 # generated by other debhelper scripts.
69 #DEBHELPER#
71 exit 0