2 # postinst script for omd
4 # see: dh_installdeb(1)
8 NAGIOS_PLUGIN_PATH
="/omd/versions/###OMD_VERSION###/lib/nagios/plugins"
9 SUID_PLUGINS
="check_icmp check_dhcp"
10 PROGRAM_PATH
="/omd/versions/###OMD_VERSION###/bin"
11 SUID_PROGRAMS
="mkeventd_open514"
12 APACHE_OMD_CONF
="/etc/apache2/conf.d/zzz_omd.conf"
14 # Source debconf library.
15 .
/usr
/share
/debconf
/confmodule
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>
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
35 # only do something when no setting exists
36 if ! dpkg-statoverride
--list "$file" >/dev
/null
2>&1; then
37 chown
"$user":"$group" "$file"
45 update-alternatives
--install /omd
/versions
/default \
46 omd
/omd
/versions
/###OMD_VERSION### ###OMD_SERIAL### \
47 --slave /usr
/bin
/omd omd.bin
/omd
/versions
/###OMD_VERSION###/bin/omd \
48 --slave /usr
/share
/man
/man
8/omd
.8.gz omd.man8 \
49 /omd
/versions
/###OMD_VERSION###/share/man/man8/omd.8.gz
51 # -- looking for group nagios, create it, if not exist
52 if ! getent group omd
> /dev
/null
; then
53 echo 'Adding system group omd' 1>&2
54 addgroup
--system --force-badname omd
> /dev
/null
57 db_get omd
/nagios-plugins-suid || true
58 if [ "$RET" = "true" ]; then
63 for PLUGIN
in $SUID_PLUGINS; do
64 setperm root omd
$PLUGPERM $NAGIOS_PLUGIN_PATH/$PLUGIN
66 for PROGRAM
in $SUID_PROGRAMS; do
67 setperm root omd
$PLUGPERM $PROGRAM_PATH/$PROGRAM
71 # -- create apache config include if not exist
72 if test -d /etc
/apache
2/conf-available
; then
73 # On e.g. ubuntu 13.10 conf.d is not loaded anymore, use conf-available
74 APACHE_OMD_CONF
="/etc/apache2/conf-available/zzz_omd.conf"
77 if ! test -e $APACHE_OMD_CONF; then
78 echo "Include /omd/apache/*.conf" > $APACHE_OMD_CONF
79 # avoid apache error message including /omd/apache if no site exist
80 touch "/omd/apache/empty.conf"
82 # -- enable conf include, when available
83 if test -d /etc
/apache
2/conf-available
; then
88 # -- enable apache modules
89 if ! test -e /etc
/apache
2/mods-enabled
/proxy_http.load
; then
90 a2enmod proxy_http
# also enables dependend modules
92 if ! test -e /etc
/apache
2/mods-enabled
/rewrite.load
; then
97 DEFAULT
=/etc
/default
/omd
98 if ! test -e $DEFAULT ; then
99 echo "AUTOSTART=1" > $DEFAULT
103 abort-upgrade|abort-remove|abort-deconfigure
)
108 echo "postinst called with unknown argument \`$1'" >&2
113 # dh_installdeb will replace this with shell code automatically
114 # generated by other debhelper scripts.