
Make osbashout abort if a client-side scripts returns an error; use a file named error in the status directory to signal the problem and to store the name of the offending script for use by Windows batch scripts. Have osbash.sh and the Windows batch scripts exit when an error file appears. Change-Id: I6722e75c9c23b99e5ed25b00429026c2e0ff6a12
60 lines
1.4 KiB
Batchfile
60 lines
1.4 KiB
Batchfile
ECHO.
|
|
ECHO %time% Batch script seems to have succeeded.
|
|
ECHO.
|
|
|
|
GOTO :terminate
|
|
|
|
REM Note: vbm_error falls through to terminate
|
|
:vbm_error
|
|
ECHO.
|
|
ECHO %time% VBoxManage returned with an error. Aborting.
|
|
ECHO.
|
|
|
|
:terminate
|
|
ENDLOCAL
|
|
PAUSE
|
|
EXIT
|
|
GOTO :eof
|
|
|
|
REM ============================================================================
|
|
REM
|
|
REM End of program, function definitions follow
|
|
REM
|
|
REM ============================================================================
|
|
:wait_auto
|
|
IF EXIST %STATUSDIR%\done (
|
|
DEL %STATUSDIR%\done
|
|
GOTO :eof
|
|
)
|
|
IF EXIST %STATUSDIR%\error (
|
|
ECHO.
|
|
ECHO %time% ERROR Script returned error:
|
|
ECHO.
|
|
TYPE %STATUSDIR%\error
|
|
ECHO.
|
|
ECHO %time% Aborting.
|
|
ECHO.
|
|
DEL %STATUSDIR%\error
|
|
GOTO :terminate
|
|
)
|
|
TIMEOUT /T 5 /NOBREAK
|
|
GOTO :wait_auto
|
|
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
:wait_poweroff
|
|
VBoxManage showvminfo %~1 --machinereadable|findstr poweroff
|
|
IF %errorlevel% EQU 0 GOTO :eof
|
|
TIMEOUT /T 2 /NOBREAK
|
|
GOTO :wait_poweroff
|
|
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
:vm_exists
|
|
VBoxManage list vms|findstr %~1
|
|
IF %errorlevel% NEQ 0 GOTO :eof
|
|
ECHO.
|
|
ECHO %time% VM %~1 already exists. Aborting.
|
|
ECHO.
|
|
GOTO :terminate
|
|
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
|
|
|