* Fixed to render correctly even if INTEL and AMD core nodes are mixed in the cluster.
* Fixed the behavior of forcing configuration before being told "Mod is already installed". * Add motherboard information as an option in System Information settings.
This commit is contained in:
parent
81a3808a01
commit
372ba99826
@ -271,12 +271,25 @@ function configure {
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local choiceEnableSystemInfo=$(ask "Do you wish to enable system information? (Y/n)")
|
# DMI Type:
|
||||||
|
# 1 ... System Information
|
||||||
|
# 2 ... Base Board Information (for self-made PC)
|
||||||
|
for i in 1 2; do
|
||||||
|
echo "type ${i})"
|
||||||
|
dmidecode -t ${i} | awk -F': ' '/Manufacturer|Product Name|Serial Number/ {print $1": "$2}'
|
||||||
|
done
|
||||||
|
local choiceEnableSystemInfo=$(ask "Do you wish to enable system information? (1/2/n)")
|
||||||
case "$choiceEnableSystemInfo" in
|
case "$choiceEnableSystemInfo" in
|
||||||
[yY] | "")
|
[1] | "")
|
||||||
ENABLE_SYSTEM_INFO=true
|
ENABLE_SYSTEM_INFO=true
|
||||||
|
SYSTEM_INFO_TYPE=1
|
||||||
info "System information will be displayed..."
|
info "System information will be displayed..."
|
||||||
;;
|
;;
|
||||||
|
[2])
|
||||||
|
ENABLE_SYSTEM_INFO=true
|
||||||
|
SYSTEM_INFO_TYPE=2
|
||||||
|
info "Motherboard information will be displayed..."
|
||||||
|
;;
|
||||||
[nN])
|
[nN])
|
||||||
ENABLE_SYSTEM_INFO=false
|
ENABLE_SYSTEM_INFO=false
|
||||||
info "System information will NOT be displayed..."
|
info "System information will NOT be displayed..."
|
||||||
@ -291,6 +304,11 @@ function configure {
|
|||||||
|
|
||||||
# Function to install the modification
|
# Function to install the modification
|
||||||
function install_mod {
|
function install_mod {
|
||||||
|
if [[ -n $(cat $NODES_PM_FILE | grep -e "$res->{sensorsOutput}") ]] && [[ -n $(cat $NODES_PM_FILE | grep -e "$res->{systemInfo}") ]]; then
|
||||||
|
err "Mod is already installed. Uninstall existing before installing."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
msg "\nPreparing mod installation..."
|
msg "\nPreparing mod installation..."
|
||||||
|
|
||||||
# Provide sensor configuration
|
# Provide sensor configuration
|
||||||
@ -302,18 +320,13 @@ function install_mod {
|
|||||||
local timestamp=$(date '+%Y-%m-%d_%H-%M-%S')
|
local timestamp=$(date '+%Y-%m-%d_%H-%M-%S')
|
||||||
|
|
||||||
# Perform backup
|
# Perform backup
|
||||||
if [[ -z $(cat $NODES_PM_FILE | grep -e "$res->{sensorsOutput}") ]] || [[ -z $(cat $NODES_PM_FILE | grep -e "$res->{systemInfo}") ]]; then
|
# Create backup of original file
|
||||||
# Create backup of original file
|
cp "$NODES_PM_FILE" "$BACKUP_DIR/Nodes.pm.$timestamp"
|
||||||
cp "$NODES_PM_FILE" "$BACKUP_DIR/Nodes.pm.$timestamp"
|
msg "Backup of \"$NODES_PM_FILE\" saved to \"$BACKUP_DIR/Nodes.pm.$timestamp\"."
|
||||||
msg "Backup of \"$NODES_PM_FILE\" saved to \"$BACKUP_DIR/Nodes.pm.$timestamp\"."
|
|
||||||
|
|
||||||
# Create backup of original file
|
# Create backup of original file
|
||||||
cp "$PVE_MANAGER_LIB_JS_FILE" "$BACKUP_DIR/pvemanagerlib.js.$timestamp"
|
cp "$PVE_MANAGER_LIB_JS_FILE" "$BACKUP_DIR/pvemanagerlib.js.$timestamp"
|
||||||
msg "Backup of \"$PVE_MANAGER_LIB_JS_FILE\" saved to \"$BACKUP_DIR/pvemanagerlib.js.$timestamp\"."
|
msg "Backup of \"$PVE_MANAGER_LIB_JS_FILE\" saved to \"$BACKUP_DIR/pvemanagerlib.js.$timestamp\"."
|
||||||
else
|
|
||||||
err "Mod is already installed. Uninstall existing before installing."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $SENSORS_DETECTED = true ]; then
|
if [ $SENSORS_DETECTED = true ]; then
|
||||||
local sensorsCmd
|
local sensorsCmd
|
||||||
@ -329,7 +342,7 @@ function install_mod {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $ENABLE_SYSTEM_INFO = true ]; then
|
if [ $ENABLE_SYSTEM_INFO = true ]; then
|
||||||
local systemInfoCmd=$(dmidecode -t 1 | awk -F': ' '/Manufacturer|Product Name|Serial Number/ {print $1": "$2}' | awk '{$1=$1};1' | sed 's/$/ |/' | paste -sd " " - | sed 's/ |$//')
|
local systemInfoCmd=$(dmidecode -t ${SYSTEM_INFO_TYPE} | awk -F': ' '/Manufacturer|Product Name|Serial Number/ {print $1": "$2}' | awk '{$1=$1};1' | sed 's/$/ |/' | paste -sd " " - | sed 's/ |$//')
|
||||||
sed -i "/my \$dinfo = df('\/', 1);/i\\\t\$res->{systemInfo} = \"$(echo "$systemInfoCmd")\";\n" "$NODES_PM_FILE"
|
sed -i "/my \$dinfo = df('\/', 1);/i\\\t\$res->{systemInfo} = \"$(echo "$systemInfoCmd")\";\n" "$NODES_PM_FILE"
|
||||||
msg "System information output added to \"$NODES_PM_FILE\"."
|
msg "System information output added to \"$NODES_PM_FILE\"."
|
||||||
fi
|
fi
|
||||||
@ -470,9 +483,6 @@ Ext.define('PVE.mod.TempHelper', {\n\
|
|||||||
textField: 'sensorsOutput',\n\
|
textField: 'sensorsOutput',\n\
|
||||||
renderer: function(value){\n\
|
renderer: function(value){\n\
|
||||||
// sensors configuration\n\
|
// sensors configuration\n\
|
||||||
const addressPrefix = \"$CPU_ADDRESS_PREFIX\";\n\
|
|
||||||
const cpuItemPrefix = \"$CPU_ITEM_PREFIX\";\n\
|
|
||||||
const cpuTempCaption = \"$CPU_TEMP_CAPTION\";\n\
|
|
||||||
const cpuTempHelper = Ext.create('PVE.mod.TempHelper', $tempHelperCtorParams);\n\
|
const cpuTempHelper = Ext.create('PVE.mod.TempHelper', $tempHelperCtorParams);\n\
|
||||||
// display configuration\n\
|
// display configuration\n\
|
||||||
const itemsPerRow = $CPU_ITEMS_PER_ROW;\n\
|
const itemsPerRow = $CPU_ITEMS_PER_ROW;\n\
|
||||||
@ -483,7 +493,33 @@ Ext.define('PVE.mod.TempHelper', {\n\
|
|||||||
} catch(e) {\n\
|
} catch(e) {\n\
|
||||||
objValue = {};\n\
|
objValue = {};\n\
|
||||||
}\n\
|
}\n\
|
||||||
const cpuKeys = Object.keys(objValue).filter(item => String(item).startsWith(addressPrefix)).sort();\n\
|
const cpuKeysI = Object.keys(objValue).filter(item => String(item).startsWith('coretemp-isa-')).sort();\n\
|
||||||
|
const cpuKeysA = Object.keys(objValue).filter(item => String(item).startsWith('k10temp-pci-')).sort();\n\
|
||||||
|
const bINTEL = cpuKeysI.length > 0 ? true : false;\n\
|
||||||
|
const INTELPackagePrefix = '$CPU_TEMP_CAPTION' == 'Core' ? 'Core ' : 'Package id';\n\
|
||||||
|
const INTELPackageCaption = '$CPU_TEMP_CAPTION' == 'Core' ? 'Core' : 'Package';\n\
|
||||||
|
let AMDPackagePrefix = 'Tccd';\n\
|
||||||
|
let AMDPackageCaption = 'Chiplet';\n\
|
||||||
|
if (cpuKeysA.length > 0) {\n\
|
||||||
|
const items = objValue[cpuKeysA[0]];\n\
|
||||||
|
const bTccd = Object.keys(items).findIndex(item => { return String(item).startsWith('Tccd'); }) >= 0 ? true : false;\n\
|
||||||
|
const bTctl = Object.keys(items).findIndex(item => { return String(item).startsWith('Tctl'); }) >= 0 ? true : false;\n\
|
||||||
|
const bTemp = Object.keys(items).findIndex(item => { return String(item).startsWith('temp1'); }) >= 0 ? true : false;\n\
|
||||||
|
if (bTccd && bTctl) {\n\
|
||||||
|
AMDPackagePrefix = 'Tccd';\n\
|
||||||
|
AMDPackageCaption = 'Chiplet';\n\
|
||||||
|
} else if (bTctl) {\n\
|
||||||
|
AMDPackagePrefix = 'Tctl';\n\
|
||||||
|
AMDPackageCaption = 'Temp';\n\
|
||||||
|
} else {\n\
|
||||||
|
AMDPackagePrefix = 'temp';\n\
|
||||||
|
AMDPackageCaption = 'Temp';\n\
|
||||||
|
}\n\
|
||||||
|
}\n\
|
||||||
|
const cpuKeys = bINTEL ? cpuKeysI : cpuKeysA;\n\
|
||||||
|
const cpuItemPrefix = bINTEL ? INTELPackagePrefix : AMDPackagePrefix;\n\
|
||||||
|
const cpuTempCaption = bINTEL ? INTELPackageCaption : 'Temp';\n\
|
||||||
|
const formatTemp = bINTEL ? '0' : '0.0';\n\
|
||||||
const cpuCount = cpuKeys.length;\n\
|
const cpuCount = cpuKeys.length;\n\
|
||||||
let temps = [];\n\
|
let temps = [];\n\
|
||||||
cpuKeys.forEach((cpuKey, cpuIndex) => {\n\
|
cpuKeys.forEach((cpuKey, cpuIndex) => {\n\
|
||||||
@ -514,9 +550,9 @@ Ext.define('PVE.mod.TempHelper', {\n\
|
|||||||
let tempIndex = coreKey.match(/\\\S+\\\s*(\\\d+)/);\n\
|
let tempIndex = coreKey.match(/\\\S+\\\s*(\\\d+)/);\n\
|
||||||
if (tempIndex !== null && tempIndex.length > 1) {\n\
|
if (tempIndex !== null && tempIndex.length > 1) {\n\
|
||||||
tempIndex = tempIndex[1];\n\
|
tempIndex = tempIndex[1];\n\
|
||||||
tempStr = \`\${cpuTempCaption} \${tempIndex}: <span style=\"\${tempStyle}\">\${Ext.util.Format.number(tempVal, '0.#')}\${cpuTempHelper.getUnit()}</span>\`;\n\
|
tempStr = \`\${cpuTempCaption} \${tempIndex}: <span style=\"\${tempStyle}\">\${Ext.util.Format.number(tempVal, formatTemp)}\${cpuTempHelper.getUnit()}</span>\`;\n\
|
||||||
} else {\n\
|
} else {\n\
|
||||||
tempStr = \`\${cpuTempCaption}: \${Ext.util.Format.number(tempVal, '0.#')}\${cpuTempHelper.getUnit()}\`;\n\
|
tempStr = \`\${cpuTempCaption}: \${Ext.util.Format.number(tempVal, formatTemp)}\${cpuTempHelper.getUnit()}\`;\n\
|
||||||
}\n\
|
}\n\
|
||||||
cpuTemps.push(tempStr);\n\
|
cpuTemps.push(tempStr);\n\
|
||||||
}\n\
|
}\n\
|
||||||
@ -592,7 +628,7 @@ Ext.define('PVE.mod.TempHelper', {\n\
|
|||||||
if (!isNaN(tempCrit) && tempVal >= tempCrit) {\n\
|
if (!isNaN(tempCrit) && tempVal >= tempCrit) {\n\
|
||||||
tempStyle = 'color: red; font-weight: bold;';\n\
|
tempStyle = 'color: red; font-weight: bold;';\n\
|
||||||
}\n\
|
}\n\
|
||||||
const tempStr = \`Drive \${index + 1}: <span style=\"\${tempStyle}\">\${Ext.util.Format.number(tempVal, '0.#')}\${tempHelper.getUnit()}</span>\`;\n\
|
const tempStr = \`Drive \${index + 1}: <span style=\"\${tempStyle}\">\${Ext.util.Format.number(tempVal, '0.0')}\${tempHelper.getUnit()}</span>\`;\n\
|
||||||
temps.push(tempStr);\n\
|
temps.push(tempStr);\n\
|
||||||
}\n\
|
}\n\
|
||||||
} catch(e) { /*_*/ }\n\
|
} catch(e) { /*_*/ }\n\
|
||||||
@ -655,7 +691,7 @@ Ext.define('PVE.mod.TempHelper', {\n\
|
|||||||
if (!isNaN(tempCrit) && tempVal >= tempCrit) {\n\
|
if (!isNaN(tempCrit) && tempVal >= tempCrit) {\n\
|
||||||
tempStyle = 'color: red; font-weight: bold;';\n\
|
tempStyle = 'color: red; font-weight: bold;';\n\
|
||||||
}\n\
|
}\n\
|
||||||
const tempStr = \`Drive \${index + 1}: <span style=\"\${tempStyle}\">\${Ext.util.Format.number(tempVal, '0.#')}\${tempHelper.getUnit()}</span>\`;\n\
|
const tempStr = \`Drive \${index + 1}: <span style=\"\${tempStyle}\">\${Ext.util.Format.number(tempVal, '0.0')}\${tempHelper.getUnit()}</span>\`;\n\
|
||||||
temps.push(tempStr);\n\
|
temps.push(tempStr);\n\
|
||||||
}\n\
|
}\n\
|
||||||
} catch(e) { /*_*/ }\n\
|
} catch(e) { /*_*/ }\n\
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user