From 82b35e4bdb307a6be11e80732f27060387b0ed11 Mon Sep 17 00:00:00 2001 From: Pathfinder Date: Tue, 27 Oct 2026 22:58:01 +0100 Subject: [PATCH] Browsers: dnf5 addrepo for Brave; per-item installs in the menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs read straight out of YuKu's VM screenshot: 1. 'Unknown argument "add" for command "config-manager"' — dnf5 has no 'add' subcommand, so the Brave repo never landed and brave-browser had no match. Now uses 'config-manager addrepo --from-repofile=' per Brave's own Fedora 41+ docs; skips when /etc/yum.repos.d/brave-browser.repo exists. The .repo carries the gpgkey, so the rpm --import dance is gone. 2. 'Installation failed: chromium brave-browser' — multi-select put all picks in ONE dnf transaction, so brave's no-match killed chromium too. Picks now install PER ITEM: one failure red-warns with the item's own name and the remaining picks still install. --- setup.sh | 61 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/setup.sh b/setup.sh index ca8561a..721bdbb 100755 --- a/setup.sh +++ b/setup.sh @@ -442,38 +442,34 @@ run_advanced_menu() { sel=$(ui_choose_multi "$cat" "Install which? (multi-select, none = back):" "${labels[@]}") [[ -z "$sel" ]] && continue - # Map chosen labels back to their package lists. Word-split each - # package list into SEPARATE args: quoting it whole makes dnf look for - # one package named "qemu-kvm libvirt ..." (seen on the VM). - local -a to_install=() + # Resolve each picked label to its OWN package list, then install + # PER ITEM: one failing package used to kill the whole multi-select + # transaction (VM: brave's no-match took chromium down with it). + # Repo wiring inside install_category_pkgs runs per item; failures + # warn in red and the remaining picks still install. + local picked lbl it while IFS= read -r picked; do [[ -z "$picked" ]] && continue for entry in "${entries[@]}"; do rest="${entry#*:}" lbl="${rest%%:*}" - if [[ "$lbl" == "$picked" ]]; then - rest="${entry#*:}"; rest="${rest#*:}" # drop id and label - # shellcheck disable=SC2206 - to_install+=(${rest}) + [[ "$lbl" == "$picked" ]] || continue + rest="${rest#*:}" # drop id and label -> pkgs + # word-split: quoting $rest whole makes dnf look for one + # package named "qemu-kvm libvirt ..." (seen on the VM) + # shellcheck disable=SC2206 + local -a item_pkgs=(${rest}) + step "Installing from $cat: ${item_pkgs[*]}" + if install_category_pkgs "$cat" "${item_pkgs[@]}"; then + done_any=true + else + color_red " Installation failed: $lbl" + color_red " (dnf reported no match / transaction failure — see output above)" + warn " Continuing with the remaining picks; the system is otherwise unchanged." + pause_if_debug fi done done <<< "$sel" - - if (( ${#to_install[@]} > 0 )); then - step "Installing from $cat: ${to_install[*]}" - # install_category_pkgs wires any needed third-party repo first. - # Failure must NOT kill the script: warn in red and drop back to - # the menu (set -e is bypassed for this one call). - if install_category_pkgs "$cat" "${to_install[@]}"; then - done_any=true - else - color_red " Installation failed: ${to_install[*]}" - color_red " (dnf reported no match / transaction failure — see output above)" - warn " Returning to the menu. The system is unchanged." - pause_if_debug - fi - unset to_install; local -a to_install=() # fresh slate for next pick - fi done # not `&& ok` — a false done_any would return 1 and kill the script under set -e if [[ "$done_any" == "true" ]]; then @@ -514,11 +510,18 @@ install_category_pkgs() { sudo dnf install -y "https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm" fi if $needs_brave && ! pkg_installed brave-browser; then - info "Adding Brave repo..." - sudo dnf install -y dnf-plugins-core - sudo dnf config-manager add --from-repofile=https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo || \ - true - sudo rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc 2>/dev/null || true + # dnf5 (Fedora 41+) has no 'config-manager add' subcommand — + # the VM showed 'Unknown argument "add"', so the repo never + # landed and brave-browser had no match. Correct form per + # Brave's own F41+ docs: addrepo. The .repo carries the gpgkey, + # so no separate rpm --import is needed. + if [[ -f /etc/yum.repos.d/brave-browser.repo ]]; then + ok "Brave repo already present." + else + info "Adding Brave repo (dnf5 addrepo)..." + sudo dnf config-manager addrepo \ + --from-repofile=https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo + fi fi ;; esac -- 2.47.3