-
Notifications
You must be signed in to change notification settings - Fork 2
/
b2execute
executable file
·47 lines (40 loc) · 961 Bytes
/
b2execute
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
#!/bin/bash
# check for help option
if [ "$1" = "--help" -o "$1" = "-h" -o "$1" = "-?" ]; then
echo
echo "Usage: `basename $0` [-x command] release arguments"
echo
echo "- This command sets up the given release and then calls basf2"
echo " with the given arguments."
echo "- With the -x option a different command than basf2 can be"
echo " executed."
echo
exit 0
fi
# check for other command than basf2
COMMAND=basf2
if [ $# -ge 2 -a "$1" = "-x" ]; then
shift
COMMAND=$1
shift
fi
# check number of arguments
if [ $# -lt 1 ]; then
echo "Usage: `basename $0` [-x command] release arguments" 1>&2
exit 1
fi
# get release version
RELEASE=$1
shift
# setup tools and release
source `dirname $0`/b2setup.sh ${RELEASE}
if [ $? != 0 ]; then
echo "ERROR: The setup of release ${RELEASE} failed."
exit 2
fi
# execute command
eval ${COMMAND} "$@"
if [ $? != 0 ]; then
echo "ERROR: The execution of ${COMMAND} failed."
exit 3
fi