1 | #!/bin/bash
|
---|
2 | function 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
|
---|
14 | if [ "$rk_name" == "" ]; then
|
---|
15 | echo "rk_name not set";
|
---|
16 | exit;
|
---|
17 | elif [ "$RK_HOME" == "" ]; then
|
---|
18 | echo "RK_HOME not set";
|
---|
19 | exit
|
---|
20 | fi
|
---|
21 |
|
---|
22 | function 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
|
---|
52 | if [ ! -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
|
---|
60 | fi
|
---|
61 |
|
---|
62 | #work out the classpath
|
---|
63 | CLASSPATH=$JAVA_HOME/lib/tools.jar
|
---|
64 | for file in $RK_HOME/lib/*.jar; do
|
---|
65 | CLASSPATH=$CLASSPATH:$file
|
---|
66 | done
|
---|
67 | for file in $RK_HOME/packages/ant/lib/*.jar; do
|
---|
68 | CLASSPATH=$CLASSPATH:$file
|
---|
69 | done
|
---|
70 | for file in $RK_HOME/packages/ant-installer/lib/*.jar; do
|
---|
71 | CLASSPATH=$CLASSPATH:$file
|
---|
72 | done
|
---|
73 | CLASSPATH=$CLASSPATH:$RK_HOME/packages/ant-installer/classes
|
---|
74 |
|
---|
75 | export CLASSPATH
|
---|
76 |
|
---|
77 | #set ANT_HOME
|
---|
78 | export ANT_HOME=$RK_HOME/packages/ant
|
---|
79 | export ANT_OPTS=-Xmx800M
|
---|
80 |
|
---|
81 | #create the command
|
---|
82 | 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"
|
---|
83 |
|
---|
84 | #pass on the arguments
|
---|
85 | while [ "$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 |
|
---|
103 | done
|
---|
104 |
|
---|
105 | #execute (or show the command to be executed)
|
---|
106 | if [ "$show_cmd" == "true" ]; then
|
---|
107 | echo $toexec
|
---|
108 | elif [ "$sim_mode" == "on" ]; then
|
---|
109 | show_title
|
---|
110 | $toexec
|
---|
111 | else
|
---|
112 | show_title | tee ${rk_name}.out
|
---|
113 | $toexec 2>&1 | tee -a ${rk_name}.out
|
---|
114 | fi
|
---|
115 |
|
---|
116 | if [ "$RKOLDPWD" != "" ]; then
|
---|
117 | cd $RKOLDPWD
|
---|
118 | fi
|
---|
119 |
|
---|