ubuntuusers.de

Anhang: setup

  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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
#!/bin/sh
#
# Myth II install script
# $Id: setup,v 1.31 1999/08/05 02:38:12 megastep Exp $

# Go to the proper setup directory (if not already there)
cd `dirname $0`

# Return the appropriate architecture string
function DetectARCH {
	status=1
	case `uname -m` in
		i?86)  echo "x86"
			status=0;;
		ppc)   echo "ppc"
			status=0;;
		alpha) echo "alpha"
			status=0;;
		*)     echo "unknown";;
	esac
	return $status
}

# Return the appropriate version string
function DetectLIBC {
      status=1
      if [ -f /lib/libc.so.6 ]; then
              if fgrep GLIBC_2.1 /lib/libc.so.6 2>&1 >/dev/null; then
                      echo "glibc-2.1"
                      status=0
              else    
                      echo "glibc-2.0"
                      status=0
              fi        
      elif [ -f /lib/libc.so.5 ]; then
              echo "libc5"
              status=0
      else
              echo "unknown"
      fi
      return $status
}

# Make a symbolic link
function SymLink {
	if [ -f $2 ]; then
		if [ -L $2 ]; then
			echo -n "The symbolic link"
		else
			echo -n "The file"
		fi
		echo -n " $2 already exists; are you sure you want to overwrite it? [N/y] "
		read answer
		[ "x$answer" = x ] && answer=n
		case "$answer" in
		[nN]*)
			return 1;;
		[yY]*)
			echo "rm -f \"$2\"" >> "$install_path/uninstall"
			ln -sf "$1" "$2"
			return $!;
		esac
	else
		echo "rm -f \"$2\"" >> "$install_path/uninstall"
		ln -sf "$1" "$2"
	fi
}

function Aborting {
	echo
	echo '*** Signal caught, aborting. ***'
	if [ "$started" = 1 ]; then
		echo "Removing installed files ..."
		sh "$install_path/uninstall"
		[ -f "$install_path/uninstall.dir" ] && sh "$install_path/uninstall.dir"
	fi
	exit 2
}

trap Aborting SIGTERM SIGINT SIGHUP

# Add desktop menu bar items
function Add_DeskTop_MenuItem
{
	desktop=$1; deskfile=$2
	if [ -d "$desktop" ]; then
		desktop="$desktop/Games"
		if [ ! -d "$desktop" ]; then
			MakeDir "$desktop" 2>/dev/null
		fi
		if [ -w "$desktop" ]; then
			echo "Creating $desktop/$deskfile"
			cat >"$desktop/$deskfile" <<__EOF__
[${3}Desktop Entry]
Name=Myth II
Comment=Myth II: Soulblighter
Exec=$symlink/myth2
Icon=$install_path/myth2.xpm
Terminal=0
Type=Application
__EOF__
		fi
	fi
}

# Copy a file and add it to the install log
# $2 has to be a directory name

function CopyFile
{
	echo "rm -f $2"/`basename "$1"` >> "$install_path/uninstall"
	cp -f "$1" "$2"
}

function MakeDir
{
	echo rmdir "\"$1\"" >> "$install_path/uninstall.dir"
	mkdir -p "$1"
}

# Copy a tag file to the specified location
function CopyTagFile
{
	echo -n "Copying $1 to $install_path/tags..."
	if CopyFile "tags/$1" "$install_path/tags"; then
		echo Done.
		return 0
	else
		echo FAILED.
		return 1
	fi
}

function CopyPluginFile
{
	echo -n "Copying $1 to $install_path/plugins..."
	if CopyFile "plugins/$1" "$install_path/plugins"; then
		echo Done.
		return 0
	else
		echo FAILED.
		return 1
	fi
}

function CopyMovieFiles
{
	value=0
	cd cutscenes
	for a in *.mpg; do
		echo -n "Copying $a to $install_path/cutscenes..."
		if CopyFile "$a" "$install_path/cutscenes"; then
			echo Done.
		else
			echo FAILED.
			value=1
		fi
	done
	cd ..
	return $value
}

