~ubuntu-branches/ubuntu/precise/openarena/precise

« back to all changes in this revision

Viewing changes to code/unix/setup/ioq3demo.sh

  • Committer: Bazaar Package Importer
  • Author(s): Bruno "Fuddl" Kleinert
  • Date: 2007-01-20 12:28:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070120122809-2yza5ojt7nqiyiam
Tags: upstream-0.6.0
ImportĀ upstreamĀ versionĀ 0.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
readlink() {
 
4
    local path=$1 ll
 
5
    
 
6
    if [ -L "$path" ]; then 
 
7
        ll="$(LC_ALL=C ls -l "$path" 2> /dev/null)" &&
 
8
        echo "${ll/* -> }"
 
9
    else    
 
10
        return 1
 
11
    fi
 
12
}
 
13
 
 
14
script=$0
 
15
count=0
 
16
while [ -L "$script" ]  
 
17
do
 
18
    script=$(readlink "$script")
 
19
    count=`expr $count + 1`
 
20
    if [ $count -gt 100 ]   
 
21
    then    
 
22
        echo "Too many symbolic links"
 
23
        exit 1
 
24
    fi
 
25
done
 
26
cd "`dirname $script`"
 
27
 
 
28
 
 
29
lib=lib
 
30
test -e lib64 && lib=lib64
 
31
 
 
32
if test "x$LD_LIBRARY_PATH" = x; then
 
33
        LD_LIBRARY_PATH="`pwd`/$lib"
 
34
else
 
35
        LD_LIBRARY_PATH="`pwd`/$lib:$LD_LIBRARY_PATH"
 
36
fi
 
37
export LD_LIBRARY_PATH
 
38
 
 
39
archs=`uname -m`
 
40
case "$archs" in
 
41
        i?86) archs=i386 ;;
 
42
        x86_64) archs="x86_64 i386" ;;
 
43
        ppc64) archs="ppc64 ppc" ;;
 
44
esac
 
45
 
 
46
for arch in $archs; do
 
47
        test -x ./ioquake3.$arch || continue
 
48
        exec ./ioquake3.$arch +set sv_pure 0 +set vm_cgame 0 +set vm_game 0 +set vm_ui 0 +set fs_game demoq3 "$@"
 
49
done
 
50
echo "could not execute ioquake3" >&2