[18904] | 1 | #!/bin/bash
|
---|
| 2 | function show_title() {
|
---|
[19006] | 3 | echo "O---------------------------------------------O"
|
---|
| 4 | echo
|
---|
| 5 | echo " $rk_name ";
|
---|
| 6 | echo " $rk_fullname ";
|
---|
| 7 | echo
|
---|
| 8 | echo "O---------------------------------------------O"
|
---|
| 9 |
|
---|
| 10 | #for a in `seq 0 $(( 40 - ${#rk_name} ))`; do echo -n " "; done; echo "|"
|
---|
| 11 | #for a in `seq 0 $(( 40 - ${#rk_fullname} ))`; do echo -n " "; done; echo "|"
|
---|
| 12 |
|
---|
[18904] | 13 | }
|
---|
| 14 |
|
---|
[16540] | 15 | #pre checks
|
---|
| 16 | if [ "$rk_name" == "" ]; then
|
---|
| 17 | echo "rk_name not set";
|
---|
| 18 | exit;
|
---|
| 19 | elif [ "$RK_HOME" == "" ]; then
|
---|
| 20 | echo "RK_HOME not set";
|
---|
| 21 | exit
|
---|
| 22 | fi
|
---|
| 23 |
|
---|
| 24 | function show_help {
|
---|
| 25 |
|
---|
| 26 | echo "$rk_name - $rk_fullname"
|
---|
| 27 | echo "Helps you to create releases from the Repository"
|
---|
| 28 | echo
|
---|
| 29 | echo "usage: $rk_name [-sim] [-from <target>] [other-args]"
|
---|
| 30 | echo " -sim"
|
---|
| 31 | echo " simulation only, don't actually do anything"
|
---|
| 32 | echo
|
---|
[17042] | 33 | echo " -help"
|
---|
| 34 | echo " show this help screen"
|
---|
| 35 | echo
|
---|
[16540] | 36 | echo " -from <target>"
|
---|
| 37 | echo " start execution from the target with the given target address"
|
---|
| 38 | echo
|
---|
[16732] | 39 | echo " -to <target>"
|
---|
| 40 | echo " stop execution just before the target with the given target address"
|
---|
| 41 | echo
|
---|
[16540] | 42 | echo " -descend <target>"
|
---|
[16732] | 43 | echo " execute only the target with the given address, including subtargets"
|
---|
[16540] | 44 | echo
|
---|
| 45 | echo " -cp"
|
---|
| 46 | echo " show the classpath being used by $rk_name"
|
---|
[18904] | 47 | echo
|
---|
| 48 | echo " -cmd"
|
---|
| 49 | echo " show the ant command being used by $rk_name"
|
---|
[16540] | 50 |
|
---|
| 51 | }
|
---|
| 52 |
|
---|
[17633] | 53 | #cd up a level or two if needed
|
---|
[17996] | 54 | if [ ! -e "$rk_name-build.properties" ]; then
|
---|
| 55 | if [ -e "../$rk_name-build.properties" ]; then
|
---|
[17633] | 56 | RKOLDPWD=`pwd`
|
---|
| 57 | cd ..
|
---|
[17996] | 58 | elif [ -e "../../$rk_name-build.properties" ]; then
|
---|
[17633] | 59 | RKOLDPWD=`pwd`
|
---|
| 60 | cd ../..
|
---|
| 61 | fi
|
---|
| 62 | fi
|
---|
| 63 |
|
---|
[16540] | 64 | #work out the classpath
|
---|
| 65 | CLASSPATH=$JAVA_HOME/lib/tools.jar
|
---|
[19006] | 66 | for file in $RK_HOME/core/lib/*.jar; do
|
---|
[16540] | 67 | CLASSPATH=$CLASSPATH:$file
|
---|
| 68 | done
|
---|
[19006] | 69 | for file in $RK_HOME/core/ant/lib/*.jar; do
|
---|
[16540] | 70 | CLASSPATH=$CLASSPATH:$file
|
---|
| 71 | done
|
---|
[19006] | 72 | for file in $RK_HOME/core/ant-installer/lib/*.jar; do
|
---|
[16540] | 73 | CLASSPATH=$CLASSPATH:$file
|
---|
| 74 | done
|
---|
[19006] | 75 | CLASSPATH=$CLASSPATH:$RK_HOME/core/ant-installer/classes
|
---|
[16540] | 76 |
|
---|
[16773] | 77 | export CLASSPATH
|
---|
| 78 |
|
---|
[16732] | 79 | #set ANT_HOME
|
---|
[19006] | 80 | export ANT_HOME=$RK_HOME/core/ant
|
---|
[17401] | 81 | export ANT_OPTS=-Xmx800M
|
---|
[16732] | 82 |
|
---|
[16540] | 83 | #create the command
|
---|
[17401] | 84 | toexec="$ANT_HOME/bin/ant -addressing -lib `pwd`/installer/classes -f $RK_HOME/ant-scripts/build.xml -Dbasedir=`pwd` -D$rk_name.home=$RK_HOME"
|
---|
[16540] | 85 |
|
---|
| 86 | #pass on the arguments
|
---|
| 87 | while [ "$1" != "" ]; do
|
---|
| 88 |
|
---|
| 89 | if [ "$1" == "-help" ]; then
|
---|
| 90 | show_help
|
---|
| 91 | exit
|
---|
| 92 | elif [ "$1" == "-cp" ]; then
|
---|
| 93 | echo $CLASSPATH
|
---|
| 94 | exit
|
---|
[18904] | 95 | elif [ "$1" == "-cmd" ]; then
|
---|
| 96 | show_cmd=true
|
---|
[16802] | 97 | elif [ "$1" == "-sim" ]; then
|
---|
| 98 | toexec="$toexec $1"
|
---|
| 99 | sim_mode=on
|
---|
[16540] | 100 | else
|
---|
| 101 | toexec="$toexec $1"
|
---|
| 102 | fi
|
---|
[16802] | 103 | shift
|
---|
[16540] | 104 |
|
---|
| 105 | done
|
---|
[16802] | 106 |
|
---|
[18904] | 107 | #execute (or show the command to be executed)
|
---|
| 108 | if [ "$show_cmd" == "true" ]; then
|
---|
| 109 | echo $toexec
|
---|
| 110 | elif [ "$sim_mode" == "on" ]; then
|
---|
| 111 | show_title
|
---|
| 112 | $toexec
|
---|
| 113 | else
|
---|
| 114 | show_title | tee ${rk_name}.out
|
---|
| 115 | $toexec 2>&1 | tee -a ${rk_name}.out
|
---|
| 116 | fi
|
---|
| 117 |
|
---|
[17633] | 118 | if [ "$RKOLDPWD" != "" ]; then
|
---|
| 119 | cd $RKOLDPWD
|
---|
[16802] | 120 | fi
|
---|
[18904] | 121 |
|
---|