X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=jarrg-ian.git;a=blobdiff_plain;f=jpctb;h=50f295298b14b58b3cd688eafb23c4bef19aaaac;hp=ee1482ab97c0cffbac76e3d348abe7e2b0843c71;hb=1b3d354d33db2696417989647cf04f5302907065;hpb=61c9b37317a18cf120062c10db49f1b935898d3b diff --git a/jpctb b/jpctb index ee1482a..50f2952 100755 --- a/jpctb +++ b/jpctb @@ -43,6 +43,10 @@ badusage () { fail "bad usage: $*" } +check_only=false +setup_only=false +setup_only_simulate='' + while [ $# -ge 1 ]; do case "$1" in -) shift; break;; @@ -51,6 +55,15 @@ while [ $# -ge 1 ]; do srcjardir="$1" shift || badusage "--jpctb needs a value" ;; + --check-only) + check_only=true + shift + ;; + --setup-only) + setup_only=true + setup_only_simulate=echo + shift + ;; -*) badusage "unknown option \`$1'" ;; *) @@ -106,18 +119,25 @@ fi javadir="${yppjava%/bin/java}" if [ -x "$javadir/jre/bin/java" ]; then echo " java/ points to the jre, good" + jreleaf=jre else echo " java/ has just the executable bin/java, trying readlink" absjava=`readlink -f "$yppjava"` echo " abs. java: \"$absjava\"" case "$absjava" in - */jre/bin/java) - echo " found jre directory, good" - javadir="${absjava%/jre/bin/java}" + */*/bin/java) + javadir="${absjava%/bin/java}" + jreleaf="${javadir##*/}" + javadir="${javadir%/*}" + echo " jre leaf dir: \"$jreleaf\"" + case "$jreleaf" in + jre) echo " found jre directory, good";; + jre1.*) echo " found versioned jre directory $jreleaf, ok";; + *) nojre "java binary not in jre dir ($jreleaf)";; + esac ;; *) - nojre "java binary not in jre dir" - ;; + nojre "real java binary not in ../bin/java dir";; esac fi @@ -131,30 +151,36 @@ jtmp="$jpctbdir/tmp" linkfarm="$jtmp/linkfarm" extdir="$jtmp/ext" -export JPCTB_JRE="$javadir/jre" +export JPCTB_JRE="$javadir/$jreleaf" +realjava="$JPCTB_JRE/bin/java" #---------- confirm for the user which paths we're using ---------- cat <&2 "control panel failed with exit status $rc" ;; +*) echo >&2 "control panel failed with exit status $rc"; exit "$rc" ;; esac @@ -168,7 +194,7 @@ cp -Rs "$javadir"/. "$linkfarm"/. #---------- edit the linkfarm to have our jvm wrapper ---------- -wrapper="$linkfarm"/jre/bin/java +wrapper="$linkfarm"/$jreleaf/bin/java rm -- "$wrapper" export JPCTB_EXTDIR="$extdir" @@ -217,4 +243,4 @@ chmod +x -- "$wrapper" #---------- now run it ---------- -exec "$yohoho" -Djava.home="$linkfarm/jre" +exec $setup_only_simulate "$yohoho" -Djava.home="$linkfarm/$jreleaf"