-
Notifications
You must be signed in to change notification settings - Fork 0
/
jnlp-codebase.sh
executable file
·51 lines (42 loc) · 1.23 KB
/
jnlp-codebase.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
if [ ! -d agileDomain/applications ]; then
>&2 echo "Must run in the directory of AGILE_HOME"
exit 1
fi
if [ $# -gt 1 ]; then
>&2 echo "Illegal Argument: $2"
exit 1
fi
pushd agileDomain/applications > /dev/null
url=$1
unzip -oq application.ear JavaClient.war
unzip -oq JavaClient.war custom.jnlp pcclient.jnlp wls/ext.jnlp hotfixes/hf*.jnlp 2> /dev/null
list=(custom.jnlp pcclient.jnlp wls/ext.jnlp)
if [ -d hotfixes ]; then
while read -r item; do
list+=(hotfixes/$item)
done <<< "`ls -v hotfixes`"
fi
echo Current codebase
for item in ${list[*]}; do
codebase=`grep -Po '(?<=codebase=")[^"]*(?=")' ${item}`
echo "${codebase:-(empty)} - ${item}"
done
echo
if [ $# -eq 1 ]; then
echo "New codebase: ${url:-(empty)}"
for item in ${list[*]}; do
sed -Ei 's~codebase="[^"]*"~codebase="'${url}'"~g' ${item}
done
zip -q JavaClient.war custom.jnlp pcclient.jnlp wls/ext.jnlp hotfixes/hf*.jnlp
zip -q application.ear JavaClient.war
else
echo "To change codebase, run the following command line. url can be empty."
echo "jnlp-codebase.sh 'url'"
echo "jnlp-codebase.sh ''"
fi
rm -r JavaClient.war custom.jnlp pcclient.jnlp wls/
if [ -d hotfixes ]; then
rm -r hotfixes
fi
popd > /dev/null