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:
parent
84f2f0766f
commit
e1573369e8
@ -120,12 +120,28 @@ configure_node_info() {
|
||||
fi
|
||||
|
||||
if [[ "$lm_sensors_ok" == true ]]; then
|
||||
local sensorsOutput sanitisedSensorsOutput
|
||||
local sensorsOutput
|
||||
if [[ "$DEBUG_LM_SENSORS" -eq 1 ]]; then
|
||||
sensorsOutput=$(cat "$DEBUG_LM_SENSORS_FILE")
|
||||
else
|
||||
sensorsOutput=$(sensors -j 2>/dev/null)
|
||||
sensorsOutput=$(sensors -j 2>/dev/null) || true
|
||||
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")
|
||||
|
||||
#region CPU
|
||||
|
||||
Loading…
Reference in New Issue
Block a user