InstallAtATNF: duchamp-wrapper.sh

File duchamp-wrapper.sh, 1.4 KB (added by MatthewWhiting, 13 years ago)

Wrapper script for execution

Line 
1#!/bin/sh
2#
3# start duchamp for the current platform
4#
5TOPDIR="/nfs/atapplic/duchamp/"
6BINARY="Duchamp"
7
8Fail () { while [ $# -gt 0 ] ; do echo $1; shift ; done; exit 1; } ;
9
10### NB: the following does not allow options to be passed.
11## fixme allow a version number as the argument, then shift it off the arglist
12#if [ $# -gt 0 ] ; then
13#    VERSION=$1; shift
14#    TOPDIR=${TOPDIR}-${VERSION}
15#fi
16
17case `uname` in
18    Linux)
19        case `uname -m` in
20            *86)
21                PLATFORM=linux
22                ;;
23            *86_64)
24                PLATFORM=linux64
25                ;;
26        esac
27        ;;
28    SunOS)
29        case `uname -r` in
30            4.)
31                PLATFORM=sun4
32                ;;
33            5.*)
34                PLATFORM=sun4sol
35                ;;
36            *)
37                case `uname -m` in
38                    *86)
39                        PLATFORM=i86sol
40                        ;;
41                    esac
42                esac
43        ;;
44    Darwin)
45        case `uname -m` in
46            i*86)
47                PLATFORM=darwin_x86
48                ;;
49            Power*)
50                PLATFORM=darwin_ppc
51                ;;
52        esac
53        ;;
54    *)
55        Fail "Unsupported on the `uname` platform"
56esac
57
58# fixme: do we need to diddle with LD_LIBRARY_PATH
59#if so, use this to get the directories:
60#echo $LD_LIBRARY_PATH
61
62BuildDir="${TOPDIR}/${PLATFORM}/Duchamp*"
63
64LD_LIBRARY_PATH=${LD_LIBRARY_PATH}`grep "\-L" ${BuildDir}/Makefile | awk '{for(i=1;i<=NF;i++) if(substr($i,1,2)=="-L") printf ":%s", substr($i,3,length($i)-2)}END{printf "\n"}'`
65
66#echo $LD_LIBRARY_PATH
67
68
69FULL_BINARY="${TOPDIR}/${PLATFORM}/bin/${BINARY}"
70#echo Full binary = ${FULL_BINARY}
71#echo "args = $@"
72
73
74# The $@ is the remaininng arguments from the command line
75exec $FULL_BINARY $@
76