Code

git-svn-id: svn://svn.debian.org/svn/pkg-nagios/nagvis/trunk@1397 98d490a6-b407-0410...
[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 -C\; -o template_infile=/usr/share/nagvis/debian/nagvis.ini.php-sample'
14         dbc_go nagvis $@
15 fi
17 # summary of how this script can be called:
18 #        * <postinst> `configure' <most-recently-configured-version>
19 #        * <old-postinst> `abort-upgrade' <new version>
20 #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
21 #          <new-version>
22 #        * <postinst> `abort-remove'
23 #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
24 #          <failed-install-package> <version> `removing'
25 #          <conflicting-package> <version>
26 # for details, see http://www.debian.org/doc/debian-policy/ or
27 # the debian-policy package
29 setperm() { # thx 2 nagios2/debian/nagios2-common.postinst
30         local user="$1"
31         local group="$2"
32         local mode="$3"
33         local file="$4"
34         shift 4
35         # only do something when no setting exists
36         if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
37                 chown "$user":"$group" "$file"
38                 chmod "$mode" "$file"
39         fi
41                 
42 }
44 case "$1" in
45     configure)
46         for f in `find /usr/share/nagvis/htdocs -type f -o -type d 2>/dev/null`; do
47                 test -f $f && setperm www-data www-data 0644 $f
48                 test -d $f && setperm www-data www-data 0755 $f
49         done
50         setperm www-data www-data 0775 /usr/share/nagvis/htdocs/nagvis/etc/maps
52         ucf /usr/share/nagvis/debian/apache.conf /etc/nagvis/apache.conf
53         #if ! [ -e /etc/apache2/conf.d/nagvis.conf ]; then
54         #       ln -s /etc/nagvis/apache.conf /etc/apache2/conf.d/nagvis.conf
55         #fi
57     ;;
59     abort-upgrade|abort-remove|abort-deconfigure)
60     ;;
62     *)
63         echo "postinst called with unknown argument \`$1'" >&2
64         exit 1
65     ;;
66 esac
68 db_stop
69 # dh_installdeb will replace this with shell code automatically
70 # generated by other debhelper scripts.
72 #DEBHELPER#
74 exit 0