summaryrefslogtreecommitdiffstats
path: root/games/typhoon_2001/typhoon_2001
blob: 2953ebdd88c277c22639c79139ec5119f661b39f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/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"