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

18
stages/01-repos.sh Normal file → Executable file
View File

@@ -171,31 +171,25 @@ EOF
# ---- Docker CE ----
info " Adding Docker CE repo..."
$REPO_ADD_RPM https://download.docker.com/linux/fedora/docker-ce.repo 2>/dev/null && \
repo_add_rpm https://download.docker.com/linux/fedora/docker-ce.repo && \
ok " Docker repo added." || warn " Docker repo add failed."
# ---- Tailscale ----
info " Adding Tailscale repo..."
$REPO_ADD_RPM https://pkgs.tailscale.com/stable/fedora/tailscale.repo 2>/dev/null && \
repo_add_rpm https://pkgs.tailscale.com/stable/fedora/tailscale.repo && \
ok " Tailscale repo added." || warn " Tailscale repo add failed."
# ---- Signal Desktop ----
info " Adding Signal repo..."
cat << 'EOF' | sudo tee /etc/yum.repos.d/signal-desktop.repo > /dev/null
[signal-desktop]
name=Signal Desktop
baseurl=https://updates.signal.org/desktop/yum
enabled=1
gpgcheck=1
gpgkey=https://updates.signal.org/desktop/signal_pubkey.gpg
EOF
ok " Signal repo added."
# Signal does not provide an official RPM repo. Install via Flatpak (handled in stage 12).
info " Note: Signal will be installed via Flatpak in stage 12."
# ---- COPRs for extra packages ----
# Papirus icon theme is in RPM Fusion nonfree.
# Solaar is in RPM Fusion.
# Yubico tools: use COPR
info " Adding COPR repos..."
# Ghostty terminal emulator
$REPO_ADD_COPR scottames/ghostty 2>/dev/null && ok " Ghostty COPR added." || warn " Ghostty COPR failed."
# $REPO_ADD_COPR atim/papirus-icon-theme 2>/dev/null || true
# $REPO_ADD_COPR sergiomb/Solaar 2>/dev/null || true

23
stages/02-packages.sh Normal file → Executable file
View File

@@ -14,10 +14,11 @@ info "Installing system packages (this may take a while)..."
# A. Development tools & compilers
# ===========================================================================
echo " Development tools..."
pkg_group_install "Development Tools" # Fedora only
pkg_group_install "development-tools" # Fedora only
# Common dev packages (same name on both)
pkg_install cmake
pkg_install python3-devel # Needed for building native extensions (evdev, etc.)
# Differently-named dev packages
pkg_install_mapped "build-essential" "@development-tools"
@@ -32,6 +33,13 @@ fi
pkg_install dkms
# ---- Swap ffmpeg-free → ffmpeg from RPM Fusion (for full codec support) ----
# Fedora ships ffmpeg-free in main repos, but RPM Fusion's ffmpeg has more codecs
if rpm -q ffmpeg-free &>/dev/null; then
echo " Swapping ffmpeg-free → ffmpeg (RPM Fusion)..."
sudo dnf swap -y ffmpeg-free ffmpeg --allowerasing 2>/dev/null && ok " ffmpeg swapped" || warn " ffmpeg swap had issues."
fi
# ===========================================================================
# B. CLI utilities
# ===========================================================================
@@ -87,11 +95,12 @@ pkg_install \
smartmontools \
solaar 2>/dev/null || warn " Some system tools failed."
# TLP — laptop power management
# Power management — use tuned on Fedora, TLP on Debian
if [ "$DISTRO_FAMILY" = "debian" ]; then
pkg_install tlp 2>/dev/null || warn " tlp not available."
else
pkg_install tlp tlp-rdw 2>/dev/null || warn " tlp not available."
# tuned is preinstalled on Fedora Workstation — just enable it
$SERVICE_ENABLE tuned 2>/dev/null || true
fi
# ===========================================================================
@@ -106,7 +115,7 @@ pkg_install \
p7zip 2>/dev/null || true
# ---- Ghostty terminal emulator ----
# Fedora: in official repos since F40
# Fedora: via COPR (scottames/ghostty) added in stage 01
# Ubuntu/Pop: via PPA (added in stage 01)
echo " Ghostty terminal emulator..."
pkg_install ghostty 2>/dev/null || warn " ghostty install failed."
@@ -118,8 +127,12 @@ pkg_install code 2>/dev/null || warn " code install failed."
# ===========================================================================
# Start enabled services
# ===========================================================================
if command -v tlp &>/dev/null; then
if [ "$DISTRO_FAMILY" = "debian" ] && command -v tlp &>/dev/null; then
$SERVICE_ENABLE tlp 2>/dev/null || true
fi
# tuned is already enabled by default on Fedora, but ensure it's running
if [ "$DISTRO_FAMILY" = "fedora" ] && command -v tuned &>/dev/null; then
$SERVICE_ENABLE tuned 2>/dev/null || true
fi
ok "Stage 02 complete: system packages installed."

8
stages/11-tweaks.sh Normal file → Executable file
View File

@@ -15,7 +15,15 @@ CONFIG_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}/conf
# ===========================================================================
info "Configuring power management..."
# Enable TLP on Debian, tuned (already enabled) on Fedora
if [ "$DISTRO_FAMILY" = "debian" ]; then
$SERVICE_ENABLE tlp 2>/dev/null && ok "TLP enabled." || warn "TLP not available."
else
# tuned is already enabled from stage 02
if systemctl is-active tuned &>/dev/null; then
ok "tuned is running (enabled in stage 02)"
fi
fi
if command -v powertop &>/dev/null; then
# Enable powertop auto-tune via systemd service