Updated cleanup function to enhance the cleanup process by adding detailed comments and ensuring temporary directories are cleared.
138 lines
4.4 KiB
Bash
Executable File
138 lines
4.4 KiB
Bash
Executable File
#!/usr/bin/bash
|
|
set -eoux pipefail
|
|
|
|
###############################################################################
|
|
# cleanup-function
|
|
###############################################################################
|
|
cleanup() {
|
|
echo "Starting final cleanup..."
|
|
|
|
# 1. Standard DNF Reinigung (entfernt Metadaten und Paket-Caches)
|
|
dnf5 clean all || true
|
|
|
|
# 2. Tiefenreinigung der Repository-Strukturen
|
|
# Wir löschen alles ab Ebene 2, um die schweren Repo-Ordner zu entfernen,
|
|
# aber lassen /var/lib/dnf und /var/lib/rpm selbst (Ebene 0 & 1) bestehen!
|
|
find /var/lib/dnf -mindepth 2 -delete || true
|
|
find /var/lib/rpm -mindepth 2 -delete || true
|
|
|
|
# 3. Reinigung der temporären Verzeichnisse (Löst die /run, /tmp, /var/tmp Warnungen)
|
|
# Wir löschen den Inhalt, aber nicht das Verzeichnis selbst.
|
|
rm -rf /run/* /tmp/* /var/tmp/* || true
|
|
|
|
# 4. Entfernen von eventuellen 'countme' Dateien (Spezialfall für DNF5/RPM)
|
|
find /var/lib/dnf -name "countme" -delete || true
|
|
find /var/lib/rpm -name "countme" -delete || true
|
|
|
|
echo "Cleanup complete! Image is lean and clean."
|
|
}
|
|
|
|
|
|
###############################################################################
|
|
# Fedora version (used for RPM Fusion)
|
|
###############################################################################
|
|
|
|
FEDORA_VERSION="$(rpm -E %fedora)"
|
|
|
|
###############################################################################
|
|
# Enable RPM Fusion (free + nonfree)
|
|
###############################################################################
|
|
|
|
dnf5 install -y \
|
|
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-${FEDORA_VERSION}.noarch.rpm \
|
|
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${FEDORA_VERSION}.noarch.rpm
|
|
|
|
###############################################################################
|
|
# Multimedia stack (Mesa freeworld + codecs)
|
|
###############################################################################
|
|
|
|
# Replace Fedora Mesa with freeworld variants
|
|
dnf5 install -y \
|
|
mesa-va-drivers-freeworld \
|
|
mesa-vdpau-drivers-freeworld \
|
|
--allowerasing
|
|
|
|
|
|
# Install full multimedia group (RPM Fusion maintained)
|
|
dnf5 group install -y multimedia \
|
|
--with-optional \
|
|
--allowerasing
|
|
|
|
# Explicit codec safety net
|
|
dnf5 install -y \
|
|
ffmpeg \
|
|
ffmpeg-libs \
|
|
libavcodec-freeworld \
|
|
gstreamer1-libav \
|
|
gstreamer1-plugins-bad-freeworld \
|
|
gstreamer1-plugins-ugly \
|
|
--allowerasing
|
|
|
|
###############################################################################
|
|
# Virtualization stack (desktop-focused, minimal)
|
|
###############################################################################
|
|
|
|
dnf5 install -y \
|
|
libvirt-daemon \
|
|
libvirt-daemon-driver-qemu \
|
|
libvirt-daemon-config-network \
|
|
libvirt-client \
|
|
qemu-kvm \
|
|
qemu-img \
|
|
virt-manager \
|
|
virt-viewer \
|
|
distrobox
|
|
|
|
###############################################################################
|
|
# Steam (RPM Fusion nonfree)
|
|
###############################################################################
|
|
|
|
dnf5 install -y \
|
|
steam \
|
|
mesa-dri-drivers.i686 \
|
|
mesa-libGL.i686 \
|
|
mesa-libEGL.i686
|
|
|
|
###############################################################################
|
|
# Optional: hardware video acceleration helpers
|
|
###############################################################################
|
|
|
|
dnf5 install -y \
|
|
libva-utils \
|
|
intel-media-driver || true
|
|
|
|
###############################################################################
|
|
# Install Plasma Setup
|
|
###############################################################################
|
|
|
|
dnf5 install -y \
|
|
plasma-setup
|
|
|
|
###############################################################################
|
|
# Remove Firefox and langpacks
|
|
###############################################################################
|
|
|
|
dnf5 remove -y \
|
|
firefox \
|
|
firefox-langpacks*
|
|
|
|
###############################################################################
|
|
# Services
|
|
###############################################################################
|
|
|
|
systemctl enable libvirtd.service
|
|
systemctl enable virtlogd.service
|
|
systemctl enable podman.socket
|
|
systemctl enable bluetooth.service
|
|
systemctl enable plasma-setup.service
|
|
systemctl enable bootc-fetch-apply-updates.timer
|
|
|
|
|
|
###############################################################################
|
|
# Cleanup
|
|
###############################################################################
|
|
|
|
cleanup
|
|
|
|
echo "Custom build complete!"
|