#!/bin/sh # 20080301 bkw: # Wrapper script for typhoon 2001. This binary-only game was originally # written for MS Windows, so it expects to find its data files in the # current directory, and to be able to write log and config files there. # To allow for system-wide installation, this script will create and # populate a per-user symlink forest in ~/.$PRGNAM, allowing each # user to have his own typhoon.cfg and typhoon.log files. T2K1_BIN=/usr/libexec/typhoon T2K1_SHARE=/usr/share/games/typhoon_2001 T2K1_HOME=~/.typhoon_2001 if [ ! -e $T2K1_BIN ]; then echo "$T2K1_BIN does not exist, are you sure Typhoon 2001 is installed?" exit 1 fi if [ ! -d $T2K1_SHARE ]; then echo "$T2K1_SHARE does not exist, are you sure Typhoon 2001 is installed?" exit 1 fi if [ ! -d "$T2K1_HOME" ]; then echo "Installing user dir: $T2K1_HOME" mkdir $T2K1_HOME || exit 1 cd $T2K1_HOME || exit 1 ln -s $T2K1_BIN ./typhoon ln -s $T2K1_SHARE/*.* . # if game/ or any game/dir is a symlink, choosing level-set from the # gameplay menu doesn't work. # Binary-only, so I can't just fix it, so they have to be real dirs... mkdir game for i in tempest 'tempest tubes' 'typhoon 2001'; do mkdir "$T2K1_HOME/game/$i" ( cd "$T2K1_HOME/game/$i" ln -s "$T2K1_SHARE/game/$i/"* . ) done fi cd "$T2K1_HOME" && exec ./typhoon || \ echo "Can't exec $T2K1_HOME/typhoon - " \ "corrupt install, try removing $T2K1_HOME and running $0 again"