source: release-kits/shared/linux/rk@ 18904

Last change on this file since 18904 was 18904, checked in by oranfry, 15 years ago

added a -cmd option to the (unix) release-kits, stopped XXrk.out from being created in sim mode, had XXrk.out being create in the release dir not just the current dir (sometimes they differ)

  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/bin/bash
2function show_title() {
3 echo "O---------------------------------------------O"
4 echo "| |"
5 echo -n "| $rk_name ";
6 for a in `seq 0 $(( 40 - ${#rk_name} ))`; do echo -n " "; done; echo "|"
7 echo -n "| $rk_fullname ";
8 for a in `seq 0 $(( 40 - ${#rk_fullname} ))`; do echo -n " "; done; echo "|"
9 echo "| |"
10 echo "O---------------------------------------------O"
11}
12
13#pre checks
14if [ "$rk_name" == "" ]; then
15 echo "rk_name not set";
16 exit;
17elif [ "$RK_HOME" == "" ]; then
18 echo "RK_HOME not set";
19 exit
20fi
21
22function 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
31 echo " -help"
32 echo " show this help screen"
33 echo
34 echo " -from <target>"
35 echo " start execution from the target with the given target address"
36 echo
37 echo " -to <target>"
38 echo " stop execution just before the target with the given target address"
39 echo
40 echo " -descend <target>"
41 echo " execute only the target with the given address, including subtargets"
42 echo
43 echo " -cp"
44 echo " show the classpath being used by $rk_name"
45 echo
46 echo " -cmd"
47 echo " show the ant command being used by $rk_name"
48
49}
50
51#cd up a level or two if needed
52if [ ! -e "$rk_name-build.properties" ]; then
53 if [ -e "../$rk_name-build.properties" ]; then
54 RKOLDPWD=`pwd`
55 cd ..
56 elif [ -e "../../$rk_name-build.properties" ]; then
57 RKOLDPWD=`pwd`
58 cd ../..
59 fi
60fi
61
62#work out the classpath
63CLASSPATH=$JAVA_HOME/lib/tools.jar
64for file in $RK_HOME/lib/*.jar; do
65 CLASSPATH=$CLASSPATH:$file
66done
67for file in $RK_HOME/packages/ant/lib/*.jar; do
68 CLASSPATH=$CLASSPATH:$file
69done
70for file in $RK_HOME/packages/ant-installer/lib/*.jar; do
71 CLASSPATH=$CLASSPATH:$file
72done
73CLASSPATH=$CLASSPATH:$RK_HOME/packages/ant-installer/classes
74
75export CLASSPATH
76
77#set ANT_HOME
78export ANT_HOME=$RK_HOME/packages/ant
79export ANT_OPTS=-Xmx800M
80
81#create the command
82toexec="$ANT_HOME/bin/ant -addressing -lib `pwd`/installer/classes -f $RK_HOME/ant-scripts/build.xml -Dbasedir=`pwd` -D$rk_name.home=$RK_HOME"
83
84#pass on the arguments
85while [ "$1" != "" ]; do
86
87 if [ "$1" == "-help" ]; then
88 show_help
89 exit
90 elif [ "$1" == "-cp" ]; then
91 echo $CLASSPATH
92 exit
93 elif [ "$1" == "-cmd" ]; then
94 show_cmd=true
95 elif [ "$1" == "-sim" ]; then
96 toexec="$toexec $1"
97 sim_mode=on
98 else
99 toexec="$toexec $1"
100 fi
101 shift
102
103done
104
105#execute (or show the command to be executed)
106if [ "$show_cmd" == "true" ]; then
107 echo $toexec
108elif [ "$sim_mode" == "on" ]; then
109 show_title
110 $toexec
111else
112 show_title | tee ${rk_name}.out
113 $toexec 2>&1 | tee -a ${rk_name}.out
114fi
115
116if [ "$RKOLDPWD" != "" ]; then
117 cd $RKOLDPWD
118fi
119
Note: See TracBrowser for help on using the repository browser.