diff --git a/recovery-simulator/recovery.sh b/recovery-simulator/recovery.sh index 7476bc2d..271e4bb4 100755 --- a/recovery-simulator/recovery.sh +++ b/recovery-simulator/recovery.sh @@ -21,7 +21,7 @@ set -e # shellcheck disable=SC3028 case ":${SHELLOPTS-}:" in *':xtrace:'*) # Auto-enable `set -x` for shells that do NOT support SHELLOPTS - set -x + #set -x COVERAGE='true' ;; *) ;; @@ -235,11 +235,16 @@ if test "${ENV_RESETTED:-false}" = 'false'; then THIS_SCRIPT="$(realpath "${0:?}" 2> /dev/null)" || fail_with_msg 'Failed to get script filename' - if test "${COVERAGE:-false}" = 'false'; then - exec env -i -- ENV_RESETTED=true BB_GLOBBING='0' THIS_SCRIPT="${THIS_SCRIPT:?}" TMPDIR="${TMPDIR:-${RUNNER_TEMP:-${TMP:-${TEMP:-/tmp}}}}" DEBUG_LOG="${DEBUG_LOG-}" LIVE_SETUP_ALLOWED="${LIVE_SETUP_ALLOWED-}" FORCE_HW_BUTTONS="${FORCE_HW_BUTTONS-}" CI="${CI-}" SHELLOPTS="${SHELLOPTS-}" SHELL="${SHELL-}" PATH="${PATH:?}" bash -- "${THIS_SCRIPT:?}" "${@}" || fail_with_msg 'failed: exec' - else - exec env -i -- ENV_RESETTED=true BB_GLOBBING='0' THIS_SCRIPT="${THIS_SCRIPT:?}" TMPDIR="${TMPDIR:-${RUNNER_TEMP:-${TMP:-${TEMP:-/tmp}}}}" DEBUG_LOG="${DEBUG_LOG-}" LIVE_SETUP_ALLOWED="${LIVE_SETUP_ALLOWED-}" FORCE_HW_BUTTONS="${FORCE_HW_BUTTONS-}" CI="${CI-}" SHELLOPTS="${SHELLOPTS-}" SHELL="${SHELL-}" PATH="${PATH:?}" COVERAGE="true" bashcov -- "${THIS_SCRIPT:?}" "${@}" || fail_with_msg 'failed: exec' - fi + reset_env_and_rerun_myself() + { + if test "${COVERAGE:-false}" = 'false'; then + exec env -i -- ENV_RESETTED=true PATH="${PATH:?}" BB_GLOBBING='0' THIS_SCRIPT="${THIS_SCRIPT:?}" TMPDIR="${TMPDIR:-${RUNNER_TEMP:-${TMP:-${TEMP:-/tmp}}}}" DEBUG_LOG="${DEBUG_LOG-}" LIVE_SETUP_ALLOWED="${LIVE_SETUP_ALLOWED-}" FORCE_HW_BUTTONS="${FORCE_HW_BUTTONS-}" CI="${CI-}" bash -- "${THIS_SCRIPT:?}" "${@}" + else + exec env -i -- ENV_RESETTED=true PATH="${PATH:?}" BB_GLOBBING='0' THIS_SCRIPT="${THIS_SCRIPT:?}" TMPDIR="${TMPDIR:-${RUNNER_TEMP:-${TMP:-${TEMP:-/tmp}}}}" DEBUG_LOG="${DEBUG_LOG-}" LIVE_SETUP_ALLOWED="${LIVE_SETUP_ALLOWED-}" FORCE_HW_BUTTONS="${FORCE_HW_BUTTONS-}" CI="${CI-}" SHELLOPTS="${SHELLOPTS-}" bash -- "${THIS_SCRIPT:?}" "${@}" + fi + } + + reset_env_and_rerun_myself "${@}" || fail_with_msg 'failed: exec' exit 127 fi unset ENV_RESETTED @@ -250,6 +255,11 @@ if test -z "${FORCE_HW_BUTTONS-}"; then unset FORCE_HW_BUTTONS; fi if test -z "${CI-}"; then unset CI; fi if test -z "${SHELLOPTS-}"; then unset SHELLOPTS; fi +#echo '------' +#env +#echo ":$PATH" +#exit 112 + detect_os_and_other_things if test -n "${CYGPATH?}" && test "${TMPDIR?}" = '/tmp'; then