diff options
author | Josep Torra <n770galaxy@gmail.com> | 2013-01-04 09:30:48 +0100 |
---|---|---|
committer | Josep Torra <n770galaxy@gmail.com> | 2013-01-04 09:30:48 +0100 |
commit | 1f80a252d48b3f6eed4469d60c7d109de46eb362 (patch) | |
tree | bac9e7d498164f96bf4fea368c3776d58004f287 /patches/nethack.sh-maemo1 |
Initial commit
Diffstat (limited to 'patches/nethack.sh-maemo1')
-rwxr-xr-x | patches/nethack.sh-maemo1 | 165 |
1 files changed, 165 insertions, 0 deletions
diff --git a/patches/nethack.sh-maemo1 b/patches/nethack.sh-maemo1 new file mode 100755 index 0000000..778f991 --- /dev/null +++ b/patches/nethack.sh-maemo1 @@ -0,0 +1,165 @@ +#!/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=/var/lib/install/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 ! -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/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 |