Code

new upstream, various fixes
[pkg-nagvis.git] / debian / postinst
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/nagvis.ini.php'
12         dbc_generate_include_owner='www-data:www-data'
13         dbc_generate_include_args='--ucf -o template_infile=/usr/share/nagvis/debian/nagvis.ini.php-sample'
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
42                 
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/etc/maps
53         ucf /usr/share/nagvis/debian/apache.conf /etc/nagvis/apache.conf
54         #if ! [ -e /etc/apache2/conf.d/nagvis.conf ]; then
55         #       ln -s /etc/nagvis/apache.conf /etc/apache2/conf.d/nagvis.conf
56         #fi
58     ;;
60     abort-upgrade|abort-remove|abort-deconfigure)
61     ;;
63     *)
64         echo "postinst called with unknown argument \`$1'" >&2
65         exit 1
66     ;;
67 esac
69 # dh_installdeb will replace this with shell code automatically
70 # generated by other debhelper scripts.
72 #DEBHELPER#
74 exit 0