Brave via dnf5 addrepo + per-item installs in advanced menu #11
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user