diff --git a/misc/build.func b/misc/build.func index dcf8fb42c..e3f77b722 100644 --- a/misc/build.func +++ b/misc/build.func @@ -4133,8 +4133,7 @@ EOF' # Show combined log location if [[ -n "$CTID" && -n "${SESSION_ID:-}" ]]; then - echo "" - echo -e "${GN}✔${CL} Installation log: ${BL}${combined_log}${CL}" + msg_custom "📋" "${YW}" "Installation log: ${combined_log}" fi # Dev mode: Keep container or open breakpoint shell @@ -4157,19 +4156,21 @@ EOF' exit $install_exit_code fi - # Prompt user for cleanup with 60s timeout (plain echo - no msg_info to avoid spinner) + # Prompt user for cleanup with 60s timeout echo "" - echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}" + echo -en "${TAB}❓${TAB}${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}" if read -t 60 -r response; then if [[ -z "$response" || "$response" =~ ^[Yy]$ ]]; then # Remove container - echo -e "\n${TAB}${HOLD}${YW}Removing container ${CTID}${CL}" + echo "" + msg_info "Removing container ${CTID}" pct stop "$CTID" &>/dev/null || true pct destroy "$CTID" &>/dev/null || true - echo -e "${BFR}${CM}${GN}Container ${CTID} removed${CL}" + msg_ok "Container ${CTID} removed" elif [[ "$response" =~ ^[Nn]$ ]]; then - echo -e "\n${TAB}${YW}Container ${CTID} kept for debugging${CL}" + echo "" + msg_warn "Container ${CTID} kept for debugging" # Dev mode: Setup MOTD/SSH for debugging access to broken container if [[ "${DEV_MODE_MOTD:-false}" == "true" ]]; then @@ -4185,11 +4186,11 @@ EOF' fi else # Timeout - auto-remove - echo -e "\n${YW}No response - auto-removing container${CL}" - echo -e "${TAB}${HOLD}${YW}Removing container ${CTID}${CL}" + echo "" + msg_info "No response - removing container ${CTID}" pct stop "$CTID" &>/dev/null || true pct destroy "$CTID" &>/dev/null || true - echo -e "${BFR}${CM}${GN}Container ${CTID} removed${CL}" + msg_ok "Container ${CTID} removed" fi # Force one final status update attempt after cleanup diff --git a/misc/core.func b/misc/core.func index f13be64d3..838ebdd85 100644 --- a/misc/core.func +++ b/misc/core.func @@ -522,15 +522,9 @@ silent() { msg_custom "→" "${YWB}" "${cmd}" if [[ -s "$logfile" ]]; then - local log_lines=$(wc -l <"$logfile") - echo "--- Last 10 lines of silent log ---" + echo -e "\n${TAB}--- Last 10 lines of log ---" tail -n 10 "$logfile" - echo "-----------------------------------" - - # Show how to view full log if there are more lines - if [[ $log_lines -gt 10 ]]; then - msg_custom "📋" "${YW}" "View full log (${log_lines} lines): ${logfile}" - fi + echo -e "${TAB}-----------------------------------\n" fi exit "$rc" diff --git a/misc/error_handler.func b/misc/error_handler.func index c81d0d3c0..2f0fc2438 100644 --- a/misc/error_handler.func +++ b/misc/error_handler.func @@ -175,9 +175,9 @@ error_handler() { fi if [[ -n "$active_log" && -s "$active_log" ]]; then - echo "--- Last 20 lines of silent log ---" + echo -e "\n${TAB}--- Last 20 lines of log ---" tail -n 20 "$active_log" - echo "-----------------------------------" + echo -e "${TAB}-----------------------------------\n" # Detect context: Container (INSTALL_LOG set + /root exists) vs Host (BUILD_LOG) if [[ -n "${INSTALL_LOG:-}" && -d /root ]]; then @@ -204,23 +204,50 @@ error_handler() { fi echo "" - echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}" + if declare -f msg_custom >/dev/null 2>&1; then + echo -en "${TAB}❓${TAB}${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}" + else + echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}" + fi if read -t 60 -r response; then if [[ -z "$response" || "$response" =~ ^[Yy]$ ]]; then - echo -e "\n${YW}Removing container ${CTID}${CL}" + echo "" + if declare -f msg_info >/dev/null 2>&1; then + msg_info "Removing container ${CTID}" + else + echo -e "${YW}Removing container ${CTID}${CL}" + fi pct stop "$CTID" &>/dev/null || true pct destroy "$CTID" &>/dev/null || true - echo -e "${GN}✔${CL} Container ${CTID} removed" + if declare -f msg_ok >/dev/null 2>&1; then + msg_ok "Container ${CTID} removed" + else + echo -e "${GN}✔${CL} Container ${CTID} removed" + fi elif [[ "$response" =~ ^[Nn]$ ]]; then - echo -e "\n${YW}Container ${CTID} kept for debugging${CL}" + echo "" + if declare -f msg_warn >/dev/null 2>&1; then + msg_warn "Container ${CTID} kept for debugging" + else + echo -e "${YW}Container ${CTID} kept for debugging${CL}" + fi fi else # Timeout - auto-remove - echo -e "\n${YW}No response - auto-removing container${CL}" + echo "" + if declare -f msg_info >/dev/null 2>&1; then + msg_info "No response - removing container ${CTID}" + else + echo -e "${YW}No response - removing container ${CTID}${CL}" + fi pct stop "$CTID" &>/dev/null || true pct destroy "$CTID" &>/dev/null || true - echo -e "${GN}✔${CL} Container ${CTID} removed" + if declare -f msg_ok >/dev/null 2>&1; then + msg_ok "Container ${CTID} removed" + else + echo -e "${GN}✔${CL} Container ${CTID} removed" + fi fi # Force one final status update attempt after cleanup diff --git a/misc/vm-core.func b/misc/vm-core.func index 125b16125..557b99a46 100644 --- a/misc/vm-core.func +++ b/misc/vm-core.func @@ -207,15 +207,9 @@ silent() { msg_custom "→" "${YWB}" "${cmd}" if [[ -s "$logfile" ]]; then - local log_lines=$(wc -l <"$logfile") - echo "--- Last 10 lines of log ---" + echo -e "\n${TAB}--- Last 10 lines of log ---" tail -n 10 "$logfile" - echo "----------------------------" - - # Show how to view full log if there are more lines - if [[ $log_lines -gt 10 ]]; then - msg_custom "📋" "${YW}" "View full log (${log_lines} lines): ${logfile}" - fi + echo -e "${TAB}----------------------------\n" fi exit "$rc"