From d14c75c38af62b1508acc0c096ae557a62f465d3 Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Thu, 11 Sep 2014 13:21:57 +0200 Subject: [PATCH] labs: split out process_begin_files Move the processing of *.begin status files into a separate function. Call that function only if the host's status directory is shared with the client scripts (through VirtualBox guest-additions). Change-Id: I7716528c02aa4f8b5fc0901ff91ba5d37b5a0d9f --- labs/lib/osbash/functions.host | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/labs/lib/osbash/functions.host b/labs/lib/osbash/functions.host index d50266d3..9ca92af8 100644 --- a/labs/lib/osbash/functions.host +++ b/labs/lib/osbash/functions.host @@ -157,6 +157,17 @@ function autostart_reset { clean_dir "$STATUS_DIR" } +function process_begin_files { + local processing=("$STATUS_DIR"/*.sh.begin) + if [ -n "${processing[0]-}" ]; then + local file + for file in "${processing[@]}"; do + echo >&2 -en "\nVM processing $(basename "$file" .begin)" + rm "$file" + done + fi +} + # Wait until all autofiles are processed (indicated by a "$STATUS_DIR/done" # file created either by osbashauto or ssh_process_autostart) function wait_for_autofiles { @@ -176,13 +187,7 @@ function wait_for_autofiles { fi # Note: begin files (created by indicate_current_auto) are only visible # if the STATUS_DIR directory is shared between host and VM - local processing=("$STATUS_DIR"/*.sh.begin) - if [ -n "${processing[0]-}" ]; then - for f in "${processing[@]}"; do - echo >&2 -en "\nVM processing $(basename "$f" .begin)" - rm "$f" - done - fi + ${WBATCH:-:} process_begin_files echo >&2 -n . sleep 1 done