#!/bin/bash function show_title() { echo "O---------------------------------------------O" echo echo " $rk_name "; echo " $rk_fullname "; echo echo "O---------------------------------------------O" #for a in `seq 0 $(( 40 - ${#rk_name} ))`; do echo -n " "; done; echo "|" #for a in `seq 0 $(( 40 - ${#rk_fullname} ))`; do echo -n " "; done; echo "|" } #pre checks if [ "$rk_name" == "" ]; then echo "rk_name not set"; exit; elif [ "$RK_HOME" == "" ]; then echo "RK_HOME not set"; exit fi function show_help { echo "$rk_name - $rk_fullname" echo "Helps you to create releases from the Repository" echo echo "usage: $rk_name [-sim] [-from ] [other-args]" echo " -sim" echo " simulation only, don't actually do anything" echo echo " -help" echo " show this help screen" echo echo " -from " echo " start execution from the target with the given target address" echo echo " -to " echo " stop execution just before the target with the given target address" echo echo " -descend " echo " execute only the target with the given address, including subtargets" echo echo " -cp" echo " show the classpath being used by $rk_name" echo echo " -cmd" echo " show the ant command being used by $rk_name" } #cd up a level or two if needed if [ ! -e "$rk_name-build.properties" ]; then if [ -e "../$rk_name-build.properties" ]; then RKOLDPWD=`pwd` cd .. elif [ -e "../../$rk_name-build.properties" ]; then RKOLDPWD=`pwd` cd ../.. fi fi #work out the classpath CLASSPATH=$JAVA_HOME/lib/tools.jar for file in $RK_HOME/core/lib/*.jar; do CLASSPATH=$CLASSPATH:$file done for file in $RK_HOME/core/ant/lib/*.jar; do CLASSPATH=$CLASSPATH:$file done for file in $RK_HOME/core/ant-installer/lib/*.jar; do CLASSPATH=$CLASSPATH:$file done CLASSPATH=$CLASSPATH:$RK_HOME/core/ant-installer/classes export CLASSPATH #set ANT_HOME export ANT_HOME=$RK_HOME/core/ant export ANT_OPTS=-Xmx800M #create the command 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" #pass on the arguments while [ "$1" != "" ]; do if [ "$1" == "-help" ]; then show_help exit elif [ "$1" == "-cp" ]; then echo $CLASSPATH exit elif [ "$1" == "-cmd" ]; then show_cmd=true elif [ "$1" == "-sim" ]; then toexec="$toexec $1" sim_mode=on else toexec="$toexec $1" fi shift done #execute (or show the command to be executed) if [ "$show_cmd" == "true" ]; then echo $toexec elif [ "$sim_mode" == "on" ]; then show_title $toexec else show_title | tee ${rk_name}.out $toexec 2>&1 | tee -a ${rk_name}.out fi if [ "$RKOLDPWD" != "" ]; then cd $RKOLDPWD fi