pve-mod-configure: fix validate the sensors -j output before proceeding (#188)

* fix validate the sensors -j output before proceeding

* fix return to satisfy set -e

* exit configure if lmsensors output is not valid

---------

Co-authored-by: Meliox <na>
This commit is contained in:
Meliox 2026-06-10 00:26:32 +02:00 committed by GitHub
parent 84f2f0766f
commit e1573369e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,12 +120,28 @@ 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) || true
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."
warn "lm-sensors output is the foundation for this mod. Mod cannot be enabled without it."
exit 0
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