From b0be17dd369816ad9294648984127dd36969059b Mon Sep 17 00:00:00 2001 From: JoshuaVlantis Date: Thu, 14 May 2026 12:17:53 +0200 Subject: [PATCH] fix(deps): dedupe packages mapped from multiple commands The dependency map sends gcc/g++/make all to build-essential and wrestool/icotool both to icoutils. The previous loop appended once per missing command, so a clean machine printed: System dependencies needed: p7zip-full wget icoutils icoutils imagemagick build-essential build-essential build-essential python3 apt dedupes internally so the install worked, but the log line read as if the script was broken. Skip the append when the package is already in deps_to_install; the bordered substring match handles both build-essential and icoutils with a single rule. Verified in a clean debian:stable-slim container with no build tools present: build-essential and icoutils now appear exactly once in each invocation. Addresses review feedback on #401. --- scripts/setup/dependencies.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/setup/dependencies.sh b/scripts/setup/dependencies.sh index ccdda8e..b6106ed 100644 --- a/scripts/setup/dependencies.sh +++ b/scripts/setup/dependencies.sh @@ -48,20 +48,25 @@ check_dependencies() { [make]='make' [python3]='python3' ) - local cmd + local cmd pkg for cmd in $all_deps; do if ! check_command "$cmd"; then case "$distro_family" in - debian) - deps_to_install="$deps_to_install ${debian_pkgs[$cmd]}" - ;; - rpm) - deps_to_install="$deps_to_install ${rpm_pkgs[$cmd]}" - ;; + debian) pkg="${debian_pkgs[$cmd]}" ;; + rpm) pkg="${rpm_pkgs[$cmd]}" ;; *) echo "Warning: Cannot auto-install '$cmd' on unknown distro. Please install manually." >&2 + continue ;; esac + # Several commands map to the same package (gcc/g++/make + # -> build-essential, wrestool/icotool -> icoutils). Skip + # if the package is already queued so the log line stays + # readable. + case " $deps_to_install " in + *" $pkg "*) ;; + *) deps_to_install="$deps_to_install $pkg" ;; + esac fi done