This file is indexed.

postinst is in xymon-client 4.3.7-1ubuntu2.

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
#! /bin/sh
# postinst script for hobbit
#
# 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)
	# 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 getent passwd hobbit > /dev/null; then
	    for d in  /etc/hobbit /etc/xymon /var/*/hobbit /var/*/xymon; do
		find $d -user hobbit -exec chown -c xymon '{}' +;
	    done
	    pkill -u hobbit vmstat
	    deluser hobbit || echo "Couldn't delete user hobbit, please remove it manually"
	fi

	# Migrate old group
	if getent group hobbit > /dev/null; then
	    for d in /etc/hobbit /etc/xymon /var/*/hobbit /var/*/xymon; do
		find $d -group hobbit -exec chgrp -c xymon '{}' +;
	    done
	    delgroup hobbit || echo "Couldn't delete group hobbit, please remove it manually"
	fi

	# Create or migrate directories
	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

	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

	# Do the debconf stuff
	db_get hobbit-client/HOBBITSERVERS
	HOBBITSERVERS="$RET"
	db_get hobbit-client/CLIENTHOSTNAME
	CLIENTHOSTNAME="$RET"
	db_stop

	# 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.
	rmdir --ignore-fail-on-non-empty -pv /etc/hobbit/*/ || true
    ;;

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

    ;;

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

# Automatically added by dh_installinit
if [ -x "/etc/init.d/xymon-client" ] || [ -e "/etc/init/xymon-client.conf" ]; then
	if [ ! -e "/etc/init/xymon-client.conf" ]; then
		update-rc.d xymon-client defaults 98 02 >/dev/null
	fi
	invoke-rc.d xymon-client start || exit $?
fi
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/init.d/hobbit-client /etc/init.d/xymon-client 4.3.7-1~~ xymon-client -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/logrotate.d/hobbit-client /etc/logrotate.d/xymon-client 4.3.7-1~~ xymon-client -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/hobbit/localclient.cfg /etc/xymon/localclient.cfg 4.3.7-1~~ xymon-client -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/hobbit/hobbitclient.cfg /etc/xymon/xymonclient.cfg 4.3.7-1~~ xymon-client -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/hobbit/clientlaunch.cfg /etc/xymon/clientlaunch.cfg 4.3.7-1~~ xymon-client -- "$@"
# End automatically added section


exit 0