File: makeJNLP.sh

package info (click to toggle)
emboss 5.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 81,332 kB
  • ctags: 25,201
  • sloc: ansic: 229,873; java: 29,051; sh: 10,636; perl: 8,714; makefile: 1,227; csh: 520; asm: 351; pascal: 237; xml: 94; modula3: 8
file content (275 lines) | stat: -rwxr-xr-x 8,483 bytes parent folder | download | duplicates (2)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
#!/bin/sh
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
#  @author: Copyright (C) Tim Carver
#
#
# Install EMBOSS & Jemboss
#
#

######################## Functions ########################


getJavaHomePath()
{
  JAVA_HOME_TMP=${JAVA_HOME_TMP-`which java 2>/dev/null`}
#  JAVA_HOME_TMP=`which java`

  if [ ! -f "$JAVA_HOME_TMP" ]; then
     if [ -d /usr/java/j2sdk1.4.1 ]; then
       JAVA_HOME_TMP=/usr/java/j2sdk1.4.1
     elif [ -d /usr/local/java/j2sdk1.4.1 ]; then
       JAVA_HOME_TMP=/usr/local/java/j2sdk1.4.1
     else
       JAVA_HOME_TMP=0
     fi
  else
    JAVA_HOME_TMP=`dirname $JAVA_HOME_TMP`
    JAVA_HOME_TMP=`dirname $JAVA_HOME_TMP`
  fi
}


echo
echo '*** Run this script from the installed jemboss utils directory.'
echo '*** If you are using SSL the script will use the client.keystore'
echo '*** in the $JEMBOSS/resources directory to create client.jar'
echo '*** which is wrapped with the Jemboss client in Jemboss.jar.'
echo '*** Press any key to continue.'
read KEY

CWPWD=`dirname $PWD`
CWPWD2=`dirname $CWPWD`

while [ ! -d "$CWPWD/resources" ]
do
  echo
  echo "Enter the installed jemboss directory "
  echo "[/usr/local/emboss/share/EMBOSS/jemboss]:"
  read TMP
  if [ $TMP != "" ]; then
    CWPWD=$TMP
  fi
done

#
#

if [ ! -f "$CWPWD/resources/acdstore.jar" ]; then

  ACDDIR=0
  while [ ! -d "$ACDDIR" ]
  do
    echo "Enter the directory where the acd files are stored"
    echo "[$CWPWD2/acd/]:"
    read ACDDIR
    if [ "$ACDDIR" = "" ]; then
      ACDDIR="$CWPWD2/acd/"
    fi
    echo
  done
fi

if [ ! -d "$CWPWD/jnlp" ]; then
  mkdir $CWPWD/jnlp
fi

getJavaHomePath
JAVA_HOME=$JAVA_HOME_TMP
while [ ! -f "$JAVA_HOME/bin/keytool" ]
do
  echo "Enter java (1.4 or above) location [/usr/local/java/]: "
  read JAVA_HOME
  if [ "$JAVA_HOME" = "" ]; then
    JAVA_HOME="/usr/local/java/"
  fi
done

PATH=$JAVA_HOME/bin/:$PATH: ; export PATH

if [ ! -f "$CWPWD/resources/acdstore.jar" ]; then
  echo
  echo "Create acdstore.jar to contain acd files."
  cd $ACDDIR
  jar cf acdstore.jar *.acd
fi

cd $CWPWD

#
# Wrap client.keystore for JNLP 

if [ -f "resources/client.keystore" ]; then
  echo
  echo "Create client.jar to contain client.keystore."
  cd resources
  jar cf client.jar client.keystore
  cd ..
else
  echo
  echo "*** WARNING! If you are using an SSL Jemboss server then"
  echo "*** this will not work as the script has not found the"
  echo "*** client keystore file."
fi

if [ ! -f "$CWPWD/resources/acdstore.jar" ]; then
  cp $ACDDIR/acdstore.jar resources/
fi

#
# Create Jemboss jar file

cd $CWPWD
jar cf Jemboss.jar images/* org/emboss/jemboss/*class resources/*.jar \
        resources/version resources/jemboss.properties \
        resources/*html 
jar uf Jemboss.jar org/emboss/jemboss/*/*class 
jar uf Jemboss.jar org/emboss/jemboss/*/*/*class 

