From d1dd9e18e4fbc898e6d4582f4d48a9690eb6791d Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Mon, 24 Aug 2026 13:45:15 +0200 Subject: [PATCH] post-pve/pbs-install: fix component_exists_in_sources matching substrings of hyphenated tokens (#16709) * post-pve-install: fix component_exists_in_sources matching substrings of hyphenated tokens * post-pbs-install: fix component_exists_in_sources matching substrings of hyphenated tokens --- tools/pve/post-pbs-install.sh | 9 ++++++++- tools/pve/post-pve-install.sh | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/pve/post-pbs-install.sh b/tools/pve/post-pbs-install.sh index 9c4af7664..1dbee5102 100644 --- a/tools/pve/post-pbs-install.sh +++ b/tools/pve/post-pbs-install.sh @@ -62,7 +62,14 @@ repo_state_list() { component_exists_in_sources() { local component="$1" - grep -h -E "^[^#]*Components:[^#]*\b${component}\b" /etc/apt/sources.list.d/*.sources 2>/dev/null | grep -q . + local line comp + while IFS= read -r line; do + line="${line#*Components:}" + for comp in $line; do + [[ "$comp" == "$component" ]] && return 0 + done + done < <(grep -h -E "^[^#]*Components:" /etc/apt/sources.list.d/*.sources 2>/dev/null) + return 1 } require_whiptail() { diff --git a/tools/pve/post-pve-install.sh b/tools/pve/post-pve-install.sh index bb7469155..335d132d4 100644 --- a/tools/pve/post-pve-install.sh +++ b/tools/pve/post-pve-install.sh @@ -63,7 +63,14 @@ get_pve_major_minor() { component_exists_in_sources() { local component="$1" - grep -h -E "^[^#]*Components:[^#]*\b${component}\b" /etc/apt/sources.list.d/*.sources 2>/dev/null | grep -q . + local line comp + while IFS= read -r line; do + line="${line#*Components:}" + for comp in $line; do + [[ "$comp" == "$component" ]] && return 0 + done + done < <(grep -h -E "^[^#]*Components:" /etc/apt/sources.list.d/*.sources 2>/dev/null) + return 1 } main() {