chiark / gitweb /
jpctb: add --dry-run and --setup-only modes
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Tue, 24 Aug 2010 23:01:23 +0000 (00:01 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Tue, 24 Aug 2010 23:12:14 +0000 (00:12 +0100)
jpctb

diff --git a/jpctb b/jpctb
index c4f2b6e..54c1f41 100755 (executable)
--- 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'"
                        ;;
        *)
@@ -144,13 +157,17 @@ END
 
 #---------- run the control panel ----------
 
+if $check_only; then echo "Check successful."; exit 0; fi
+
 set +e
-"$javadir/bin/java" \
+$setup_only_simulate "$javadir/bin/java" \
  -Dcom.tedpearson.ypp.market.controlpanel.exitstatus=12 \
  -jar "$srcjardir/PCTB-ControlPanel.jar"
 rc=$?
 set -e
 
+if $setup_only; then rc=12; fi
+
 case $rc in
 0)     echo "launcher dialogue closed, quitting"; exit 0 ;;
 12)    ;;
@@ -217,4 +234,4 @@ chmod +x -- "$wrapper"
 
 #---------- now run it ----------
 
-exec "$yohoho" -Djava.home="$linkfarm/jre"
+exec $setup_only_simulate "$yohoho" -Djava.home="$linkfarm/jre"