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