[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
|
---|
[18904] | 45 | echo
|
---|
| 46 | echo " -cmd"
|
---|
| 47 | echo " show the ant command being used by $rk_name"
|
---|
[19037] | 48 | echo
|
---|
| 49 | echo " -properties"
|
---|
| 50 | echo " show the properties required/allowed in $rk_name-build.properties"
|
---|
[16540] | 51 |
|
---|
| 52 | }
|
---|
| 53 |
|
---|
[17633] | 54 | #cd up a level or two if needed
|
---|
[17996] | 55 | if [ ! -e "$rk_name-build.properties" ]; then
|
---|
| 56 | if [ -e "../$rk_name-build.properties" ]; then
|
---|
[17633] | 57 | RKOLDPWD=`pwd`
|
---|
| 58 | cd ..
|
---|
[17996] | 59 | elif [ -e "../../$rk_name-build.properties" ]; then
|
---|
[17633] | 60 | RKOLDPWD=`pwd`
|
---|
| 61 | cd ../..
|
---|
| 62 | fi
|
---|
| 63 | fi
|
---|
| 64 |
|
---|
[16732] | 65 | #set ANT_HOME
|
---|
[19006] | 66 | export ANT_HOME=$RK_HOME/core/ant
|
---|
[17401] | 67 | export ANT_OPTS=-Xmx800M
|
---|
[16732] | 68 |
|
---|
[16540] | 69 | #create the command
|
---|
[17401] | 70 | 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] | 71 |
|
---|
| 72 | #pass on the arguments
|
---|
| 73 | while [ "$1" != "" ]; do
|
---|
| 74 |
|
---|
| 75 | if [ "$1" == "-help" ]; then
|
---|
| 76 | show_help
|
---|
| 77 | exit
|
---|
[18904] | 78 | elif [ "$1" == "-cmd" ]; then
|
---|
| 79 | show_cmd=true
|
---|
[19037] | 80 | elif [ "$1" == "-properties" ]; then
|
---|
| 81 | target="properties"
|
---|
[16802] | 82 | elif [ "$1" == "-sim" ]; then
|
---|
| 83 | toexec="$toexec $1"
|
---|
| 84 | sim_mode=on
|
---|
[16540] | 85 | else
|
---|
| 86 | toexec="$toexec $1"
|
---|
| 87 | fi
|
---|
[16802] | 88 | shift
|
---|
[16540] | 89 |
|
---|
| 90 | done
|
---|
[16802] | 91 |
|
---|
[19037] | 92 | if [ "$target" != "" ]; then
|
---|
| 93 | toexec="$toexec $target"
|
---|
| 94 | fi
|
---|
| 95 |
|
---|
[18904] | 96 | #execute (or show the command to be executed)
|
---|
| 97 | if [ "$show_cmd" == "true" ]; then
|
---|
| 98 | echo $toexec
|
---|
| 99 | elif [ "$sim_mode" == "on" ]; then
|
---|
| 100 | show_title
|
---|
| 101 | $toexec
|
---|
[19037] | 102 | elif [ "$target" == "properties" ]; then
|
---|
| 103 | show_title
|
---|
| 104 | $toexec
|
---|
[18904] | 105 | else
|
---|
| 106 | show_title | tee ${rk_name}.out
|
---|
| 107 | $toexec 2>&1 | tee -a ${rk_name}.out
|
---|
| 108 | fi
|
---|
| 109 |
|
---|
[17633] | 110 | if [ "$RKOLDPWD" != "" ]; then
|
---|
| 111 | cd $RKOLDPWD
|
---|
[16802] | 112 | fi
|
---|
[18904] | 113 |
|
---|