Changeset 21386

Show
Ignore:
Timestamp:
22.12.2009 10:49:52 (10 years ago)
Author:
oranfry
Message:

rearranging into one release kit

Location:
main/trunk/release-kits
Files:
7 added
5 removed
1 modified
1 copied
5 moved

Legend:

Unmodified
Added
Removed
  • main/trunk/release-kits/bin/rk

    r21385 r21386  
    11#!/bin/bash 
    22 
    3 #determine requested release kit 
    4 echo $0 
    5 exit 
    6  
    7  
    8  
    93function show_title() { 
     4    echo "RK_HOME: $RK_HOME" 
    105    echo "O---------------------------------------------O" 
    116    echo  
     
    1712} 
    1813 
    19 #pre checks 
    20 if [ "$rk_name" == "" ]; then 
    21     echo "rk_name not set"; 
    22     exit; 
    23 elif [ "$RK_HOME" == "" ]; then 
    24     echo "RK_HOME not set"; 
    25     exit 
    26 fi 
    27  
    2814function show_help { 
    29  
    3015    echo "$rk_name - $rk_fullname" 
    31     echo "Helps you to create releases from the Repository" 
     16    echo "Automatically creates Greenstone releases" 
    3217    echo 
    33     echo "usage: $rk_name [-sim] [-from <target>] [other-args]" 
    34     echo "  -sim" 
    35     echo "      simulation only, don't actually do anything" 
    36     echo 
     18    echo "usage: $rk_name [-help|-cmd] [ANT_ARGS]" 
    3719    echo "  -help" 
    3820    echo "      show this help screen" 
    39     echo 
    40     echo "  -from <target>" 
    41     echo "      start execution from the target with the given target address" 
    42     echo 
    43     echo "  -to <target>" 
    44     echo "      stop execution just before the target with the given target address" 
    45     echo 
    46     echo "  -descend <target>" 
    47     echo "      execute only the target with the given address, including subtargets" 
    48     echo 
    4921    echo 
    5022    echo "  -cmd" 
    5123    echo "      show the ant command being used by $rk_name" 
    5224    echo 
    53     echo "  -properties" 
    54     echo "      show the properties required/allowed in $rk_name-build.properties" 
    55  
     25    echo "  ANT_ARGS" 
     26    echo "      Additional arguments to be passed to ant" 
    5627} 
    5728 
    58 #cd up a level or two if needed 
    59 if [ ! -e "$rk_name-build.properties" ]; then 
    60     if [ -e "../$rk_name-build.properties" ]; then 
    61         RKOLDPWD=`pwd` 
    62         cd .. 
    63     elif [ -e "../../$rk_name-build.properties" ]; then 
    64         RKOLDPWD=`pwd` 
    65         cd ../.. 
    66     fi 
     29#determine requested release kit 
     30rk_name="$(basename $0)" 
     31export RK_HOME="$(cd "$(dirname "$0")/.." && pwd)" 
     32 
     33if [ "$rk_name" == "rk2" ]; then 
     34    rk_fullname="Release Kit for Greenstone2" 
     35elif [ "$rk_name" == "rk3" ]; then 
     36        rk_fullname="Release Kit for Greenstone3" 
     37else 
     38    echo "Unrecognised release-kit name '$rk_name'" >&2 
     39    exit 
    6740fi 
    6841 
    69 #set ANT_HOME 
    70 export ANT_HOME=$RK_HOME/core/ant 
     42 
     43#cd up a level or two if needed 
     44if [ -e "$rk_name-build.properties" ]; then 
     45    pushd . 
     46elif [ -e "../$rk_name-build.properties" ]; then 
     47    pushd .. 
     48elif [ -e "../../$rk_name-build.properties" ]; then 
     49    pushd ../.. 
     50else 
     51    echo "couldn't find file $rk_name-build.properties" 
     52    echo "it should exist in the top level of the release" 
     53    exit 
     54fi 
     55 
     56#make sure ant has enough memory 
    7157export ANT_OPTS=-Xmx800M 
    7258 
    7359#create the command 
    74 toexec="ant -lib `pwd`/installer/classes -f $RK_HOME/ant-scripts/build.xml -Dbasedir=`pwd` -D$rk_name.home=$RK_HOME" 
     60toexec="ant -lib `pwd`/installer/classes -f $RK_HOME/$rk_name/ant-scripts/build.xml -Dbasedir=`pwd` -D$rk_name.home=$RK_HOME" 
    7561 
    7662#pass on the arguments 
     
    8975done 
    9076 
    91 if [ "$target" != "" ]; then 
    92     toexec="$toexec $target" 
    93 fi 
    94  
    95 #execute (or show the command to be executed) 
     77#show the command to be executed 
    9678if [ "$show_cmd" == "true" ]; then 
    9779    echo $toexec 
     80#execute 
    9881else 
    9982    show_title | tee ${rk_name}.out 
     
    10184fi 
    10285 
    103 if [ "$RKOLDPWD" != "" ]; then 
    104     cd $RKOLDPWD 
    105 fi 
    106  
     86#go back to original dir 
     87popd