From 606eefd71debfca121c7445f5ba9cd39ca81879b Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 20 Oct 2025 11:29:14 +0200 Subject: [PATCH] Update tools.func --- misc/tools.func | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/misc/tools.func b/misc/tools.func index 13860ec3..acc99ef8 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -554,13 +554,21 @@ cleanup_orphaned_sources() { [[ ! -d "$sources_dir" ]] && return 0 while IFS= read -r -d '' sources_file; do + local basename_file + basename_file=$(basename "$sources_file") + + # NEVER remove debian.sources - this is the standard Debian repository + if [[ "$basename_file" == "debian.sources" ]]; then + continue + fi + # Extract Signed-By path from .sources file local keyring_path keyring_path=$(grep -E '^Signed-By:' "$sources_file" 2>/dev/null | awk '{print $2}') # If keyring doesn't exist, remove the .sources file if [[ -n "$keyring_path" ]] && [[ ! -f "$keyring_path" ]]; then - msg_warn "Removing orphaned sources file: $(basename "$sources_file") (missing keyring: $(basename "$keyring_path"))" + msg_warn "Removing orphaned sources file: $basename_file (missing keyring: $(basename "$keyring_path"))" rm -f "$sources_file" fi done < <(find "$sources_dir" -name "*.sources" -print0 2>/dev/null)