function CopyBinary
{
	target=""
	if [ -f "$bindir/$1" ]; then
		target="$bindir/$1";
	else
		if [ -f "$gbindir/$1" ]; then
			target="$gbindir/$1";
		fi
	fi
	if [ "x$target" = x ]; then
		echo "Unable to locate a valid $1 binary."
		return 1
	else
		CopyFile "$target" "$install_path"
	fi
}

arch=`DetectARCH`
libc=`DetectLIBC`
started=0
echo "----====== Myth II: Soulblighter installation program ======----"
echo
echo "You are running a $arch machine with $libc"

gbindir=bin/$arch
bindir=$gbindir/$libc
installer="$gbindir/ginstall"
if [ ! -d "$bindir" ]; then
      echo "This installation of Myth II doesn't support $libc on $arch"    >&2
	  echo
      echo "Please contact Loki Technical Support at support@lokigames.com" >&2
      exit 1
fi

# Detect working X11 server

if [ "x$DISPLAY" != x ]; then
	ok=0
	echo "Running graphical installation program..."
	# The executable is here but we can't execute it from CD
	cp $installer $HOME/.ginstall$$
	chmod +x $HOME/.ginstall$$
	$HOME/.ginstall$$ $* 2> /dev/null && ok=1
	rm -f $HOME/.ginstall$$
	[ $ok = 1 ] && exit 0 # We assume all went well, and exit now
	echo "GUI installer failed, running the shell-only installer..."
	echo
fi

# Shell only installation, is executed even if the GUI installer failed
echo "Hit Control-C anytime to cancel this installation script."
echo

# Display the README here ?

echo
install_path=/usr/local/games/myth2
echo -n "Please enter the installation path [$install_path] : "
read answer
[ "x$answer" != x ] && install_path="$answer"
echo "Files will be installed in $install_path"
if [ ! -d "$install_path" ]; then
	echo -n "The $install_path directory does not exist; create it ? [Y/n] "
	read answer
	[ "x$answer" = x ] && answer=y
	case "$answer" in
	[yY]*)
		mkdir -p $install_path || { echo "Error while creating directory, aborting."; exit 1; }
		;;
	*)
		echo Aborting.
		exit 1
		;;
	esac
fi

free_kb=`df $install_path|grep /dev|awk '{print $4}'`
echo
echo "$free_kb KB are available on the chosen filesystem."
echo
size=none
while [ "$size" = 800000 ]; do
	echo
	echo "Please choose the size of the installation:"
	echo "   1) CD Only: ~10MB"
	echo "   2) Small: ~120MB"
	echo "   3) Large: ~510MB"
	echo "   4) Full:  ~640MB"
	echo -n "Your choice: "
	read answer
	case "$answer" in
	1)
		size=cdonly
		mini=10000;;
	2)
		size=small
		mini=120000
		;;
	3)
		size=large
		mini=510000 ;;
	4)
		size=full
		mini=640000 ;;
	esac
	# Check for disk space
	if expr "$free_kb" \< "$mini" > /; then
		echo "There is not enough disk space available for this installation."
		size=none
	fi
done
echo "'$size' installation chosen."

# http://forum.linspire.com/viewtopic.php?p=169203&sid=9d33d7410c9153a3480c886d83dc9f81#169203
# if expr "$free_kb" \< "$mini" > /dev/null; 
# if expr "$free_kb" \< "$mini" > "$install_path";

glide=0
if [ -f "$bindir/myth2_glide" ]; then # Only ask if the binary is available
	echo
	echo "Do you want to install the Glide (3Dfx) version of the game?"
	echo -n "You need to have the Glide runtime libraries installed for this. [y/n] "
	read answer
	case "$answer" in
	[yY]*)
		glide=1
		echo "The Glide version will be installed."
		;;
	esac
fi

echo
echo -n "Do you want to install the Myth II tools (Fear and Loathing) ? [y/n] "
read answer
tools=0
case "$answer" in
[yY]*)
	tools=1
	echo "The tools will be installed."
	;;
esac

