PeaZip: swap to the wanted flavor when an incompatible one is detected
Per YuKu: instead of skipping when an older flavor is present, SWAP it to the environment-appropriate one (dnf swap -y old new). Atomic — if the swap fails, the existing flavor stays and the run continues with a warning (the safe outcome). Right flavor already present -> no-op; fresh machine -> plain install. Verified: qt5+niri -> swap to gtk3 (your laptop scenario); qt6+hyprland -> no-op; forced swap failure -> warn + keep qt5; fresh -> gtk3.
This commit is contained in:
@@ -640,29 +640,41 @@ rule
|
||||
# environments, GTK3 for the rest) ---
|
||||
info "Tailoring toolkits for DE=$DE / TWM=$TWM..."
|
||||
|
||||
# First: is ANY PeaZip flavor already installed? The UI flavors all ship
|
||||
# /usr/bin/peazip and file-conflict with each other — installing gtk3 over
|
||||
# an existing qt5 dies mid-transaction (laptop-proven). Any present flavor
|
||||
# wins; skipping is correct.
|
||||
# The UI flavors all ship /usr/bin/peazip and file-conflict with each
|
||||
# other — installing gtk3 over an existing qt5 dies mid-transaction
|
||||
# (laptop-proven). Behaviors:
|
||||
# no flavor -> install the environment-appropriate one
|
||||
# right flavor -> nothing to do
|
||||
# OTHER flavor -> dnf SWAP to the wanted one (atomic: on failure the
|
||||
# existing flavor stays, which is the safe outcome)
|
||||
if [[ "$DE" == "plasma" || "$TWM" == "hyprland" ]]; then
|
||||
peazip_wanted="peazip-qt6"
|
||||
else
|
||||
# XFCE, GNOME, Niri, MangoWC, chadwm: lightweight/generic toolkits
|
||||
peazip_wanted="peazip-gtk3"
|
||||
fi
|
||||
peazip_existing=""
|
||||
local_v=""
|
||||
for local_v in peazip-qt5 peazip-qt6 peazip-gtk3 peazip-gtk2; do
|
||||
pkg_installed "$local_v" && peazip_existing="$local_v"
|
||||
done
|
||||
if [[ -n "$peazip_existing" ]]; then
|
||||
ok "PeaZip already present ($peazip_existing) - skipping."
|
||||
else
|
||||
if [[ "$DE" == "plasma" || "$TWM" == "hyprland" ]]; then
|
||||
peazip_pkgs="peazip-common peazip-qt6"
|
||||
else
|
||||
# XFCE, GNOME, Niri, MangoWC, chadwm: lightweight/generic toolkits
|
||||
peazip_pkgs="peazip-common peazip-gtk3"
|
||||
fi
|
||||
|
||||
if [[ -z "$peazip_existing" ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
if ! install_packages $peazip_pkgs; then
|
||||
color_red " Failed: $peazip_pkgs"
|
||||
if ! install_packages peazip-common "$peazip_wanted"; then
|
||||
color_red " Failed: peazip-common $peazip_wanted"
|
||||
color_red " (continuing — PeaZip is a convenience, not a dependency)"
|
||||
fi
|
||||
elif [[ "$peazip_existing" == "$peazip_wanted" ]]; then
|
||||
ok "PeaZip already present ($peazip_existing)."
|
||||
else
|
||||
info "PeaZip $peazip_existing does not match this environment — swapping to $peazip_wanted..."
|
||||
if ui_quiet_run "Swapping PeaZip: $peazip_existing -> $peazip_wanted" \
|
||||
sudo dnf swap -y "$peazip_existing" "$peazip_wanted"; then
|
||||
ok "PeaZip swapped to $peazip_wanted."
|
||||
else
|
||||
warn "Swap failed — keeping the existing $peazip_existing (fully functional)."
|
||||
fi
|
||||
fi
|
||||
pause_if_debug
|
||||
|
||||
|
||||
Reference in New Issue
Block a user