debian/postinst
author Markus Bröker <mbroeker@largo.dyndns.tv>
Thu, 25 Dec 2008 19:55:07 +0100
changeset 31 bbcb8a3366b4
parent 26 767f79e69de1
child 32 89fb9c6611ca
permissions -rw-r--r--
mcbot needs a proper system account mcbot used the nobody system account and changed some properties. This collides with the default selinux policiy and the new account mcbot solves this issue. committer: Markus Bröker <mbroeker@largo.homelinux.org>

#!/bin/sh
# postinst script for mcbot
#
# see: dh_installdeb(1)

set -e

# 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>
#        * <postinst> `abort-remove'
#        * <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


case "$1" in
    configure)
	if [ ! -f /var/lib/mcbot/data/mcbot.dat ];
	then		
		echo "Creating initial database in /var/lib/mcbot/data";
		dbtool -a -k 1 -v 1;
		dbtool -d 1;
	fi

	if [ -f /var/lib/mcbot/.mcbotrc.dpkg-old ];
	then
		mv -f /var/lib/mcbot/.mcbotrc.dpkg-old /var/lib/mcbot/.mcbotrc;
	fi

	echo "Changing ownership in /var/lib/mcbot"
	useradd -c "MCBOT" -s /bin/bash -d /var/lib/mcbot mcbot
	chown -R mcbot:mcbot /var/lib/mcbot
	echo "Setting permissions for /var/lib/mcbot/.mcbotrc to 600"
	chmod 600 /var/lib/mcbot/.mcbotrc
	echo "ENTER /etc/init.d/mcbot restart after editing .mcbotrc"
	update-rc.d mcbot defaults &>/dev/null
	invoke-rc.d mcbot restart
    ;;

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

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0