main script
This commit is contained in:
1 parent
3940842d37
commit
03bedea631
1 file changed
+214
@@ -0,0 +1,214 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# fedora-niri-dms-setup.sh
|
||||
# Turns a fresh "Fedora Custom Operating System" (terminal-only) install
|
||||
# into a niri + DankMaterialShell desktop with the DMS greeter.
|
||||
#
|
||||
# Usage (as your normal user, NOT root):
|
||||
# chmod +x fedora-niri-dms-setup.sh
|
||||
# ./fedora-niri-dms-setup.sh
|
||||
#
|
||||
# Safe to re-run: every step checks before changing things.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# ---------- helpers ----------------------------------------------------------
|
||||
|
||||
BOLD=$'\e[1m'; GREEN=$'\e[32m'; YELLOW=$'\e[33m'; RED=$'\e[31m'; RESET=$'\e[0m'
|
||||
|
||||
step() { echo; echo "${BOLD}${GREEN}==> $*${RESET}"; }
|
||||
info() { echo " $*"; }
|
||||
warn() { echo "${YELLOW} ! $*${RESET}"; }
|
||||
die() { echo "${RED}ERROR: $*${RESET}" >&2; exit 1; }
|
||||
|
||||
ask() {
|
||||
# ask "Question?" -> returns 0 for yes, 1 for no (default no)
|
||||
local reply
|
||||
read -r -p " $1 [y/N] " reply
|
||||
[[ "${reply,,}" == y || "${reply,,}" == yes ]]
|
||||
}
|
||||
|
||||
dnf_install() { sudo dnf install -y "$@"; }
|
||||
|
||||
# ---------- pre-flight -------------------------------------------------------
|
||||
|
||||
[[ $EUID -eq 0 ]] && die "Run this as your normal user (it uses sudo when needed), not as root."
|
||||
[[ -r /etc/fedora-release ]] || die "This script is for Fedora only."
|
||||
command -v sudo >/dev/null || die "sudo is not installed."
|
||||
|
||||
FEDORA_VER=$(rpm -E %fedora)
|
||||
VIRT=$(systemd-detect-virt 2>/dev/null || true)
|
||||
|
||||
echo "${BOLD}Fedora ${FEDORA_VER} -> niri + DankMaterialShell${RESET}"
|
||||
[[ -n "$VIRT" && "$VIRT" != "none" ]] && warn "Running in a VM ($VIRT). niri needs 3D acceleration enabled in the VM settings, or you'll get a black screen."
|
||||
|
||||
# Ask optional questions up front so the rest can run unattended.
|
||||
echo
|
||||
echo "${BOLD}Optional extras${RESET} (answer now, then the script runs on its own):"
|
||||
WANT_STEAM=false; ask "Install Steam + gamescope?" && WANT_STEAM=true
|
||||
WANT_OPENVPN=false; ask "Install OpenVPN support for NetworkManager (for PIA .ovpn files)?" && WANT_OPENVPN=true
|
||||
WANT_FPRINT=false; ask "Set up the fingerprint reader (Framework laptops)?" && WANT_FPRINT=true
|
||||
WANT_EASYFX=false; ask "Install EasyEffects (Framework speaker profile)?" && WANT_EASYFX=true
|
||||
|
||||
sudo -v # cache sudo credentials early
|
||||
# keep sudo alive for the duration of the script
|
||||
while true; do sudo -n true; sleep 50; kill -0 "$$" || exit; done 2>/dev/null &
|
||||
|
||||
# ---------- 1. dnf tuning + updates -----------------------------------------
|
||||
|
||||
step "Tuning dnf and updating the system"
|
||||
if ! grep -q '^max_parallel_downloads' /etc/dnf/dnf.conf 2>/dev/null; then
|
||||
echo 'max_parallel_downloads=10' | sudo tee -a /etc/dnf/dnf.conf >/dev/null
|
||||
info "Enabled parallel downloads"
|
||||
fi
|
||||
# dnf5-plugins provides 'copr' and 'config-manager'; not included in a minimal install
|
||||
dnf_install dnf5-plugins pciutils
|
||||
sudo dnf upgrade --refresh -y
|
||||
|
||||
# ---------- 2. RPM Fusion + OpenH264 -----------------------------------------
|
||||
|
||||
step "Enabling RPM Fusion (free + non-free) and OpenH264"
|
||||
if ! rpm -q rpmfusion-free-release >/dev/null 2>&1; then
|
||||
dnf_install \
|
||||
"https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-${FEDORA_VER}.noarch.rpm" \
|
||||
"https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${FEDORA_VER}.noarch.rpm"
|
||||
else
|
||||
info "RPM Fusion already enabled"
|
||||
fi
|
||||
sudo dnf config-manager setopt fedora-cisco-openh264.enabled=1 || warn "Could not enable OpenH264 repo"
|
||||
|
||||
# ---------- 3. Graphics ------------------------------------------------------
|
||||
|
||||
step "Installing graphics drivers"
|
||||
dnf_install mesa-dri-drivers mesa-vulkan-drivers vulkan-loader
|
||||
|
||||
GPU_INFO=$(lspci -nn | grep -Ei 'vga|3d|display' || true)
|
||||
info "Detected: ${GPU_INFO:-unknown}"
|
||||
|
||||
NVIDIA=false
|
||||
if grep -qi 'amd\|ati' <<<"$GPU_INFO"; then
|
||||
info "AMD GPU -> freeworld VA-API drivers"
|
||||
if rpm -q mesa-va-drivers >/dev/null 2>&1; then
|
||||
sudo dnf swap -y mesa-va-drivers mesa-va-drivers-freeworld
|
||||
else
|
||||
dnf_install mesa-va-drivers-freeworld
|
||||
fi
|
||||
fi
|
||||
if grep -qi 'intel' <<<"$GPU_INFO"; then
|
||||
info "Intel GPU -> intel-media-driver"
|
||||
dnf_install intel-media-driver
|
||||
fi
|
||||
if grep -qi 'nvidia' <<<"$GPU_INFO"; then
|
||||
info "NVIDIA GPU -> akmod-nvidia"
|
||||
dnf_install akmod-nvidia xorg-x11-drv-nvidia-cuda
|
||||
NVIDIA=true
|
||||
fi
|
||||
|
||||
# ---------- 4. Codecs --------------------------------------------------------
|
||||
|
||||
step "Installing full multimedia codecs"
|
||||
if rpm -q ffmpeg-free >/dev/null 2>&1; then
|
||||
sudo dnf swap -y ffmpeg-free ffmpeg --allowerasing
|
||||
else
|
||||
dnf_install ffmpeg --allowerasing
|
||||
fi
|
||||
sudo dnf group install -y multimedia --allowerasing || warn "Multimedia group had conflicts; core codecs are still installed"
|
||||
|
||||
# ---------- 5. Audio, Bluetooth, power, firmware -----------------------------
|
||||
|
||||
step "Installing PipeWire audio"
|
||||
dnf_install pipewire pipewire-pulseaudio pipewire-alsa \
|
||||
pipewire-jack-audio-connection-kit wireplumber alsa-sof-firmware
|
||||
|
||||
step "Installing Bluetooth"
|
||||
dnf_install bluez
|
||||
sudo systemctl enable --now bluetooth
|
||||
|
||||
step "Installing power profiles and firmware updater"
|
||||
dnf_install tuned-ppd fwupd
|
||||
sudo systemctl enable --now tuned tuned-ppd
|
||||
|
||||
# ---------- 6. niri + DankMaterialShell --------------------------------------
|
||||
|
||||
step "Installing niri and DankMaterialShell"
|
||||
sudo dnf copr enable -y avengemedia/dms
|
||||
dnf_install niri dms xwayland-satellite
|
||||
|
||||
info "Starting DMS with niri"
|
||||
systemctl --user add-wants niri.service dms
|
||||
|
||||
# ---------- 7. Desktop essentials --------------------------------------------
|
||||
|
||||
step "Installing desktop essentials"
|
||||
dnf_install \
|
||||
alacritty nautilus firefox \
|
||||
xdg-desktop-portal-gnome xdg-desktop-portal-gtk \
|
||||
gnome-keyring gnome-keyring-pam \
|
||||
google-noto-sans-fonts google-noto-color-emoji-fonts \
|
||||
xdg-user-dirs flatpak
|
||||
|
||||
info "Auto-unlocking the keyring at login"
|
||||
sudo authselect enable-feature with-pam-gnome-keyring || warn "authselect failed; keyring may ask for a password at login"
|
||||
|
||||
info "Creating home folders"
|
||||
xdg-user-dirs-update
|
||||
|
||||
info "Adding Flathub"
|
||||
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
# ---------- 8. Login screen --------------------------------------------------
|
||||
|
||||
step "Installing the DMS greeter"
|
||||
if ! dnf_install dms-greeter; then
|
||||
info "Not found in the dms COPR, trying avengemedia/danklinux"
|
||||
sudo dnf copr enable -y avengemedia/danklinux
|
||||
dnf_install dms-greeter
|
||||
fi
|
||||
|
||||
dms greeter enable
|
||||
dms greeter sync || warn "Greeter theme sync failed; re-run 'dms greeter sync' after first login"
|
||||
dms greeter status || true
|
||||
|
||||
sudo systemctl set-default graphical.target
|
||||
|
||||
# ---------- 9. Optional extras -----------------------------------------------
|
||||
|
||||
if $WANT_STEAM; then
|
||||
step "Installing Steam and gamescope"
|
||||
dnf_install steam gamescope
|
||||
fi
|
||||
|
||||
if $WANT_OPENVPN; then
|
||||
step "Installing NetworkManager OpenVPN support"
|
||||
dnf_install NetworkManager-openvpn
|
||||
info "Import a PIA config later with:"
|
||||
info " nmcli connection import type openvpn file ~/Downloads/<region>.ovpn"
|
||||
fi
|
||||
|
||||
if $WANT_FPRINT; then
|
||||
step "Setting up the fingerprint reader"
|
||||
dnf_install fprintd fprintd-pam
|
||||
sudo authselect enable-feature with-fingerprint || warn "Could not enable fingerprint auth"
|
||||
info "Enrol a finger now (press Ctrl+C to skip and run 'fprintd-enroll' later)"
|
||||
fprintd-enroll || warn "Enrolment skipped or failed; run 'fprintd-enroll' later"
|
||||
fi
|
||||
|
||||
if $WANT_EASYFX; then
|
||||
step "Installing EasyEffects"
|
||||
flatpak install -y --user flathub com.github.wwmm.easyeffects
|
||||
info "Load Framework's speaker profile from their knowledge base after first login"
|
||||
fi
|
||||
|
||||
# ---------- done -------------------------------------------------------------
|
||||
|
||||
step "All done"
|
||||
info "Next boot goes to the DMS login screen. Pick the 'niri' session."
|
||||
info "Press Super+Shift+/ after logging in to see all keybinds."
|
||||
$NVIDIA && warn "NVIDIA: wait ~5 minutes for the driver module to finish building before rebooting (check with: modinfo -F version nvidia)."
|
||||
[[ -n "$VIRT" && "$VIRT" != "none" ]] && warn "VM: make sure 3D acceleration is on before rebooting."
|
||||
info "If the screen stays black: Ctrl+Alt+F2, log in, and run 'niri-session' or 'dms greeter status'."
|
||||
echo
|
||||
if ask "Reboot now?"; then
|
||||
sudo reboot
|
||||
fi
|
||||
Reference in new issue
Block a user