Install the desktop before anything allowed to fail, and let Terra be installed twice
Two bugs, one story: ./install on a machine that had been half set up before produced no Hyprland at all, and said so in one line among twenty minutes of scrollback. Terra bootstraps itself with --repofrompath, which defines a throwaway repo id just long enough to install terra-release. Run it again on a machine that already has terra-release and dnf5 refuses the whole transaction -- the throwaway id collides with the real one. That step sits above everything, so set -e ended the stage before a single package was considered. It is skipped now when terra-release is already installed. The rest is the reason one failed repo cost the desktop. Hyprland was installed near the bottom of the stage, below a codec swap, two group updates and a GStreamer glob, any one of which can fail for reasons outside this repository. It now installs directly after the packages it needs and before anything optional, and everything fragile below it runs through a soft helper that logs and continues rather than ending the run. What was stepped over is listed at the end, because tolerating a failure only beats aborting on it if somebody is told. A missing Hyprland is still fatal, and now says so in words. Also removes the leftover disabled solopasha/hyprland COPR, which would mix with lionheartp's the moment anyone enabled it while debugging. Fixes the usage widget reading 1500%: the endpoint reports percentages, not 0..1 fractions. Clamped as well, and the widget answers a click now -- it set interactive:false, which disables the mouse area its own handler needed.
This commit is contained in:
+114
-40
@@ -22,6 +22,23 @@ packages_in() {
|
||||
sed 's/#.*//' "$1" | tr "\n" " "
|
||||
}
|
||||
|
||||
# Runs something whose failure must not cost you the desktop.
|
||||
#
|
||||
# `set -e` above is right for the packages Panama cannot work without and wrong
|
||||
# for everything else. A codec swap that finds nothing to swap, a group update
|
||||
# renamed upstream, a third-party host that is down -- each of those used to end
|
||||
# this stage wherever it happened to sit, and the desktop was installed near the
|
||||
# bottom, so any one of them meant a machine with no Hyprland on it and a single
|
||||
# line of dnf output to explain why.
|
||||
#
|
||||
# So the ordering rule for this file: anything that can fail for a reason
|
||||
# outside this repository goes below the desktop, and goes through here.
|
||||
soft() {
|
||||
local what="$1"; shift
|
||||
"$@" >/dev/null 2>&1 || { log "$what did not complete; continuing"; softly_failed+=("$what"); }
|
||||
}
|
||||
softly_failed=()
|
||||
|
||||
# --- Defined Paths ---
|
||||
# The default, not an assignment: ./install and link-dotfiles honor an exported
|
||||
# PANAMA_PATH, and clobbering it here made a clone anywhere else source the
|
||||
@@ -41,32 +58,27 @@ sudo dnf config-manager setopt fedora-cisco-openh264.enabled=1
|
||||
log "Installing RPM Fusion AppStream Metadata"
|
||||
sudo dnf update @core -y > /dev/null
|
||||
sudo dnf install -y rpmfusion-\*-appstream-data > /dev/null
|
||||
log "Installing Terra Repository"
|
||||
sudo dnf install -y --nogpgcheck --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' terra-release > /dev/null
|
||||
# Terra bootstraps itself: --repofrompath defines a throwaway repo just long
|
||||
# enough to install terra-release, which then writes the real /etc/yum.repos.d
|
||||
# entry. Doing that a second time is not harmless -- dnf5 refuses the whole
|
||||
# transaction with 'Id is present more than once in the configuration', because
|
||||
# the throwaway id collides with the one terra-release already installed.
|
||||
#
|
||||
# That is what killed a re-run on a machine Terra had already reached: this sits
|
||||
# in the repository section, above everything, so `set -e` ended the stage
|
||||
# before a single package was considered. An installer whose second run does
|
||||
# less than its first is worse than one that never ran.
|
||||
if rpm -q terra-release >/dev/null 2>&1; then
|
||||
log "Terra repository already installed"
|
||||
else
|
||||
log "Installing Terra Repository"
|
||||
sudo dnf install -y --nogpgcheck --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' terra-release > /dev/null
|
||||
fi
|
||||
|
||||
echo -e "\n--- Installing relevant packages ---"
|
||||
log "Updating all packages. This may take a while"
|
||||
sudo dnf update -y --refresh > /dev/null
|
||||
|
||||
log "Updating core, multimedia, and sound-and-video groups"
|
||||
# A trailing `&& sync` here previously meant a failing groupupdate was exempt
|
||||
# from set -e (bash does not apply -e to the left side of a && list), so the
|
||||
# failure went unreported. Sync unconditionally on its own line instead.
|
||||
sudo dnf4 groupupdate -y 'core' 'multimedia' 'sound-and-video' \
|
||||
--setop='install_weak_deps=False' \
|
||||
--exclude='PackageKit-gstreamer-plugin' \
|
||||
--allowerasing > /dev/null
|
||||
sync
|
||||
log "Swapping ffmpeg-free for ffmpeg"
|
||||
sudo dnf swap -y 'ffmpeg-free' 'ffmpeg' --allowerasing > /dev/null
|
||||
log "Swapping mesa-va-drivers for mesa-va-drivers-freeworld"
|
||||
sudo dnf swap -y mesa-va-drivers mesa-va-drivers-freeworld > /dev/null
|
||||
log "Upgrading Multimedia group with optional packages"
|
||||
sudo dnf4 group upgrade -y --with-optional Multimedia > /dev/null
|
||||
log "Installing GStreamer plugins (bad, good, base)"
|
||||
sudo dnf install -y gstreamer1-plugins-{bad-\*,good-\*,base} \
|
||||
--exclude=gstreamer1-plugins-bad-free-devel > /dev/null
|
||||
|
||||
# --- Install all initial packages ---
|
||||
PACKAGES_FILE="$PANAMA_PATH/setup/packages/initial-packages"
|
||||
if [[ -f "$PACKAGES_FILE" ]]; then
|
||||
@@ -93,6 +105,68 @@ else
|
||||
log "Package list was not in specified path: $DESKTOP_FILE"
|
||||
fi
|
||||
|
||||
# --- Install the Hyprland desktop ---
|
||||
#
|
||||
# Directly after desktop-packages, which is what supplies the dnf plugin that
|
||||
# `dnf copr` needs, and deliberately before anything optional. This is the one
|
||||
# thing on the list that Panama is; a machine that gets only this far is a
|
||||
# machine you can log into, and every step below it is a convenience.
|
||||
#
|
||||
# Most of these live in the lionheartp/Hyprland COPR rather than Fedora proper.
|
||||
HYPR_FILE="$PANAMA_PATH/setup/packages/hyprland-packages"
|
||||
if [[ -f "$HYPR_FILE" ]]; then
|
||||
log "Enabling Hyprland COPR"
|
||||
sudo dnf copr enable -y lionheartp/Hyprland > /dev/null
|
||||
HYPR_PACKAGES=$(packages_in "$HYPR_FILE")
|
||||
log "Installing Hyprland desktop packages"
|
||||
echo -e "Includes the following packages:"
|
||||
echo -e "$(<"$HYPR_FILE")"
|
||||
sudo dnf install -y --setopt=install_weak_deps=False $HYPR_PACKAGES > /dev/null
|
||||
log "Hyprland packages installed!"
|
||||
else
|
||||
log "Package list was not in specified path: $HYPR_FILE"
|
||||
fi
|
||||
|
||||
# Said out loud, because the failure this guards against was silent. The stage
|
||||
# used to die somewhere above this point and report one red line among twenty
|
||||
# minutes of scrollback, and the machine looked installed until you tried to log
|
||||
# into it.
|
||||
if rpm -q hyprland >/dev/null 2>&1; then
|
||||
log "Hyprland $(rpm -q --queryformat '%{VERSION}' hyprland) is installed."
|
||||
else
|
||||
log "Hyprland is NOT installed. Nothing below this point will give you a desktop."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Codecs and multimedia ---------------------------------------------------
|
||||
#
|
||||
# Below the desktop and every one of them non-fatal, because none is a
|
||||
# dependency of it and each can fail for reasons that have nothing to do with
|
||||
# this repository -- a swap whose source package this spin never shipped, a
|
||||
# group renamed upstream between Fedora releases.
|
||||
#
|
||||
# A trailing `&& sync` on the group update previously meant a failure was exempt
|
||||
# from set -e as well (bash does not apply -e to the left of a && list), so it
|
||||
# went unreported rather than being deliberately tolerated. It is deliberate now.
|
||||
|
||||
log "Updating core, multimedia, and sound-and-video groups"
|
||||
soft "the multimedia group update" \
|
||||
sudo dnf4 groupupdate -y 'core' 'multimedia' 'sound-and-video' \
|
||||
--setop='install_weak_deps=False' \
|
||||
--exclude='PackageKit-gstreamer-plugin' \
|
||||
--allowerasing
|
||||
sync
|
||||
log "Swapping ffmpeg-free for ffmpeg"
|
||||
soft "the ffmpeg swap" sudo dnf swap -y 'ffmpeg-free' 'ffmpeg' --allowerasing
|
||||
log "Swapping mesa-va-drivers for mesa-va-drivers-freeworld"
|
||||
soft "the mesa driver swap" sudo dnf swap -y mesa-va-drivers mesa-va-drivers-freeworld
|
||||
log "Upgrading Multimedia group with optional packages"
|
||||
soft "the optional Multimedia upgrade" sudo dnf4 group upgrade -y --with-optional Multimedia
|
||||
log "Installing GStreamer plugins (bad, good, base)"
|
||||
soft "the GStreamer plugins" \
|
||||
sudo dnf install -y gstreamer1-plugins-{bad-\*,good-\*,base} \
|
||||
--exclude=gstreamer1-plugins-bad-free-devel
|
||||
|
||||
# --- Install Development Packages needed for Neovim ---
|
||||
DEV_FILE="$PANAMA_PATH/setup/packages/development-packages"
|
||||
if [[ -f "$DEV_FILE" ]]; then
|
||||
@@ -100,7 +174,7 @@ if [[ -f "$DEV_FILE" ]]; then
|
||||
log "Installing Development Packages. Mostly for Neovim."
|
||||
echo -e "Includes the following packages:"
|
||||
echo -e "$(<"$DEV_FILE")"
|
||||
sudo dnf install -y $DEV_PACKAGES > /dev/null
|
||||
soft "the development packages" sudo dnf install -y $DEV_PACKAGES
|
||||
log "Development packages installed!"
|
||||
else
|
||||
log "Package list was not in specified path: $DEV_FILE"
|
||||
@@ -136,22 +210,6 @@ else
|
||||
log "nvm is not installed, so Node was not set up"
|
||||
fi
|
||||
|
||||
# --- Install the Hyprland desktop ---
|
||||
# Most of these live in the lionheartp/Hyprland COPR rather than Fedora proper.
|
||||
HYPR_FILE="$PANAMA_PATH/setup/packages/hyprland-packages"
|
||||
if [[ -f "$HYPR_FILE" ]]; then
|
||||
log "Enabling Hyprland COPR"
|
||||
sudo dnf copr enable -y lionheartp/Hyprland > /dev/null
|
||||
HYPR_PACKAGES=$(packages_in "$HYPR_FILE")
|
||||
log "Installing Hyprland desktop packages"
|
||||
echo -e "Includes the following packages:"
|
||||
echo -e "$(<"$HYPR_FILE")"
|
||||
sudo dnf install -y --setopt=install_weak_deps=False $HYPR_PACKAGES > /dev/null
|
||||
log "Hyprland packages installed!"
|
||||
else
|
||||
log "Package list was not in specified path: $HYPR_FILE"
|
||||
fi
|
||||
|
||||
# --- Applications no repository packages -------------------------------------
|
||||
#
|
||||
# Everything else Panama installs comes from dnf or Flathub. These four do not
|
||||
@@ -238,11 +296,14 @@ FLATPAK_FILE="$PANAMA_PATH/setup/packages/flatpak-packages"
|
||||
if [[ -f "$FLATPAK_FILE" ]]; then
|
||||
FLATPAK_PACKAGES=$(packages_in "$FLATPAK_FILE")
|
||||
log "Adding Flathub remote"
|
||||
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo > /dev/null
|
||||
soft "adding the Flathub remote" \
|
||||
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
log "Installing Flatpak Packages"
|
||||
echo -e "Includes the following packages:"
|
||||
echo -e "$(<"$FLATPAK_FILE")"
|
||||
sudo flatpak install -y flathub $FLATPAK_PACKAGES > /dev/null
|
||||
# One ID renamed on Flathub must not cost the rest of the run; the desktop
|
||||
# is already installed by this point and none of these is part of it.
|
||||
soft "some Flatpak packages" sudo flatpak install -y flathub $FLATPAK_PACKAGES
|
||||
log "Flatpak packages installed!"
|
||||
else
|
||||
log "Package list was not in specified path: $FLATPAK_FILE"
|
||||
@@ -301,3 +362,16 @@ for extra in ${PANAMA_EXTRAS:-}; do
|
||||
log "No such extras category: $extra"
|
||||
fi
|
||||
done
|
||||
|
||||
# --- What was stepped over ---------------------------------------------------
|
||||
#
|
||||
# Tolerating a failure is only better than aborting on it if somebody is told.
|
||||
# This stage now survives a codec swap that finds nothing to swap, and the whole
|
||||
# point of surviving it is that the desktop gets installed anyway -- but a
|
||||
# machine missing its video codecs should say so once, here, rather than be
|
||||
# discovered a week later by a video that will not play.
|
||||
if (( ${#softly_failed[@]} > 0 )); then
|
||||
log "Installed, but these were stepped over:"
|
||||
printf ' - %s\n' "${softly_failed[@]}"
|
||||
log "None of them stops the desktop. Re-run this stage to try them again."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user