mv Jemboss.jar jnlp
cp lib/*jar jnlp
cp lib/axis/*jar jnlp
cp images/Jemboss_logo_large.gif jnlp
cp utils/template.html jnlp/index.html
cd jnlp
rm mail.jar activation.jar servlet.jar log4j-1.2.8.jar axis-ant.jar

echo
echo
echo "The following information is used by keytool to"
echo "create a key store...."
echo
echo "What is your first and last name [Unknown]?"
read NAME
echo "What is the name of your organisational unit [Unknown]?"
read ORGU
echo "What is the name of your organisation [Unknown]?"
read ORG
echo "What is the name of your City or Locality [Unknown]?"
read LOC
echo "What is the name of your State or Province [Unknown]?"
read STATE
echo "What is the two-letter country code for this unit [Unknown]?"
read CODE

echo "Give a key password (at least 6 characters):"
read KEYPASS
echo "Give a store password (at least 6 characters):"
read STOREPASS

echo
echo "Provide the validity period for the signed jars, i.e. the"
echo "number of days before they expire and new ones need to be made [90]:"
read VALID
echo
                                                                                                      
if [ "$VALID" = "" ]; then
  VALID=90
fi
                                                                                                      
#
# create a keystore file

keytool -genkey -alias signFiles -dname "CN=$NAME, \
        OU=$ORGU, O=$ORG, L=$LOC, S=$STATE, C=$CODE" \
        -keypass $KEYPASS -storepass $STOREPASS -keystore jembossstore  -validity $VALID

#
# sign each of the jar files

echo
echo
echo "Each of the jar files will now be signed...."
echo
for i in *.jar; do 
  echo "Signing $i"
  jarsigner -keystore jembossstore -storepass $STOREPASS -keypass $KEYPASS \
           -signedjar s$i $i signFiles 
done;

#
# create a jnlp template file

JNLP="Jemboss.jnlp"
if [ -f "$JNLP" ]; then
  echo "$JNLP exists. Enter a new JNLP file name: "
  read JNLP
fi

echo '<?xml version="1.0" encoding="UTF-8"?>'            > $JNLP
echo '<jnlp'                                            >> $JNLP
echo '        spec="1.0+"'                              >> $JNLP
echo '        codebase="http://EDIT"'                   >> $JNLP
echo '        href="'$JNLP'">'                          >> $JNLP 
echo '         <information>'                           >> $JNLP  
echo '           <title>Jemboss</title>'                >> $JNLP  
echo '           <vendor>HGMP-RC</vendor> '             >> $JNLP  
echo '           <homepage href="http://emboss.sourceforge.net/Jemboss/"/>' \
                                                        >> $JNLP  
echo '           <description>Jemboss</description>'    >> $JNLP  
echo '           <description kind="short">A Java user interface to EMBOSS.' \
                                                        >> $JNLP  
echo '           </description>'                        >> $JNLP 
echo '           <icon href="Jemboss_logo_large.gif"/>' >> $JNLP 
echo '           <offline-allowed/>'                    >> $JNLP 
echo '         </information>'                          >> $JNLP 
echo '         <security>'                              >> $JNLP 
echo '           <all-permissions/>'                    >> $JNLP 
echo '         </security>'                             >> $JNLP 
echo '         <resources>'                             >> $JNLP 
echo '           <j2se version="1.3+"/>'                >> $JNLP 

echo '             <jar href="'sjaxrpc.jar'"/>'                 >> $JNLP
echo '             <jar href="'saxis.jar'"/>'                   >> $JNLP
echo '             <jar href="'scommons-logging.jar'"/>'        >> $JNLP
echo '             <jar href="'scommons-discovery.jar'"/>'      >> $JNLP
echo '             <jar href="'sJemboss.jar'"  main="'true'"/>' >> $JNLP
for i in s*.jar; do
  if (test $i != "sJemboss.jar") && (test $i != "sjaxrpc.jar") && (test $i != "saxis.jar");then
    if (test $i != "scommons-logging.jar") && (test $i != "scommons-discovery.jar");then
      if (test $i != "saaj.jar");then
        echo '             <jar href="'$i'"/>'          >> $JNLP
      fi
    fi
  fi
done;

echo '         </resources>'                            >> $JNLP
echo '         <application-desc main-class="org.emboss.jemboss.Jemboss"/>' \
                                                        >> $JNLP
echo '       </jnlp>'                                   >> $JNLP
 
#
#
 
echo
echo
echo "*** The signed jar files, index.html and $JNLP have been"
echo "*** created in the directory $CWPWD/jnlp."
echo "*** "
echo "*** Please edit the 'codebase' line in $JNLP."
echo "*** Also, edit the 'Click here' line in index.html to point"
echo "*** href at $JNLP."
echo "*** The 'jnlp' directory will then need to be added to your HTTP"
echo "*** server configuration file or moved into the www data"
echo "*** directories."
echo "*** "
echo "*** For your http server to recognise the jnlp application, the"
echo "*** following line needs to be added to the mime.types file:"
echo "*** application/x-java-jnlp-file jnlp"
echo