summaryrefslogtreecommitdiffstats
path: root/hudson-builds/promote-to-webstart.sh
blob: 6c3dae0924a8fcec7c1e30fe6e02c73d7ec60c1c (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#! /bin/bash

##
#
# Will promote an aggregated/archived folder to a webstart folder.
#   - copy adir -> wsdir
#   - filters jnlp files (url)
#   - repack
#   - sign
#   - pack200
#
# promote-to-webstart.sh <adir> <wsdir> <url> <pkcs12-keystore> <storepass> [signarg]
# eg.
#   promote-to-webstart.sh /srv/www/deployment/b3 \
#                          /srv/www/deployment/webstart-b3 \
#                          http://lala.lu/webstart-b3 \
#                          secret.p12 \
#                          PassWord \
#                          "something"
#
##

abuild=$1
shift

wsdir=$1
shift

url=$1
shift

keystore=$1
shift

storepass=$1
shift

signarg="$*"

if [ -z "$abuild" -o -z "$wsdir" -o -z "$url" -o -z "$keystore" -o -z "$storepass" ] ; then
    echo "usage $0 abuilddir webstartdir url pkcs12-keystore storepass [signarg]"
    exit 1
fi

if [ ! -e $abuild ] ; then
    echo $abuild does not exist
    exit 1
fi

if [ -e $wsdir ] ; then
    echo $wsdir already exist
    exit 1
fi

if [ ! -e $keystore ] ; then
    echo $keystore does not exist
    exit 1
fi

sdir=`dirname $0`

thisdir=`pwd`

logfile=$thisdir/`basename $0 .sh`.log

. $sdir/../deployment/funcs_jnlp_relocate.sh
. $sdir/../deployment/funcs_jars_pack_sign.sh

function echo_info() {
    echo
    echo "Promotion webstart jars"
    echo
    echo "  $abuild -> $wsdir"
    echo "  $url"
    echo
    echo `date`
    echo
}

function promote-webstart-jars() {

#
# repack it .. so the signed jars can be pack200'ed
#
wsdir_jars_repack  $wsdir


#
# sign it
#
wsdir_jars_sign    $wsdir $keystore $storepass $signarg

#
# pack200
#
wsdir_jars_pack200 $wsdir

cp -av $logfile $wsdir

}

echo_info 2>&1 | tee $logfile

cp -a $abuild $wsdir 2>&1 | tee $logfile

copy_relocate_jnlps $url $wsdir 2>&1 | tee $logfile

promote-webstart-jars 2>&1 | tee $logfile