root/main/trunk/release-kits/bin/rk @ 29395

Revision 29395, 2.2 KB (checked in by sjm84, 5 years ago)

Minor additional changes

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3function show_title() {
4    echo "RK_HOME: $RK_HOME"
5    echo "O---------------------------------------------O"
6    echo
7    echo "   $rk_name ";
8    echo "   $rk_fullname ";
9    echo
10    echo "O---------------------------------------------O"
11
12}
13
14function show_help {
15    echo "usage: {rk2|rk3|sork2|sork2|cdrk2|derk} [-help|-cmd] [ANT_ARGS]"
16    echo "  -help       show this help screen"
17    echo "  -cmd        show the ant command being used by the releas kit"
18    echo "  ANT_ARGS    additional arguments to be passed to ant"
19}
20
21#determine requested release kit
22rk_name="$(basename $0)"
23export RK_HOME="$(cd "$(dirname "$0")/.." && pwd)"
24
25if [ "$rk_name" == "rk2" ]; then
26    rk_fullname="Release Kit for Greenstone2"
27elif [ "$rk_name" == "rk3" ]; then
28        rk_fullname="Release Kit for Greenstone3"
29elif [ "$rk_name" == "sork2" ]; then
30        rk_fullname="Source Code Release Kit for Greenstone2"
31elif [ "$rk_name" == "sork3" ]; then
32        rk_fullname="Source Code Release Kit for Greenstone3"
33elif [ "$rk_name" == "cdrk2" ]; then
34        rk_fullname="CD-ROM Release Kit for Greenstone2"
35elif [ "$rk_name" == "derk" ]; then
36        rk_fullname="Documented Examples Release Kit"
37else
38    show_help
39    exit
40fi
41
42#make sure ant has enough memory
43export ANT_OPTS=-Xmx1024M
44
45#create the command
46toexec="ant -lib \"`pwd`/installer/classes\" -f \"$RK_HOME/kits/$rk_name/ant-scripts/build.xml\" \"-Dbasedir=`pwd`\" \"-Drk.home=$RK_HOME\" \"-Drk.name=$rk_name\""
47
48# Generally, an ant property can be true|on|yes vs false|off|no (or left unset)
49# see https://ant.apache.org/manual/properties.html#if+unless
50# However, the release-kit code requires envvar KEEP_SRC to be "true" in order to stop it deleting source code
51# set KEEP_SRC env var here or in envi/etc/tasks/snapshot/environment.pl
52#KEEP_SRC=true
53#echo "KEEP_SRC: $KEEP_SRC"
54if test -n $KEEP_SRC ; then
55    toexec="$toexec \"-Dkeep.src=$KEEP_SRC\""
56fi
57
58#pass on the arguments
59while [ "$1" != "" ]; do
60
61    if [ "$1" == "-help" ]; then
62        show_help
63        exit
64    elif [ "$1" == "-cmd" ]; then
65        show_cmd=true
66    else
67        toexec="$toexec \"$1\""
68    fi
69    shift
70
71done
72
73#show the command to be executed
74if [ "$show_cmd" == "true" ]; then
75    echo $toexec
76#execute
77else
78    show_title | tee ${rk_name}.out
79    $toexec 2>&1 | tee -a ${rk_name}.out
80fi
81
Note: See TracBrowser for help on using the browser.