debian/postinst
author Markus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 15:27:30 +0100
changeset 0 586472add385
child 5 7c7fc8906920
permissions -rw-r--r--
Initial Layout 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/nobody/data/mcbot.dat ];
	then		
		echo "Creating initial database in /var/lib/nobody/data";
		dbtool -a -k 1 -v 1;
		dbtool -d 1;
	fi

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

	echo "Changing ownership in /var/lib/nobody"
	usermod -s /bin/bash -d /var/lib/nobody nobody
	chown -R nobody:nogroup /var/lib/nobody
	echo "Setting permissions for /var/lib/nobody/.mcbotrc to 600"
	chmod 600 /var/lib/nobody/.mcbotrc
	echo "ENTER /etc/init.d/mcbot start after editing .mcbotrc"
    ;;

    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