debian/postinst
changeset 31 bbcb8a3366b4
parent 26 767f79e69de1
child 32 89fb9c6611ca
equal deleted inserted replaced
30:eed9f710ba3b 31:bbcb8a3366b4
    18 # the debian-policy package
    18 # the debian-policy package
    19 
    19 
    20 
    20 
    21 case "$1" in
    21 case "$1" in
    22     configure)
    22     configure)
    23 	if [ ! -f /var/lib/nobody/data/mcbot.dat ];
    23 	if [ ! -f /var/lib/mcbot/data/mcbot.dat ];
    24 	then		
    24 	then		
    25 		echo "Creating initial database in /var/lib/nobody/data";
    25 		echo "Creating initial database in /var/lib/mcbot/data";
    26 		dbtool -a -k 1 -v 1;
    26 		dbtool -a -k 1 -v 1;
    27 		dbtool -d 1;
    27 		dbtool -d 1;
    28 	fi
    28 	fi
    29 
    29 
    30 	if [ -f /var/lib/nobody/.mcbotrc.dpkg-old ];
    30 	if [ -f /var/lib/mcbot/.mcbotrc.dpkg-old ];
    31 	then
    31 	then
    32 		mv -f /var/lib/nobody/.mcbotrc.dpkg-old /var/lib/nobody/.mcbotrc;
    32 		mv -f /var/lib/mcbot/.mcbotrc.dpkg-old /var/lib/mcbot/.mcbotrc;
    33 	fi
    33 	fi
    34 
    34 
    35 	echo "Changing ownership in /var/lib/nobody"
    35 	echo "Changing ownership in /var/lib/mcbot"
    36 	usermod -s /bin/bash -d /var/lib/nobody nobody
    36 	useradd -c "MCBOT" -s /bin/bash -d /var/lib/mcbot mcbot
    37 	chown -R nobody:nogroup /var/lib/nobody
    37 	chown -R mcbot:mcbot /var/lib/mcbot
    38 	echo "Setting permissions for /var/lib/nobody/.mcbotrc to 600"
    38 	echo "Setting permissions for /var/lib/mcbot/.mcbotrc to 600"
    39 	chmod 600 /var/lib/nobody/.mcbotrc
    39 	chmod 600 /var/lib/mcbot/.mcbotrc
    40 	echo "ENTER /etc/init.d/mcbot restart after editing .mcbotrc"
    40 	echo "ENTER /etc/init.d/mcbot restart after editing .mcbotrc"
    41 	update-rc.d mcbot defaults &>/dev/null
    41 	update-rc.d mcbot defaults &>/dev/null
    42 	invoke-rc.d mcbot restart
    42 	invoke-rc.d mcbot restart
    43     ;;
    43     ;;
    44 
    44