#! /bin/sh set -e prevver="$2" initperms() { chown munin:adm /var/log/munin chmod 755 /var/log/munin chown root:munin /etc/munin/plugin-conf.d chmod 750 /etc/munin/plugin-conf.d } # create symlinks below /etc/munin/plugins/ for all plugins reporting "yes" via "autoconf" init_plugins() { TMPFILE=$(mktemp /tmp/munin-node.configure.XXXXXXXXXX) TMPFILE_STDERR=$(mktemp /tmp/munin-node.configure.err.XXXXXXXXXX) MUNIN_NODE_CONF_LOG="/var/log/munin/munin-node-configure.log" if [ -n "$prevver" ]; then MUNIN_NODE_CMD="munin-node-configure --shell --newer '${prevver%-*}'" echo -n "Initializing new plugins.." else MUNIN_NODE_CMD="munin-node-configure --shell" echo -n "Initializing plugins.." fi # munin-node-conf returns 1 in case of partial plugin autoconf # errors. We need to ignore these errors as even one plugin # can fail the entire process. See Debian bug #539886 for details. $MUNIN_NODE_CMD 2>"$TMPFILE_STDERR" >"$TMPFILE" || true # log the details { echo "$(date '+%b %d %T') - Starting $MUNIN_NODE_CMD" cat "$TMPFILE" if [ -s "$TMPFILE_STDERR" ]; then echo "The following errors were reported by $MUNIN_NODE_CMD" cat "$TMPFILE_STDERR" fi } >>"$MUNIN_NODE_CONF_LOG" # create the symlinks for new plugins sh <"$TMPFILE" echo "done." rm -f "$TMPFILE" "$TMPFILE_STDERR" } case "$1" in configure) if [ -z "$2" ]; then initperms fi init_plugins ;; triggered) if [ "$2" = "perl-major-upgrade" ]; then invoke-rc.d munin-node restart fi ;; esac # Automatically added by dh_installtmpfiles/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "$(command -v systemd-tmpfiles)" ]; then systemd-tmpfiles ${DPKG_ROOT:+--root="$DPKG_ROOT"} --create munin-node.conf || true fi fi # End automatically added section # Automatically added by dh_installdeb/13.14.1 dpkg-maintscript-helper rm_conffile /etc/init/munin-node.conf 2.0.49-2\~ -- "$@" # End automatically added section # Automatically added by dh_installinit/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/munin-node" ]; then update-rc.d munin-node defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native munin-node $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'munin-node.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'munin-node.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'munin-node.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'munin-node.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'munin-node.service' >/dev/null || true fi fi # End automatically added section