Fix incomplete partial merge

This commit is contained in:
rmm 2024-04-25 17:30:19 +02:00
parent 807e977809
commit bfee536031

View File

@ -79,17 +79,17 @@ function install_packages {
} }
function configure { function configure {
local sensorOutput=$(sensors -j) local sensorsOutput=$(sensors -j)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
err "Sensor output error.\n\nCommand output:\n${sensorOutput}\n\nExiting...\n" err "Sensor output error.\n\nCommand output:\n${sensorsOutput}\n\nExiting...\n"
fi fi
# Check if HDD/SSD data is installed # Check if HDD/SSD data is installed
msg "\nDetecting support for HDD/SDD temperature sensors..." msg "\nDetecting support for HDD/SDD temperature sensors..."
if (lsmod | grep -wq "drivetemp"); then if (lsmod | grep -wq "drivetemp"); then
# Check if SDD/HDD data is available # Check if SDD/HDD data is available
if (echo "$sensorOutput" | grep -q "drivetemp-scsi-" ); then if (echo "$sensorsOutput" | grep -q "drivetemp-scsi-" ); then
msg "Detected sensors:\n$(echo "$sensorOutput" | grep -o '"drivetemp-scsi[^"]*"' | sed 's/"//g')" msg "Detected sensors:\n$(echo "$sensorsOutput" | grep -o '"drivetemp-scsi[^"]*"' | sed 's/"//g')"
enableHddTemp=true enableHddTemp=true
else else
warn "Kernel module \"drivetemp\" is not installed. HDD/SDD temperatures will not be available." warn "Kernel module \"drivetemp\" is not installed. HDD/SDD temperatures will not be available."
@ -101,8 +101,8 @@ function configure {
# Check if NVMe data is available # Check if NVMe data is available
msg "\nDetecting support for NVMe temperature sensors..." msg "\nDetecting support for NVMe temperature sensors..."
if (echo "$sensorOutput" | grep -q "nvme-" ); then if (echo "$sensorsOutput" | grep -q "nvme-" ); then
msg "Detected sensors:\n$(echo "$sensorOutput" | grep -o '"nvme[^"]*"' | sed 's/"//g')" msg "Detected sensors:\n$(echo "$sensorsOutput" | grep -o '"nvme[^"]*"' | sed 's/"//g')"
enableNvmeTemp=true enableNvmeTemp=true
else else
warn "No NVMe temperature sensors found." warn "No NVMe temperature sensors found."
@ -112,16 +112,16 @@ function configure {
# Check if CPU is part of known list for autoconfiguration # Check if CPU is part of known list for autoconfiguration
msg "\nDetecting support for CPU temperature sensors..." msg "\nDetecting support for CPU temperature sensors..."
for item in "${KNOWN_CPU_SENSORS[@]}"; do for item in "${KNOWN_CPU_SENSORS[@]}"; do
if (echo "$sensorOutput" | grep -q "$item"); then if (echo "$sensorsOutput" | grep -q "$item"); then
case "$item" in case "$item" in
"coretemp-"*) "coretemp-"*)
CPU_ADDRESS="$(echo "$sensorOutput" | grep "$item" | sed 's/"//g;s/:{//;s/^\s*//')" CPU_ADDRESS="$(echo "$sensorsOutput" | grep "$item" | sed 's/"//g;s/:{//;s/^\s*//')"
CPU_ITEM_PREFIX="Core " CPU_ITEM_PREFIX="Core "
CPU_TEMP_CAPTION="Core" CPU_TEMP_CAPTION="Core"
break break
;; ;;
"k10temp-"*) "k10temp-"*)
CPU_ADDRESS="$(echo "$sensorOutput" | grep "$item" | sed 's/"//g;s/:{//;s/^\s*//')" CPU_ADDRESS="$(echo "$sensorsOutput" | grep "$item" | sed 's/"//g;s/:{//;s/^\s*//')"
CPU_ITEM_PREFIX="Tccd" CPU_ITEM_PREFIX="Tccd"
CPU_TEMP_CAPTION="Temp" CPU_TEMP_CAPTION="Temp"
break break
@ -145,7 +145,7 @@ function configure {
read -rsp $'Sensor output will be presented. Press any key to continue...\n' -n1 key read -rsp $'Sensor output will be presented. Press any key to continue...\n' -n1 key
# Print the output to the user # Print the output to the user
msg "Sensor output:\n${sensorOutput}" msg "Sensor output:\n${sensorsOutput}"
# Prompt the user for adapter name and item name # Prompt the user for adapter name and item name
read -p "Enter the CPU sensor address (e.g.: coretemp-isa-0000 or k10temp-pci-00c3): " CPU_ADDRESS read -p "Enter the CPU sensor address (e.g.: coretemp-isa-0000 or k10temp-pci-00c3): " CPU_ADDRESS
@ -158,9 +158,9 @@ function configure {
fi fi
# Look for fan speeds # Look for fan speeds
msg "\nDetecting support for Fan speeds..." msg "\nDetecting support for fan speeds..."
if (echo "$sensorOutput" | grep -q "fan[0-9]*_input" ); then if (echo "$sensorsOutput" | grep -q "fan[0-9]*_input" ); then
msg "Fan speeds detected:\n$(echo "$sensorOutput" | grep -o 'fan[0-9]*_input[^"]*')" msg "Fan speeds detected:\n$(echo "$sensorsOutput" | grep -o 'fan[0-9]*_input[^"]*')"
enableFanSpeed=true enableFanSpeed=true
else else
warn "No Fan speeds found." warn "No Fan speeds found."
@ -379,12 +379,12 @@ function install_mod {
html: gettext('Fan Speed(s)'), html: gettext('Fan Speed(s)'),
}, },
{ {
itemId: 'FanSpeed', itemId: 'speedFan',
colspan: 2, colspan: 2,
printBar: false, printBar: false,
title: gettext(' '), title: gettext(' '),
iconCls: 'fa fa-fw fa-solid fa-fan', iconCls: 'fa fa-fw fa-solid fa-fan',
textField: 'thermalstate', textField: 'sensorsOutput',
renderer: function(value){ renderer: function(value){
const objValue = JSON.parse(value); const objValue = JSON.parse(value);
@ -419,12 +419,12 @@ function install_mod {
# Add an empty line to separate modified items as a visual group # Add an empty line to separate modified items as a visual group
# NOTE: Check for the presence of items in the reverse order of display # NOTE: Check for the presence of items in the reverse order of display
local lastItemId="" local lastItemId=""
if [ $enableFanSpeed = true ]; then if [ $enableHddTemp = true ]; then
lastItemId="FanSpeed"
elif [ $enableHddTemp = true ]; then
lastItemId="thermalHdd" lastItemId="thermalHdd"
elif [ $enableNvmeTemp = true ]; then elif [ $enableNvmeTemp = true ]; then
lastItemId="thermalNvme" lastItemId="thermalNvme"
elif [ $enableFanSpeed = true ]; then
lastItemId="speedFan"
else else
lastItemId="thermalCpu" lastItemId="thermalCpu"
fi fi