#! /bin/sh # postinst script for xymon # # see: dh_installdeb(1) . /usr/share/debconf/confmodule set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package # Workaround for http://bugs.debian.org/560317 in case debconf is too old like on Squeeze export DPKG_MAINTSCRIPT_PACKAGE=${DPKG_MAINTSCRIPT_PACKAGE:-xymon} export DPKG_MAINTSCRIPT_NAME=${DPKG_MAINTSCRIPT_NAME:-postinst} case "$1" in configure) # Do the debconf stuff if [ "$2" ] && dpkg --compare-versions "$2" lt "4.3.7"; then db_get hobbit-client/automatic-xymon-migration if [ "$RET" = "true" ]; then MIGRATE="true" echo "Migrating xymon files from hobbit ..." fi fi db_stop # Setup permissions for the newly created "xymon" user to write # data where he needs to. # And for the Apache-run CGI's to generate reports. # Create or migrate directories [ "$MIGRATE" ] && test -d /var/run/hobbit -a ! -d /var/run/xymon && mv -v /var/run/hobbit /var/run/xymon || true test -d /var/run/xymon || mkdir /var/run/xymon chown xymon:xymon /var/run/xymon [ "$MIGRATE" ] && test -d /var/log/hobbit -a ! -d /var/log/xymon && mv -v /var/log/hobbit /var/log/xymon || true test -d /var/log/xymon || mkdir /var/log/xymon chown xymon:adm /var/log/xymon ; chmod 2755 /var/log/xymon cd /var/lib/xymon; chown xymon:xymon . acks data disabled hist histlogs hostdata logs rrd tmp www cd /var/lib/xymon/www; chown xymon:xymon html notes wml rep snap; chgrp www-data rep snap; chmod g+w rep snap cd /etc/xymon; if [ -e critical.cfg ]; then chgrp www-data critical.cfg chmod g+w critical.cfg fi if [ -e critical.cfg.bak ]; then chgrp www-data critical.cfg.bak chmod g+w critical.cfg.bak fi if [ "$MIGRATE" ] && which file-rename > /dev/null; then find /var/lib/xymon '(' -name '*bbgen*' -o \ -name '*bbtest*' -o \ -name '*bbproxy*' -o \ -name '*hobbitd*' -o \ -name '*hobbit2*' -o \ -name hobbit.rrd ')' \ -exec file-rename -v 's/bb(gen|proxy)/xymon$1/;s/bbtest/xymonnet/;s/hobbit(d|2|\.rrd)/xymon$1/' '{}' + ; fi if [ "$MIGRATE" ] && test -e /etc/hobbit/bb-hosts ; then mv -v /etc/hobbit/bb-hosts /etc/xymon/hosts.cfg fi if ! test -e /etc/xymon/hosts.cfg ; then if test -e /etc/default/xymon-client ; then . /etc/default/xymon-client || true fi cat > /etc/xymon/hosts.cfg < /dev/null; then echo "Fixing RRD parameters in clock.rrd files found ..." for i in `find /var/lib/hobbit/rrd/ /var/lib/xymon/rrd/ -name clock.rrd` ; do rrdtool tune $i -i la:U done fi fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # Automatically added by dh_apache2/UNDECLARED if true; then if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then . /usr/share/apache2/apache2-maintscript-helper for conf in xymon ; do apache2_invoke enconf $conf || exit 1 done fi fi # End automatically added section # Automatically added by dh_installdeb/13.7.1 dpkg-maintscript-helper mv_conffile /etc/apache2/conf.d/hobbit /etc/apache2/conf-available/xymon.conf 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/init.d/hobbit /etc/init.d/xymon 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/client-local.cfg /etc/xymon/client-local.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/columndoc.csv /etc/xymon/columndoc.csv 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/hobbitserver.cfg /etc/xymon/xymonserver.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/acknowledge_header /etc/xymon/web/acknowledge_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/acknowledge_form /etc/xymon/web/acknowledge_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/columndoc_header /etc/xymon/web/columndoc_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/confreport_back /etc/xymon/web/confreport_back 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/confreport_footer /etc/xymon/web/confreport_footer 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/confreport_front /etc/xymon/web/confreport_front 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/confreport_header /etc/xymon/web/confreport_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/event_form /etc/xymon/web/event_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/event_header /etc/xymon/web/event_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/findhost_form /etc/xymon/web/findhost_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/findhost_header /etc/xymon/web/findhost_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/ghosts_header /etc/xymon/web/ghosts_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/graphs_header /etc/xymon/web/graphs_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/hist_header /etc/xymon/web/hist_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/histlog_header /etc/xymon/web/histlog_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/hostgraphs_form /etc/xymon/web/hostgraphs_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/hostgraphs_header /etc/xymon/web/hostgraphs_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/hostlist_form /etc/xymon/web/hostlist_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/hostlist_header /etc/xymon/web/hostlist_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/hostsvc_header /etc/xymon/web/hostsvc_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/info_header /etc/xymon/web/info_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/maint_form /etc/xymon/web/maint_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/maint_header /etc/xymon/web/maint_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/maintact_header /etc/xymon/web/maintact_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/notify_form /etc/xymon/web/notify_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/notify_footer /etc/xymon/web/notify_footer 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/notify_header /etc/xymon/web/notify_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/perfdata_form /etc/xymon/web/perfdata_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/perfdata_header /etc/xymon/web/perfdata_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/replog_header /etc/xymon/web/replog_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/report_form /etc/xymon/web/report_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/report_form_daily /etc/xymon/web/report_form_daily 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/report_form_monthly /etc/xymon/web/report_form_monthly 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/report_form_weekly /etc/xymon/web/report_form_weekly 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/report_header /etc/xymon/web/report_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/snapshot_form /etc/xymon/web/snapshot_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/snapshot_header /etc/xymon/web/snapshot_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/topchanges_form /etc/xymon/web/topchanges_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/topchanges_header /etc/xymon/web/topchanges_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/trends_form /etc/xymon/web/trends_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/useradm_form /etc/xymon/web/useradm_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/useradm_header /etc/xymon/web/useradm_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/zoom.js /etc/xymon/web/zoom.js 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/hobbit-alerts.cfg /etc/xymon/alerts.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/hobbit-nkview.cfg /etc/xymon/critical.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/hobbit-nkview.cfg.bak /etc/xymon/critical.cfg.bak 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/hobbitcgi.cfg /etc/xymon/cgioptions.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/hobbitgraph.cfg /etc/xymon/graphs.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/bbcombotest.cfg /etc/xymon/combo.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/hobbitnk_footer /etc/xymon/web/critical_footer 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/hobbitnk_header /etc/xymon/web/critical_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/menu.cfg /etc/xymon/xymonmenu.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/hobbitlaunch.cfg /etc/xymon/tasks.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/bb-services /etc/xymon/protocols.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/hobbit-clients.cfg /etc/xymon/analysis.cfg 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/bb_footer /etc/xymon/web/stdnormal_footer 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/bb_header /etc/xymon/web/stdnormal_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/bb2_header /etc/xymon/web/stdnongreen_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/bbnk_header /etc/xymon/web/stdcritical_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/bbsnap_header /etc/xymon/web/snapnormal_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/bbsnap2_header /etc/xymon/web/snapnongreen_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/bbsnapnk_header /etc/xymon/web/snapcritical_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/bbrep_header /etc/xymon/web/repnormal_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/nkack_form /etc/xymon/web/critack_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/nkedit_form /etc/xymon/web/critedit_form 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/hobbit/web/nkedit_header /etc/xymon/web/critedit_header 4.3.7-1\~\~ xymon -- "$@" dpkg-maintscript-helper mv_conffile /etc/apache2/conf.d/xymon /etc/apache2/conf-available/xymon.conf 4.3.17-2\~\~ xymon -- "$@" # End automatically added section # Automatically added by dh_installinit/13.7.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/xymon" ]; then update-rc.d xymon defaults 98 02 >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native xymon $_dh_action || exit 1 fi fi # End automatically added section case "$1" in configure) if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then . /usr/share/apache2/apache2-maintscript-helper # Enable CGI support apache2_invoke enmod cgi # Needed by the rewrite rules to migrate from old hobbit based URLs apache2_invoke enmod rewrite # Finally enable the xymon web interface apache2_invoke enconf xymon elif test -e /etc/init.d/apache2 ; then invoke-rc.d apache2 reload || : fi ;; esac exit 0