This file is indexed.

postinst is in xymon-client 4.3.28-3build1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#! /bin/sh
# postinst script for xymon-client
#
# see: dh_installdeb(1)

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#

. /usr/share/debconf/confmodule

set -e

# Workaround for http://bugs.debian.org/560317 in case debconf is too old like on Squeeze
export DPKG_MAINTSCRIPT_PACKAGE=${DPKG_MAINTSCRIPT_PACKAGE:-xymon-client}
export DPKG_MAINTSCRIPT_NAME=${DPKG_MAINTSCRIPT_NAME:-postinst}

case "$1" in
    configure)
	# Do the debconf stuff
	db_get hobbit-client/HOBBITSERVERS
	HOBBITSERVERS="$RET"
	db_get hobbit-client/CLIENTHOSTNAME
	CLIENTHOSTNAME="$RET"
	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-client files from hobbit ..."
		fi
	fi
	db_stop

	# Create new group
	getent group xymon > /dev/null || addgroup --system xymon

	# Create or migrate user
	getent passwd xymon > /dev/null || adduser --system \
		--home /var/lib/xymon --no-create-home \
		--ingroup xymon --disabled-password --disabled-login \
		--gecos "Xymon System Monitor" xymon
	if [ "$MIGRATE" ] && getent passwd hobbit > /dev/null; then
	    for d in /etc/hobbit /etc/xymon /var/*/hobbit /var/*/xymon; do
                if [ -d $d ]; then
		    find $d -user hobbit -print0 2>/dev/null | xargs -0 -r chown xymon
                fi
	    done
	    pkill -u hobbit vmstat || true
	    deluser hobbit || echo "Couldn't delete user hobbit, please remove it manually"
	fi

	# Migrate old group
	if [ "$MIGRATE" ] && getent group hobbit > /dev/null; then
	    for d in /etc/hobbit /etc/xymon /var/*/hobbit /var/*/xymon; do
                if [ -d $d ]; then
		    find $d -group hobbit -print0 2>/dev/null | xargs -0 -r chgrp xymon
                fi
	    done
	    delgroup --only-if-empty hobbit || echo "Couldn't delete group hobbit, please remove it manually"
	fi

	# 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

	test -d /var/lib/xymon/tmp || mkdir /var/lib/xymon/tmp
	chown xymon:xymon /var/lib/xymon/tmp

	[ "$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

	# Update configuration file
	CONFIGFILE=/etc/default/xymon-client
	test -e $CONFIGFILE || cp /usr/share/xymon/xymon-client.default.template $CONFIGFILE
	if grep -Eq "^(HOBBIT|XYMON)SERVERS=" $CONFIGFILE ; then
		sed -i -e "s/^\(HOBBIT\|XYMON\)SERVERS=.*/XYMONSERVERS=\"$HOBBITSERVERS\"/" \
			$CONFIGFILE
	else
		echo "XYMONSERVERS=\"$HOBBITSERVERS\"" >> $CONFIGFILE
	fi
	if grep -q "^CLIENTHOSTNAME=" $CONFIGFILE ; then
		sed -i -e "s/^CLIENTHOSTNAME=.*/CLIENTHOSTNAME=\"$CLIENTHOSTNAME\"/" \
			$CONFIGFILE
	else
		echo "CLIENTHOSTNAME=\"$CLIENTHOSTNAME\"" >> $CONFIGFILE
	fi

	# Remove empty directories in /etc/hobbit and possibly /etc/hobbit itself.
	[ "$MIGRATE" ] && if test -d /etc/hobbit; then
		rmdir --ignore-fail-on-non-empty -p /etc/hobbit/*/ || true
	fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)

    ;;

    *)
	echo "postinst called with unknown argument \`$1'" >&2
	exit 1
    ;;
esac

# Automatically added by dh_installdeb/11.1.4ubuntu1
dpkg-maintscript-helper mv_conffile /etc/init.d/hobbit-client /etc/init.d/xymon-client 4.3.7-1\~\~ xymon-client -- "$@"
dpkg-maintscript-helper mv_conffile /etc/logrotate.d/hobbit-client /etc/logrotate.d/xymon-client 4.3.7-1\~\~ xymon-client -- "$@"
dpkg-maintscript-helper mv_conffile /etc/hobbit/localclient.cfg /etc/xymon/localclient.cfg 4.3.7-1\~\~ xymon-client -- "$@"
dpkg-maintscript-helper mv_conffile /etc/hobbit/hobbitclient.cfg /etc/xymon/xymonclient.cfg 4.3.7-1\~\~ xymon-client -- "$@"
dpkg-maintscript-helper mv_conffile /etc/hobbit/clientlaunch.cfg /etc/xymon/clientlaunch.cfg 4.3.7-1\~\~ xymon-client -- "$@"
# End automatically added section
# Automatically added by dh_installinit/11.1.4ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/xymon-client" ]; then
		update-rc.d xymon-client defaults 98 02 >/dev/null
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		invoke-rc.d xymon-client $_dh_action || exit 1
	fi
fi
# End automatically added section


exit 0