echo
symlink=/usr/local/bin
ok=0
while [ "$ok" = 0 ]; do
	echo -n "Enter the location of the symbolic link for the game [$symlink]: "
	read answer
	[ "x$answer" != x ] && symlink="$answer"
	if [ ! -d "$symlink" ]; then
		echo "The $symlink directory does not exist!"
	else 
		if [ ! -w "$symlink" ]; then
			echo "You don't have the permission to write in $symlink"
		else
			ok=1
		fi
	fi
done

menu_items=1
echo
echo -n "Do you want desktop menu items to be installed (Gnome/KDE) ? [Y/n] "
read answer
case "$answer" in
[nN]*)
	menu_items=0;;
esac

started=1
echo '#!/bin/sh' > "$install_path/uninstall"
echo "rm -f $install_path/uninstall" >> "$install_path/uninstall"
echo "rm -f $install_path/uninstall.dir" >> "$install_path/uninstall"
chmod +x "$install_path/uninstall"
# Now copy the files to the specified location.
MakeDir "$install_path/plugins"

# Minimum set of files
CopyPluginFile "Patch 1.2"
CopyPluginFile "Patch 1.3"
# CopyFile desktop/myth2.xpm "$install_path"
# CopyFile desktop/icon.bmp "$install_path"
# CopyFile desktop/splash.bmp "$install_path"
# CopyFile desktop/loathing.png "$install_path"
# CopyFile README.tools "$install_path"

case "$size" in
cdonly)
	;;
small)
	MakeDir "$install_path/tags"
	CopyTagFile "international small install"
	CopyTagFile "small install"
	;;
large)
	MakeDir "$install_path/tags"
	CopyTagFile "international small install"
	CopyTagFile "small install"
	CopyTagFile "medium install"
	CopyTagFile "international large install"
	CopyTagFile "large install"
	;;
full)
	MakeDir "$install_path/tags"
	CopyTagFile "international small install"
	CopyTagFile "small install"
	CopyTagFile "medium install"
	CopyTagFile "international large install"
	CopyTagFile "large install"
	MakeDir "$install_path/cutscenes"
	CopyMovieFiles
	;;
*)
	MakeDir "$install_path/tags"
	CopyTagFile "international small install"
	CopyTagFile "small install"
	CopyTagFile "medium install"
	CopyTagFile "international large install"
	CopyTagFile "large install"
	MakeDir "$install_path/cutscenes"
	CopyMovieFiles
	;;
#	echo Internal error. Aborting.
#	exit 1;;

esac

if [ "$glide" = 1 ]; then
	# Copy the Glide binary
	binary="myth2_glide"
else
	# Copy the X11 binary
	binary="myth2_x11"
fi
CopyBinary $binary || { echo "Error while copying $binary."; exit 1; }
SymLink "$install_path/$binary" "$symlink/myth2"

if [ "$tools" = 1 ]; then
	# Copy the tools
	CopyBinary fear || { echo "Error while copying fear"; exit 1; }
	CopyBinary loathing || { echo "Error while copying loathing"; exit 1; }
	SymLink "$install_path/fear" "$symlink/fear"
	SymLink "$install_path/loathing" "$symlink/loathing"
fi

if [ "$menu_items" = 1 ]; then
	echo
	echo "============================================================="
	echo "Adding desktop menu items ..."
	for gnomedir in "/opt/gnome" "/usr/share/gnome" "$HOME/.gnome"; do
		Add_DeskTop_MenuItem "$gnomedir/apps" "myth2.desktop"
	done
	for kdedir in "/opt/kde" "/usr/share/kde" "$HOME/.kde"; do
		Add_DeskTop_MenuItem "$kdedir/share/applnk" "myth2.kdelnk" "KDE "
	done
fi

# Append the uninstall script for directories
cat "$install_path/uninstall.dir" >> "$install_path/uninstall"
rm -f "$install_path/uninstall.dir"

echo
echo Myth II was successfully installed on your system.

exit 0
# EOF
Anhang herunterladen

Diese Revision wurde am 15. April 2021 17:37 von ubuntuusers erstellt.