%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/thread-self/root/var/lib/dpkg/info/
Upload File :
Create Path :
Current File : //proc/thread-self/root/var/lib/dpkg/info/munin-node.postinst

#! /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
}

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 [ "$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 if 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
	if [ -f $TMPFILE ]; then
		DATE=`date '+%b %d %T'`
		echo "$DATE - Starting $MUNIN_NODE_CMD" >> $MUNIN_NODE_CONF_LOG
		cat $TMPFILE >> $MUNIN_NODE_CONF_LOG
        if [ -s $TMPFILE_STDERR ]; then
			echo "The following errors were reported by $MUNIN_NODE_CMD" \
			>> $MUNIN_NODE_CONF_LOG 
			cat $TMPFILE_STDERR >> $MUNIN_NODE_CONF_LOG
        fi
		sh < $TMPFILE
	else 
		echo "failed."
	fi
	echo "done."
	rm -f $TMPFILE $TMPFILE_STDERR
	echo -n "Restarting munin-node.."
	invoke-rc.d munin-node restart
}

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
		;;
	abort-upgrade|abort-deconfigure|abort-remove)
		:
		;;
	*)
		echo "Called with unknown argument $1, bailing out."
		exit 1
		;;
esac

# Automatically added by dh_installsystemd/13.5.2ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# In case this system is running systemd, we need to ensure that all
	# necessary tmpfiles (if any) are created before starting.
	if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ] ; then
		systemd-tmpfiles --create munin-node.conf >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installdeb/13.5.2ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/munin-node.conf 2.0.49-2\~ -- "$@"
# End automatically added section
# Automatically added by dh_installinit/13.5.2ubuntu1
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
		invoke-rc.d --skip-systemd-native munin-node restart || exit 1
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.5.2ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# This will only remove masks created by d-s-h on package removal.
	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.5.2ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ]; then
		systemctl --system daemon-reload >/dev/null || true
		deb-systemd-invoke restart 'munin-node.service' >/dev/null || true
	fi
fi
# End automatically added section


Zerion Mini Shell 1.0