Fix Fedora DNF5 compatibility and distro-specific packages

Key changes:
- lib/distro.sh: replace REPO_ADD_RPM variable with repo_add_rpm()
  function (DNF5 changed 'config-manager --add-repo' to
  'config-manager addrepo --from-repofile=')
- 01-repos.sh: use repo_add_rpm function; add Ghostty COPR for
  Fedora; remove Signal RPM repo (no official one — use Flatpak)
- 02-packages.sh: lowercase 'development-tools' group for DNF5;
  add python3-devel (needed for native extensions like evdev);
  swap ffmpeg-free → ffmpeg via RPM Fusion for full codec support;
  use tuned (preinstalled on Fedora) instead of TLP
- 11-tweaks.sh: conditional power management — TLP on Debian,
  tuned on Fedora
This commit is contained in:
2026-06-07 14:34:12 +10:00
parent 7699d71d4e
commit 5a44aaecb0
4 changed files with 62 additions and 23 deletions

34
lib/distro.sh Normal file → Executable file
View File

@@ -22,9 +22,9 @@ DISTRO_LIKE="" # from ID_LIKE in os-release
if [ -f /etc/os-release ]; then
. /etc/os-release
DISTRO_ID="$ID"
DISTRO_VERSION="$VERSION_ID"
DISTRO_LIKE="$ID_LIKE"
DISTRO_ID="${ID:-}"
DISTRO_VERSION="${VERSION_ID:-}"
DISTRO_LIKE="${ID_LIKE:-}"
fi
# ---- Determine distro family ----
@@ -97,7 +97,7 @@ elif [ "$DISTRO_FAMILY" = "fedora" ]; then
# Repo management
REPO_ADD_COPR="sudo dnf copr enable -y"
REPO_ADD_RPM="sudo dnf config-manager --add-repo"
REPO_ADD_RPM="sudo dnf config-manager addrepo --from-repofile=" # Note: use as function call, see repo_add_rpm below
# Service / boot
SERVICE_ENABLE="sudo systemctl enable --now"
@@ -109,6 +109,30 @@ elif [ "$DISTRO_FAMILY" = "fedora" ]; then
DEFAULT_DE="GNOME" # Fedora Workstation defaults to GNOME
fi
# ===========================================================================
# Helper function: add RPM repo via DNF5 config-manager addrepo
# ===========================================================================
repo_add_rpm() {
local url="$1"
local repo_file
repo_file="/etc/yum.repos.d/$(basename "$url")"
shift
if [ "$DISTRO_FAMILY" = "fedora" ]; then
# Skip if repo file already exists (idempotent)
if [ -f "$repo_file" ]; then
return 0
fi
sudo dnf config-manager addrepo --from-repofile="$url" "$@" 2>/dev/null || return 1
# Disable repo_gpgcheck to avoid interactive GPG prompts in automated provisioning
# Package signatures are still verified via gpgcheck
if [ -f "$repo_file" ]; then
sudo sed -i 's/repo_gpgcheck=1/repo_gpgcheck=0/' "$repo_file" 2>/dev/null || true
fi
else
return 0
fi
}
# ===========================================================================
# Helper function: install package(s), silently skip if already installed
# ===========================================================================
@@ -168,4 +192,4 @@ export SERVICE_ENABLE GRUB_UPDATE GRUB_EFI_UPDATE GRUB_FILE
export DEFAULT_DE
# Export helpers
export -f pkg_install pkg_group_install pkg_install_mapped resolve_pkg
export -f pkg_install pkg_group_install pkg_install_mapped resolve_pkg repo_add_rpm