X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=jarrg-ian.git;a=blobdiff_plain;f=jpctb;h=50f295298b14b58b3cd688eafb23c4bef19aaaac;hp=8b61ed8942f655246b9ac7ff42cea09c40f7655a;hb=557df0ccd54dcee5450a13c389f309b2ad53cd3b;hpb=afbe2cc2cc040e051ee1f55be352db0bf319a8e1 diff --git a/jpctb b/jpctb index 8b61ed8..50f2952 100755 --- a/jpctb +++ b/jpctb @@ -24,7 +24,7 @@ usage () { cat <&2 "jpctb: $*" exit 127 } + +nojre () { + fail "couldn't find the right jre: $* + perhaps you should make ypp's java symlink (normally yohoho/java) + point to your jre, eg to /usr/lib/jvm/java-6-sun" +} + badusage () { fail "bad usage: $*" } +check_only=false +setup_only=false +setup_only_simulate='' + while [ $# -ge 1 ]; do case "$1" in -) shift; break;; @@ -44,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'" ;; *) @@ -73,37 +93,96 @@ fi yppdir="${yohoho%/*}" +# this replicates the java-searching logic from yohoho/yohoho: if [ -x "$yppdir/java/bin/java" ]; then - javadir="$yppdir/java" -elif [ x"$JAVA_HOME" != x ] && [ -x "$JAVA_HOME/bin/java" ]; then - javadir="$JAVA_HOME" + yppjava="$yppdir/java/bin/java" +elif [ -x "$JAVA_HOME/bin/java" ]; then + yppjava="$JAVA_HOME/bin/java" else - fail "could not find java runtime system" + set +e + yppjava=`type -p java 2>&1` + set -e +fi + +cat <&2 "control panel failed with exit status $rc"; exit "$rc" ;; +esac + #---------- create the temporary are and link farm ---------- @@ -111,15 +190,14 @@ rm -rf -- "$jtmp" mkdir -- "$jtmp" "$extdir" "$linkfarm" cp "$srcjardir"/PCTB*.jar "$extdir" -lndir -silent "$javadir" "$linkfarm" +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" -export JPCTB_JRE="$javadir/jre" cat <<'END' >"$wrapper" #!/bin/bash @@ -165,4 +243,4 @@ chmod +x -- "$wrapper" #---------- now run it ---------- -exec "$yohoho" -Djava.home="$linkfarm/jre" +exec $setup_only_simulate "$yohoho" -Djava.home="$linkfarm/$jreleaf"