fix env export

This commit is contained in:
Meliox 2025-09-06 21:26:01 +02:00
parent 0632e1960f
commit 0eabae4f40

View File

@ -394,31 +394,42 @@ function install_mod {
# Expand space in StatusView # Expand space in StatusView
expand_statusview_space expand_statusview_space
read -p "Press [Enter] key to continue..."
# Insert temp helper # Insert temp helper
generate_and_insert_temp_helper generate_and_insert_temp_helper
read -p "Press [Enter] key to continue..."
# Generate and insert widgets using the helper function # Generate and insert widgets using the helper function
generate_and_insert_widget "$ENABLE_SYSTEM_INFO" "generate_system_info" "system_info" generate_and_insert_widget "$ENABLE_SYSTEM_INFO" "generate_system_info" "system_info"
# pause wait for user to press enter
read -p "Press [Enter] key to continue..."
ENABLE_CPU=true ENABLE_CPU=true
generate_and_insert_widget "$ENABLE_CPU" "generate_cpu_widget" "cpu"
# #
# NOTE: The following items will be added in reverse order # NOTE: The following items will be added in reverse order
# #
generate_and_insert_widget "$ENABLE_UPS" "generate_ups_widget" "ups" generate_and_insert_widget "$ENABLE_UPS" "generate_ups_widget" "ups"
read -p "Press [Enter] key to continue..."
generate_and_insert_widget "$ENABLE_HDD_TEMP" "generate_hdd_widget" "hdd" generate_and_insert_widget "$ENABLE_HDD_TEMP" "generate_hdd_widget" "hdd"
read -p "Press [Enter] key to continue..."
generate_and_insert_widget "$ENABLE_NVME_TEMP" "generate_nvme_widget" "nvme" generate_and_insert_widget "$ENABLE_NVME_TEMP" "generate_nvme_widget" "nvme"
read -p "Press [Enter] key to continue..."
# Add drive header boxes if either nvme or drive temp is enabled # Add drive header boxes if either nvme or drive temp is enabled
generate_drive_header generate_drive_header
generate_and_insert_widget "$ENABLE_FAN_SPEED" "generate_fan_widget" "fan" generate_and_insert_widget "$ENABLE_FAN_SPEED" "generate_fan_widget" "fan"
generate_and_insert_widget "$ENABLE_RAM_TEMP" "generate_ram_widget" "ram" generate_and_insert_widget "$ENABLE_RAM_TEMP" "generate_ram_widget" "ram"
generate_and_insert_widget "$ENABLE_CPU" "generate_cpu_widget" "cpu"
# Add an empty line to separate modified items as a visual group # Add an empty line to separate modified items as a visual group
add_visual_separator #add_visual_separator
# Move the node summary box into its own container and deactivate the original box instance # Move the node summary box into its own container and deactivate the original box instance
setup_node_summary_container #setup_node_summary_container
msg "Sensor display items added to the summary panel in \"$PVE_MANAGER_LIB_JS_FILE\"." msg "Sensor display items added to the summary panel in \"$PVE_MANAGER_LIB_JS_FILE\"."
@ -441,8 +452,8 @@ insert_widget_after_thermal() {
:a :a
/items:/!{N;ba;} /items:/!{N;ba;}
:b :b
/'thermal.*},/!{N;bb;} /'cpus.*},/!{N;bb;}
cat $widget_file r $widget_file
}" "$PVE_MANAGER_LIB_JS_FILE" }" "$PVE_MANAGER_LIB_JS_FILE"
} }
@ -731,7 +742,7 @@ generate_cpu_widget() {
export CPU_TEMP_TARGET export CPU_TEMP_TARGET
export HELPERCTORPARAMS export HELPERCTORPARAMS
cat <<'EOF' | envsubst > "$1" cat <<'EOF' | envsubst '$CPU_ITEMS_PER_ROW $CPU_TEMP_TARGET $HELPERCTORPARAMS' > "$1"
{ {
itemId: 'thermalCpu', itemId: 'thermalCpu',
colspan: 2, colspan: 2,
@ -860,7 +871,8 @@ generate_nvme_widget() {
# use subshell to allow variable expansion # use subshell to allow variable expansion
( (
export HELPERCTORPARAMS export HELPERCTORPARAMS
cat <<'EOF' | envsubst > "$1" export NVME_ITEMS_PER_ROW
cat <<'EOF' | envsubst '$HELPERCTORPARAMS $NVME_ITEMS_PER_ROW' > "$1"
{ {
itemId: 'thermalNvme', itemId: 'thermalNvme',
colspan: 2, colspan: 2,
@ -874,7 +886,7 @@ generate_nvme_widget() {
const sensorName = "Composite"; const sensorName = "Composite";
const tempHelper = Ext.create('PVE.mod.TempHelper', $HELPERCTORPARAMS); const tempHelper = Ext.create('PVE.mod.TempHelper', $HELPERCTORPARAMS);
// display configuration // display configuration
const itemsPerRow = ${NVME_ITEMS_PER_ROW}; const itemsPerRow = $NVME_ITEMS_PER_ROW;
// --- // ---
let objValue; let objValue;
try { try {
@ -925,7 +937,10 @@ EOF
# Function to generate UPS widget # Function to generate UPS widget
generate_fan_widget() { generate_fan_widget() {
#region fan widget heredoc #region fan widget heredoc
cat > "$1" <<'EOF' # use subshell to allow variable expansion
(
export DISPLAY_ZERO_SPEED_FANS
cat <<'EOF' | envsubst '$DISPLAY_ZERO_SPEED_FANS' > "$1"
{ {
xtype: 'box', xtype: 'box',
colspan: 2, colspan: 2,
@ -989,6 +1004,7 @@ generate_fan_widget() {
} }
}, },
EOF EOF
)
#endregion fan widget heredoc #endregion fan widget heredoc
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "Error: Failed to generate fan widget code" >&2 echo "Error: Failed to generate fan widget code" >&2
@ -1002,7 +1018,7 @@ generate_hdd_widget() {
# use subshell to allow variable expansion # use subshell to allow variable expansion
( (
export HELPERCTORPARAMS export HELPERCTORPARAMS
cat <<'EOF' | envsubst > "$1" cat <<'EOF' | envsubst '$HELPERCTORPARAMS' > "$1"
{ {
itemId: 'thermalHdd', itemId: 'thermalHdd',
colspan: 2, colspan: 2,
@ -1070,8 +1086,7 @@ generate_ram_widget() {
# use subshell to allow variable expansion # use subshell to allow variable expansion
( (
export HELPERCTORPARAMS export HELPERCTORPARAMS
cat <<'EOF' | envsubst > "$1" cat <<'EOF' | envsubst '$HELPERCTORPARAMS' > "$1"
{
{ {
xtype: 'box', xtype: 'box',
colspan: 2, colspan: 2,