#!/usr/bin/bash set -eoux pipefail ############################################################################### # cleanup-function (Unverändert, da sehr effektiv für Image-Größe) ############################################################################### cleanup() { echo "Starting final cleanup..." # 1. Ungenutzte Pakete entfernen dnf5 autoremove -y || true # 2. Bereinigung Cache (Das ist das Wichtigste für die Layer-Größe) dnf5 clean all || true # 3. Entfernen von temporären Dateien und Caches # Wir löschen KEINE Verzeichnisse unter /var/lib/rpm oder /var/lib/dnf, # sondern nur die temporären Metadaten/Caches. rm -rf /tmp/* /var/tmp/* /var/cache/dnf/* /var/cache/dnf5/* || true # 4. Reinigung der Logs/Run-Verzeichnisse rm -rf /run/* || 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 ############################################################################### # Transaction 1: Multimedia Stack (Mesa + Codecs + Group) # Zusammengefasst, um Abhängigkeiten in einem Schritt zu lösen. ############################################################################### echo "Installing Multimedia stack (Mesa Freeworld, Codecs & Groups)..." dnf5 install -y \ mesa-va-drivers-freeworld \ mesa-vdpau-drivers-freeworld \ mesa-vulkan-drivers-freeworld \ ffmpeg \ ffmpeg-libs \ libavcodec-freeworld \ gstreamer1-libav \ gstreamer1-plugins-bad-freeworld \ gstreamer1-plugins-ugly \ --allowerasing # Die Gruppeninstallation bleibt separat, da sie eine eigene logische Einheit ist dnf5 group install -y multimedia --with-optional --allowerasing ############################################################################### # Transaction 2: Virtualization, Tools & Hardware Helpers # Zusammengefasst für effizientere Paketauflösung. ############################################################################### echo "Installing Virtualization, Plasma Setup and Hardware Helpers..." dnf5 install -y \ libvirt-daemon \ libvirt-daemon-driver-qemu \ libvirt-daemon-config-network \ libvirt-client \ qemu-kvm \ qemu-img \ virt-manager \ virt-viewer \ distrobox \ plasma-setup \ libva-utils \ intel-media-driver \ --allowerasing || true ############################################################################### # Transaction 3: Steam (i686 dependencies) # Getrennt, da Architektur-Wechsel (i686) oft eigene Transaktionen erfordern. ############################################################################### echo "Installing Steam and i686 libraries..." dnf5 install -y \ steam \ mesa-dri-drivers.i686 \ mesa-libGL.i686 \ mesa-libEGL.i686 \ --allowerasing ############################################################################### # Cleanup of Unwanted Packages ############################################################################### echo "Removing Firefox and langpacks..." dnf5 remove -y firefox firefox-langpacks* || true ############################################################################### # Services Configuration ############################################################################### echo "Enabling 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 ############################################################################### # Final Cleanup ############################################################################### cleanup echo "Custom build complete!"