3 # example construction of JRE and JDK directories from the DLJ bundles
5 # Copyright © 2006 Sun Microsystems, Inc.
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be
16 # included in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 # Sun, Sun Microsystems, the Sun logo and Java, Java HotSpot,
27 # and JVM trademarks or registered trademarks of Sun Microsystems,
28 # Inc. in the U.S. and other countries.
34 echo "usage: ${program} path/to/unbundle-jdk path/to/linux-jdk path/to/linux-jre"
41 if [ ! -d $undir ]; then
42 echo "${program}: unbundle directory not found: $undir"
45 # make sure javahome is the JDK
46 javahome
=`echo $undir/*/demo`
47 if [ ! -d $javahome ]; then
48 echo "${program}: unbundle directory incorrect: $undir"
49 echo " expecting $undir/jdk1.5.0_xx"
52 javahome
=`dirname $javahome`
55 jdkdirp
=`dirname $jdkdir`
56 jdkbase
=`basename $jdkdir`
57 if [ ! -d $jdkdirp ]; then
58 echo "${program}: parent directory for JDK does not exist: $jdkdirp"
65 jdkdir
=$jdkdirp/$jdkbase
67 jredirp
=`dirname $jredir`
68 jrebase
=`basename $jredir`
69 if [ ! -d $jredirp ]; then
70 echo "${program}: parent directory for JRE does not exist: $jredirp"
77 jredir
=$jredirp/$jrebase
81 if [ -r $jdkdir ]; then
82 echo "${program}: directory for JDK already exists: $jdkdir"
85 if [ -r $jredir ]; then
86 echo "${program}: directory for JRE already exists: $jredir"
92 echo "copying over the JDK tree..."
93 cp -a $javahome $jdkdir
99 # make a softlink from the $link to the $target
100 # make this a relative link
101 targetb
=(`echo $target | tr '/' ' '`)
102 linkb
=(`echo $link | tr '/' ' '`)
103 (( n
= ${#targetb[*]} ))
104 (( m
= ${#linkb[*]} ))
106 if [ $m -lt $c ]; then
109 for (( i
= 0 ; i
< c
; i
++ )); do
110 if [ ${targetb[$i]} != ${linkb[$i]} ]; then
111 # echo components differ, stopping
116 for (( j
= i
+ 1; j
< m
; j
++ )); do
123 for (( j
= i
; j
< n
; j
++ )); do
127 rel
="$rel/${targetb[$j]}"
134 echo "creating JRE directory..."
136 # ln -s $jdkdir/jre $jredir
138 linkrel
$jdkdir/jre
$jredir
142 echo "unpacking jars..."
143 unpack200
=$jdkdir/bin
/unpack200
144 if [ ! -x $unpack200 ]; then
145 echo "${program}: file missing $unpack200"
149 PACKED_JARS
=`find . -name '*.pack'`
150 for i
in $PACKED_JARS; do
153 jbase
=`basename $i .pack`
154 if ! $unpack200 $jdkdir/$jdir/$jbase.pack
$jdkdir/$jdir/$jbase.jar
; then
155 echo "${program}: error unpacking $jdkdir/$jdir/$jbase.jar"
157 if [ ! -r $jdkdir/$jdir/$jbase.jar
]; then
158 echo "${program}: missing $jdkdir/$jdir/$jbase.jar"
160 echo " $jdir/$jbase.jar"
162 rm $jdkdir/$jdir/$jbase.pack
168 # if this is a client installation...
169 compiler
="`$jdkdir/bin/java -client -version 2>&1 | tail -n +3 | cut -d' ' -f1-4`"
170 if [ "X$compiler" = "XJava HotSpot(TM) Client VM" ]; then
171 # create the CDS archive
172 echo "creating the class data sharing archive..."
173 if ! $jdkdir/bin
/java
-client -Xshare:dump
> /dev
/null
2>&1; then
174 echo "returned error code $?"
180 echo "setting up the JRE man pages..."
181 # note this list is slightly different for OpenSolaris bundles
182 jreman
=/tmp
/jre.man.txt
184 man/ja_JP.eucJP/man1/java.1
185 man/ja_JP.eucJP/man1/javaws.1
186 man/ja_JP.eucJP/man1/keytool.1
187 man/ja_JP.eucJP/man1/kinit.1
188 man/ja_JP.eucJP/man1/klist.1
189 man/ja_JP.eucJP/man1/ktab.1
190 man/ja_JP.eucJP/man1/orbd.1
191 man/ja_JP.eucJP/man1/pack200.1
192 man/ja_JP.eucJP/man1/policytool.1
193 man/ja_JP.eucJP/man1/rmid.1
194 man/ja_JP.eucJP/man1/rmiregistry.1
195 man/ja_JP.eucJP/man1/servertool.1
196 man/ja_JP.eucJP/man1/tnameserv.1
197 man/ja_JP.eucJP/man1/unpack200.1
206 man/man1/policytool.1
208 man/man1/rmiregistry.1
209 man/man1/servertool.1
213 # create jre/man directory
214 # mkdir $jdkdir/jre/man
215 # move the real JRE man pages to jre/man
216 # link the JDK JRE man pages to jre/man
217 # real JDK man pages stay where they are
218 for m
in `cat $jreman`; do
219 manpath
=`dirname $jdkdir/jre/$m`
221 mv $jdkdir/$m $jdkdir/jre
/$m
222 linkrel
$jdkdir/jre
/$m $jdkdir/$m
224 # link in Japanese man pages
225 ln -s ja_JP.eucJP
$jdkdir/jre
/man
/ja
230 echo "eliminating duplication between the JDK and JDK/jre..."
231 jdkcomm
=/tmp
/jdk.bin.
comm.txt
249 # note there is little point in linking these common files
252 # THIRDPARTYLICENSEREADME.txt
253 # And this file is unique to the JDK
255 # And these files are unique to the JDK/jre/
259 for p
in `cat $jdkcomm`; do
261 # this is a relative link
262 ln -s ..
/jre
/$p $jdkdir/$p
267 if [ $# -eq 3 ] ; then