diff options
Diffstat (limited to 'patches/nethack.sh-maemo2')
-rwxr-xr-x | patches/nethack.sh-maemo2 | 190 |
1 files changed, 190 insertions, 0 deletions
diff --git a/patches/nethack.sh-maemo2 b/patches/nethack.sh-maemo2 new file mode 100755 index 0000000..c69dac3 --- /dev/null +++ b/patches/nethack.sh-maemo2 @@ -0,0 +1,190 @@ +#!/bin/sh +# This is a special .sh file for Maemo +# All user data is stored in the home directory because we can't set a suid bit in Nethack and +# we want backups to be made from the nethack data. + +HACKDIR=~/.nethackdir +export HACKDIR +MAXNROFPLAYERS=4 + +INSTALL_HACKDIR=/usr/games/lib/nethackdir +HACK=$INSTALL_HACKDIR/nethack + +# Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH +case "x$XUSERFILESEARCHPATH" in +x) XUSERFILESEARCHPATH="$HACKDIR/%N.ad" + ;; +*) XUSERFILESEARCHPATH="$XUSERFILESEARCHPATH:$HACKDIR/%N.ad" + ;; +esac +export XUSERFILESEARCHPATH + +# see if we can find the full path name of PAGER, so help files work properly +# assume that if someone sets up a special variable (HACKPAGER) for NetHack, +# it will already be in a form acceptable to NetHack +# ideas from brian@radio.astro.utoronto.ca +if test \( "xxx$PAGER" != xxx \) -a \( "xxx$HACKPAGER" = xxx \) +then + + HACKPAGER=$PAGER + +# use only the first word of the pager variable +# this prevents problems when looking for file names with trailing +# options, but also makes the options unavailable for later use from +# NetHack + for i in $HACKPAGER + do + HACKPAGER=$i + break + done + + if test ! -f $HACKPAGER + then + IFS=: + for i in $PATH + do + if test -f $i/$HACKPAGER + then + HACKPAGER=$i/$HACKPAGER + export HACKPAGER + break + fi + done + IFS=' ' + fi + if test ! -f $HACKPAGER + then + echo Cannot find $PAGER -- unsetting PAGER. + unset HACKPAGER + unset PAGER + fi +fi + + +# create links to INSTALL_NETHACKDIR and setup the other things in the user homedirectory +if test ! -d $HACKDIR +then + mkdir $HACKDIR +fi + +if test ! -f $HACKDIR/equip.png +then + ln -s $INSTALL_HACKDIR/equip.png $HACKDIR/equip.png +fi + +if test ! -f $HACKDIR/gold24.png +then + ln -s $INSTALL_HACKDIR/gold24.png $HACKDIR/gold24.png +fi + +if test ! -f $HACKDIR/gtk2hack.png +then + ln -s $INSTALL_HACKDIR/gtk2hack.png $HACKDIR/gtk2hack.png +fi + +if test ! -f $HACKDIR/pad_unclicked.png +then + ln -s $INSTALL_HACKDIR/pad_unclicked.png $HACKDIR/pad_unclicked.png +fi + +if test ! -f $HACKDIR/pad_clicked.png +then + ln -s $INSTALL_HACKDIR/pad_clicked.png $HACKDIR/pad_clicked.png +fi + +if test ! -d $HACKDIR/locale +then + ln -s $INSTALL_HACKDIR/locale $HACKDIR/locale +fi + +if test ! -f $HACKDIR/logfile +then + touch $HACKDIR/logfile +fi + +if test ! -f $HACKDIR/mapbg.xpm +then + ln -s $INSTALL_HACKDIR/mapbg.xpm $HACKDIR/mapbg.xpm +fi + +if test ! -f $HACKDIR/nhdat +then + ln -s $INSTALL_HACKDIR/nhdat $HACKDIR/nhdat +fi + +if test ! -f $HACKDIR/perm +then + touch $HACKDIR/perm +fi + +if test ! -f $HACKDIR/record +then + touch $HACKDIR/record +fi + +if test ! -f $HACKDIR/recover +then + ln -s $INSTALL_HACKDIR/recover $HACKDIR/recover +fi + +if test ! -f $HACKDIR/rip.xpm +then + ln -s $INSTALL_HACKDIR/rip.xpm $HACKDIR/rip.xpm +fi + +if test ! -d $HACKDIR/save +then + mkdir $HACKDIR/save +fi + +if test ! -f $HACKDIR/x11tiles +then + ln -s $INSTALL_HACKDIR/x11tiles $HACKDIR/x11tiles +fi + +if test ! -f $HACKDIR/tiles32.png +then + ln -s $INSTALL_HACKDIR/tiles32.png $HACKDIR/tiles32.png +fi + +if test ! -f $HACKDIR/ClassicBW.png +then + ln -s $INSTALL_HACKDIR/ClassicBW.png $HACKDIR/ClassicBW.png +fi + +if test ! -f $HACKDIR/ClassicWB.png +then + ln -s $INSTALL_HACKDIR/ClassicWB.png $HACKDIR/ClassicWB.png +fi + +if test ! -f $HACKDIR/ClassicColor.png +then + ln -s $INSTALL_HACKDIR/ClassicColor.png $HACKDIR/ClassicColor.png +fi + +if test ! -f $HACKDIR/gtk2hackrc +then + ln -s $INSTALL_HACKDIR/gtk2hackrc $HACKDIR/gtk2hackrc +fi + +if test ! -f ~/.nethackrc +then + ln -s $INSTALL_HACKDIR/dot.nethackrc ~/.nethackrc +fi + +if test ! -d ~/MyDocs/.documents/.games/Nethack +then + ln -s $HACKDIR/save/ ~/MyDocs/.documents/.games/Nethack +#ln -s /home/user/$HACKDIR/save/ /home/user/MyDocs/.documents/.games/Nethack +fi +# we want to ask the username in HILDON + +cd $HACKDIR +case $1 in + -s*) + exec $HACK "$@" + ;; + *) + exec $HACK "$@" $MAXNROFPLAYERS + ;; +esac |