Index: share/examples/bhyve/vmrun.sh =================================================================== --- share/examples/bhyve/vmrun.sh +++ share/examples/bhyve/vmrun.sh @@ -54,7 +54,7 @@ usage() { local msg=$1 - echo "Usage: vmrun.sh [-aAEhiTv] [-c ] [-C ]" \ + echo "Usage: vmrun.sh [-aAEhiTvx] [-c ] [-C ]" \ "[-d ]" echo " [-e ] [-f ]" \ "[-F ]" @@ -95,6 +95,7 @@ echo " -u: RTC keeps UTC time" echo " -v: Wait for VNC client connection before booting VM" echo " -w: ignore unimplemented MSRs" + echo " -x: exit when bhyve exits, passing up the exit code" echo "" [ -n "$msg" ] && errmsg "$msg" exit 1 @@ -124,6 +125,7 @@ loader_opt="" bhyverun_opt="-H -A -P" pass_total=0 +exit_passthrough=0 # EFI-specific options efi_mode=0 @@ -134,7 +136,7 @@ vncsize=${DEFAULT_VNCSIZE} tablet="" -while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:L:m:n:p:P:t:Tuvw c ; do +while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:L:m:n:p:P:t:Tuvwx c ; do case $c in a) bhyverun_opt="${bhyverun_opt} -a" @@ -214,6 +216,9 @@ w) bhyverun_opt="${bhyverun_opt} -w" ;; + x) + exit_passthrough=1 + ;; *) usage ;; @@ -384,7 +389,7 @@ # 3 - VM generated a triple fault # all other non-zero status codes are errors # - if [ $bhyve_exit -ne 0 ]; then + if [ $exit_passthrough -ne 0 -o $bhyve_exit -ne 0 ]; then break fi done