update
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
action="${1:-}"
|
||||
FOLDER='/opt/idssys/ta-proxmenu'
|
||||
VERS='2026.7.28-9'
|
||||
VERS='2026.7.28-10'
|
||||
|
||||
noupdate=' '
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
# Cached local host details displayed by the interactive menu header.
|
||||
|
||||
TAPM_HEADER_INFO_LOADED=0
|
||||
TAPM_HEADER_PVE_VERSION='Unavailable'
|
||||
TAPM_HEADER_CLUSTER='Standalone'
|
||||
|
||||
TAPM_LOAD_HEADER_INFO() {
|
||||
local pve_output=''
|
||||
local first_line=''
|
||||
local cluster_config="${1:-/etc/pve/corosync.conf}"
|
||||
local cluster_name=''
|
||||
local line=''
|
||||
|
||||
(( TAPM_HEADER_INFO_LOADED == 0 )) || return 0
|
||||
TAPM_HEADER_INFO_LOADED=1
|
||||
|
||||
if command -v pveversion >/dev/null 2>&1; then
|
||||
pve_output="$(pveversion 2>/dev/null || true)"
|
||||
first_line="${pve_output%%$'\n'*}"
|
||||
if [[ "$first_line" =~ ^pve-manager/([^/[:space:]]+) ]]; then
|
||||
TAPM_HEADER_PVE_VERSION="${BASH_REMATCH[1]}"
|
||||
elif [[ -n "$first_line" ]]; then
|
||||
TAPM_HEADER_PVE_VERSION="${first_line%%[[:space:]]*}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -r "$cluster_config" ]]; then
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" =~ ^[[:space:]]*cluster_name:[[:space:]]*([^[:space:]#]+) ]]; then
|
||||
cluster_name="${BASH_REMATCH[1]}"
|
||||
break
|
||||
fi
|
||||
done <"$cluster_config"
|
||||
TAPM_HEADER_CLUSTER="${cluster_name:-Clustered}"
|
||||
fi
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
source /opt/idssys/ta-proxmenu/defaults.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/git-update.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/ha-status.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/header-info.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/post-install.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/rmm.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/secure-input.inc
|
||||
@@ -1687,6 +1688,8 @@ MENU_HEADER() {
|
||||
local right_width
|
||||
local spacer_width
|
||||
|
||||
TAPM_LOAD_HEADER_INFO
|
||||
|
||||
# Reuse a settled update result instead of running Git checks on every
|
||||
# arrow-key redraw. Continue refreshing only while the worker is pending.
|
||||
if [[ "$UPDATE_STATUS" == 'unknown' || "$UPDATE_STATUS" == 'checking' ]]; then
|
||||
@@ -1738,6 +1741,7 @@ MENU_HEADER() {
|
||||
echo -e "${idsCL[Green]}---------------------------------------------------------------------------${idsCL[Default]}"
|
||||
echo -e " Hostname: ${idsCL[Cyan]}$(hostname -s)${idsCL[Default]}"
|
||||
echo -e " IP Address: ${idsCL[Cyan]}${RNIP:-Unavailable}${idsCL[Default]}"
|
||||
echo -e " Proxmox VE: ${idsCL[Cyan]}${TAPM_HEADER_PVE_VERSION}${idsCL[Default]} Cluster: ${idsCL[Cyan]}${TAPM_HEADER_CLUSTER}${idsCL[Default]}"
|
||||
echo -e "${idsCL[Green]}---------------------------------------------------------------------------${idsCL[Default]}"
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
set -u -o pipefail
|
||||
|
||||
TEST_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
test_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "$test_dir"' EXIT
|
||||
|
||||
source "${TEST_ROOT}/tests/testlib.sh"
|
||||
source "${TEST_ROOT}/inc/header-info.inc"
|
||||
|
||||
pveversion() {
|
||||
printf '%s\n' 'pve-manager/9.2.4/5e5ae681198514d4 (running kernel: 7.0.14-5-pve)'
|
||||
}
|
||||
|
||||
cat >"${test_dir}/corosync.conf" <<'EOF'
|
||||
totem {
|
||||
version: 2
|
||||
cluster_name: production-cluster
|
||||
}
|
||||
EOF
|
||||
|
||||
TAPM_LOAD_HEADER_INFO "${test_dir}/corosync.conf"
|
||||
assert_equal '9.2.4' "$TAPM_HEADER_PVE_VERSION" \
|
||||
"header extracts the concise Proxmox VE version"
|
||||
assert_equal 'production-cluster' "$TAPM_HEADER_CLUSTER" \
|
||||
"header reads the local cluster name"
|
||||
|
||||
pveversion() {
|
||||
printf '%s\n' 'pve-manager/10.0.0/changed'
|
||||
}
|
||||
TAPM_LOAD_HEADER_INFO "${test_dir}/corosync.conf"
|
||||
assert_equal '9.2.4' "$TAPM_HEADER_PVE_VERSION" \
|
||||
"header information is cached between menu redraws"
|
||||
|
||||
TAPM_HEADER_INFO_LOADED=0
|
||||
TAPM_HEADER_PVE_VERSION='Unavailable'
|
||||
TAPM_HEADER_CLUSTER='Standalone'
|
||||
TAPM_LOAD_HEADER_INFO "${test_dir}/missing.conf"
|
||||
assert_equal '10.0.0' "$TAPM_HEADER_PVE_VERSION" \
|
||||
"header refresh reads the current Proxmox VE version"
|
||||
assert_equal 'Standalone' "$TAPM_HEADER_CLUSTER" \
|
||||
"host without corosync configuration is shown as standalone"
|
||||
|
||||
finish_tests
|
||||
Reference in New Issue
Block a user