fix validate the sensors -j output before proceeding

This commit is contained in:
Meliox 2026-06-09 23:17:14 +02:00
parent 4c1a9486f1
commit 944d87bb8d

View File

@ -120,12 +120,26 @@ configure_node_info() {
fi fi
if [[ "$lm_sensors_ok" == true ]]; then if [[ "$lm_sensors_ok" == true ]]; then
local sensorsOutput sanitisedSensorsOutput local sensorsOutput
if [[ "$DEBUG_LM_SENSORS" -eq 1 ]]; then if [[ "$DEBUG_LM_SENSORS" -eq 1 ]]; then
sensorsOutput=$(cat "$DEBUG_LM_SENSORS_FILE") sensorsOutput=$(cat "$DEBUG_LM_SENSORS_FILE")
else else
sensorsOutput=$(sensors -j 2>/dev/null) sensorsOutput=$(sensors -j 2>/dev/null)
fi fi
local trimmedSensorsOutput
trimmedSensorsOutput=$(echo "$sensorsOutput" | tr -d '[:space:]')
if [[ -z "$trimmedSensorsOutput" || "$trimmedSensorsOutput" == "{}" ]]; then
warn "lm-sensors is installed but reported no sensors."
warn "No kernel sensor drivers appear to be loaded."
warn "Run 'sensors-detect' and load the suggested modules, then re-run this configurator."
lm_sensors_ok=false
LM_SENSORS_ENABLED=0
fi
fi
if [[ "$lm_sensors_ok" == true ]]; then
local sanitisedSensorsOutput
sanitisedSensorsOutput=$(sanitize_sensors_output "$sensorsOutput") sanitisedSensorsOutput=$(sanitize_sensors_output "$sensorsOutput")
#region CPU #region CPU