diff --git a/misc/build.func b/misc/build.func index 8b6a7a69a..e61d2c649 100644 --- a/misc/build.func +++ b/misc/build.func @@ -3578,6 +3578,13 @@ build_container() { # DEV_MODE exports (optional, for debugging) export BUILD_LOG="$BUILD_LOG" export INSTALL_LOG="/root/.install-${SESSION_ID}.log" + + # Keep host-side logging on BUILD_LOG (not exported — invisible to container) + # Without this, get_active_logfile() would return INSTALL_LOG (a container path) + # and all host msg_info/msg_ok/msg_error would write to /root/.install-SESSION.log + # on the HOST instead of BUILD_LOG, causing incomplete telemetry logs. + _HOST_LOGFILE="$BUILD_LOG" + export dev_mode="${dev_mode:-}" export DEV_MODE_MOTD="${DEV_MODE_MOTD:-false}" export DEV_MODE_KEEP="${DEV_MODE_KEEP:-false}" diff --git a/misc/core.func b/misc/core.func index 23c318fd9..33ac1752b 100644 --- a/misc/core.func +++ b/misc/core.func @@ -395,12 +395,20 @@ ssh_check() { # get_active_logfile() # # - Returns the appropriate log file based on execution context -# - BUILD_LOG: Host operations (container creation) +# - _HOST_LOGFILE: Override for host context (keeps host logging on BUILD_LOG +# even after INSTALL_LOG is exported for the container) # - INSTALL_LOG: Container operations (application installation) +# - BUILD_LOG: Host operations (container creation) # - Fallback to BUILD_LOG if neither is set # ------------------------------------------------------------------------------ get_active_logfile() { - if [[ -n "${INSTALL_LOG:-}" ]]; then + # Host override: _HOST_LOGFILE is set (not exported) in build.func to keep + # host-side logging in BUILD_LOG after INSTALL_LOG is exported for the container. + # Without this, all host msg_info/msg_ok/msg_error would write to + # /root/.install-SESSION.log (a container path) instead of BUILD_LOG. + if [[ -n "${_HOST_LOGFILE:-}" ]]; then + echo "$_HOST_LOGFILE" + elif [[ -n "${INSTALL_LOG:-}" ]]; then echo "$INSTALL_LOG" elif [[ -n "${BUILD_LOG:-}" ]]; then echo "$BUILD_LOG"