debian/postinst
author Markus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 15:40:14 +0100
changeset 11 a769385a59c6
parent 5 7c7fc8906920
child 26 767f79e69de1
permissions -rw-r--r--
Many Memory Leaks in config.c * strdup is safer Still reachable memory holes in irc.c * theLine is strdup(ed) and not released. 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 restart after editing .mcbotrc"
	/etc/init.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