#!/bin/bash

# Nethack post-installation script for Debian
#
# Ben Gertzfield (che@debian.org) 29 July 1997
# Copyright 1997 Ben Gertzfield. This script is released under the
# GNU General Public License, version 2 or later.

# Modified 10 October 1997 to fix permissions on /var/lib/games/gnomehack.
# Modified 18 August 1998 to fix more upgrade problems from ancient
# nethacks

set -e

# This is super anal. It should work for all cases, for all upgrades.

find /var/lib/games/gnomehack -print0 | xargs -r -0 chgrp games

chmod 02775 /var/lib/games/gnomehack/

find /var/lib/games/gnomehack -type f -print0 | xargs -r -0 chmod 664
find /var/lib/games/gnomehack -type f -name '*lock*' -print0 | xargs -r -0 chmod 660

chmod 02775 /var/lib/games/gnomehack/save/

find /var/lib/games/gnomehack/save -type f -print0 | xargs -r -0 chmod 660

# These have been moved to the postinst per policy; they should not be
# conffiles. They are removed on purge in the postrm.

touch /var/lib/games/gnomehack/{perm,record,logfile}
chown root.games /var/lib/games/gnomehack/{perm,record,logfile}
chmod 0664 /var/lib/games/gnomehack/{perm,record,logfile}
 
# if [ -x /usr/sbin/suidregister ];then
#     suidregister -s gnomehack /usr/lib/games/gnomehack/gnomehack root games 2755
# fi
      
#if [ -x /usr/X11R6/bin/mkfontdir ] ; then /usr/X11R6/bin/mkfontdir \
#  /usr/X11R6/lib/X11/fonts/misc ; fi

#DEBHELPER#
