#!/bin/bash function show_title() { echo "RK_HOME: $RK_HOME" echo "O---------------------------------------------O" echo echo " $rk_name "; echo " $rk_fullname "; echo echo "O---------------------------------------------O" } function show_help { echo "usage: {rk2|rk3|sork2|sork2|cdrk2|derk} [-help|-cmd] [ANT_ARGS]" echo " -help show this help screen" echo " -cmd show the ant command being used by the releas kit" echo " ANT_ARGS additional arguments to be passed to ant" } #determine requested release kit rk_name="$(basename $0)" export RK_HOME="$(cd "$(dirname "$0")/.." && pwd)" if [ "$rk_name" == "rk2" ]; then rk_fullname="Release Kit for Greenstone2" elif [ "$rk_name" == "rk3" ]; then rk_fullname="Release Kit for Greenstone3" else show_help exit fi #cd up a level or two if needed if [ -e "$rk_name-build.properties" ]; then pushd . &>/dev/null elif [ -e "../$rk_name-build.properties" ]; then pushd .. &>/dev/null elif [ -e "../../$rk_name-build.properties" ]; then pushd ../.. &>/dev/null else echo "couldn't find file $rk_name-build.properties" echo "it should exist in the top level of the release" exit fi #make sure ant has enough memory export ANT_OPTS=-Xmx800M #create the command toexec="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\"" #pass on the arguments while [ "$1" != "" ]; do if [ "$1" == "-help" ]; then show_help exit elif [ "$1" == "-cmd" ]; then show_cmd=true else toexec="$toexec \"$1\"" fi shift done #show the command to be executed if [ "$show_cmd" == "true" ]; then echo $toexec #execute else show_title | tee ${rk_name}.out $toexec 2>&1 | tee -a ${rk_name}.out fi #go back to original dir popd &>/dev/null