diff --git a/modules/dnf/dnf.sh b/modules/dnf/dnf.sh index deed39e3..702b425c 100644 --- a/modules/dnf/dnf.sh +++ b/modules/dnf/dnf.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Tell build process to exit if there are any errors. -set -euxo pipefail +set -euo pipefail # Fail the build if dnf5 isn't installed if ! rpm -q dnf5 &>/dev/null; then @@ -33,12 +33,13 @@ if [[ ${#REPOS[@]} -gt 0 ]]; then for i in "${!REPOS[@]}"; do repo="${REPOS[$i]}" repo="${repo//%OS_VERSION%/${OS_VERSION}}" + REPOS[$i]="${repo//[$'\t\r\n ']}" # Remove spaces/newlines for all repos other than COPR if [[ "${repo}" != "COPR "* ]]; then REPOS[$i]="${repo//[$'\t\r\n ']}" else REPOS[$i]="${repo}" - fi + fi done # dnf config-manager & dnf copr don't support adding multiple repositories at once, hence why for/done loop is used for repo in "${REPOS[@]}"; do @@ -46,8 +47,8 @@ if [[ ${#REPOS[@]} -gt 0 ]]; then echo "Adding repository URL: '${repo}'" dnf -y config-manager addrepo --from-repofile="${repo}" elif [[ "${repo}" == *".repo" ]] && [[ -f "${CONFIG_DIRECTORY}/dnf/${repo}" ]]; then - echo "Adding repository file: '${repo}'" - dnf -y config-manager addrepo --from-repofile="${repo}" + echo "Adding repository file: '${repo##*/}'" + dnf -y config-manager addrepo --from-repofile="${CONFIG_DIRECTORY}/dnf/${repo}" elif [[ "${repo}" == "COPR "* ]]; then echo "Adding COPR repository: '${repo#COPR }'" dnf -y copr enable "${repo#COPR }" @@ -82,6 +83,26 @@ if [[ ${#OPTFIX[@]} -gt 0 ]]; then done fi +# Install & remove group packages +get_json_array GROUP_INSTALL 'try .["group-install"][]' "${1}" +get_json_array GROUP_REMOVE 'try .["group-remove"][]' "${1}" + +if [[ ${#GROUP_INSTALL[@]} -gt 0 && ${#GROUP_REMOVE[@]} -gt 0 ]]; then + echo "Removing & Installing RPM groups" + echo "Removing: ${GROUP_REMOVE[*]}" + echo "Installing: ${GROUP_INSTALL[*]}" + dnf -y group remove "${GROUP_REMOVE[@]}" + dnf -y "${WEAK_DEPS_FLAG}" group install --refresh "${GROUP_INSTALL[@]}" +elif [[ ${#GROUP_INSTALL[@]} -gt 0 ]]; then + echo "Installing RPM groups" + echo "Installing: ${GROUP_INSTALL[*]}" + dnf -y "${WEAK_DEPS_FLAG}" group install --refresh "${GROUP_INSTALL[@]}" +elif [[ ${#GROUP_REMOVE[@]} -gt 0 ]]; then + echo "Removing RPM groups" + echo "Removing: ${GROUP_REMOVE[*]}" + dnf -y remove "${GROUP_REMOVE[@]}" +fi + get_json_array INSTALL_PKGS 'try .["install"][]' "${1}" get_json_array REMOVE_PKGS 'try .["remove"][]' "${1}" @@ -97,9 +118,9 @@ if [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then INSTALL_PKGS[$i]="${PKG//%OS_VERSION%/${OS_VERSION}}" HTTPS_INSTALL=true HTTPS_PKGS+=("${INSTALL_PKGS[$i]}") - elif [[ ! "${PKG}" =~ ^https?:\/\/.* ]] && [[ -f "${CONFIG_DIRECTORY}/rpm-ostree/${PKG}" ]]; then + elif [[ ! "${PKG}" =~ ^https?:\/\/.* ]] && [[ -f "${CONFIG_DIRECTORY}/dnf/${PKG}" ]]; then LOCAL_INSTALL=true - LOCAL_PKGS+=("${CONFIG_DIRECTORY}/rpm-ostree/${PKG}") + LOCAL_PKGS+=("${CONFIG_DIRECTORY}/dnf/${PKG}") else CLASSIC_INSTALL=true CLASSIC_PKGS+=("${PKG}") @@ -136,7 +157,7 @@ if [[ ${#INSTALL_PKGS[@]} -gt 0 && ${#REMOVE_PKGS[@]} -gt 0 ]]; then echo "Removing & Installing RPMs" echo "Removing: ${REMOVE_PKGS[*]}" echo_rpm_install - dnf -y "${WEAK_DEPS_FLAG}" remove "${REMOVE_PKGS[@]}" + dnf -y remove "${REMOVE_PKGS[@]}" dnf -y "${WEAK_DEPS_FLAG}" install --refresh "${INSTALL_PKGS[@]}" elif [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then echo "Installing RPMs" @@ -145,7 +166,7 @@ elif [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then elif [[ ${#REMOVE_PKGS[@]} -gt 0 ]]; then echo "Removing RPMs" echo "Removing: ${REMOVE_PKGS[*]}" - dnf -y "${WEAK_DEPS_FLAG}" remove "${REMOVE_PKGS[@]}" + dnf -y remove "${REMOVE_PKGS[@]}" fi get_json_array REPLACE 'try .["replace"][]' "$1" @@ -180,4 +201,4 @@ if [[ ${#REPLACE[@]} -gt 0 ]]; then dnf -y "${WEAK_DEPS_FLAG}" distro-sync --refresh --repo "${REPO}" "${PACKEGES[@]}" done -fi +fi \ No newline at end of file diff --git a/recipes/base.yml b/recipes/base.yml index 3892764e..31472387 100644 --- a/recipes/base.yml +++ b/recipes/base.yml @@ -79,15 +79,37 @@ modules: # Add negativo repo, modify its repo priority & replace some packages like HEIF & mesa # Remove chsh & install oversteer-udev rules, as I don't want to rely on potentially outdated RPM # The operations below cannot be covered in rpm-ostree module, so it's used as a script + - type: dnf + source: local + repos: + - https://negativo17.org/repos/fedora-multimedia.repo + - type: script snippets: - # Install Negativo repo - - echo -e "\033[90mInstalling Negativo repo\033[0m" - - curl -fLs --create-dirs https://negativo17.org/repos/fedora-multimedia.repo -o /etc/yum.repos.d/negativo17-fedora-multimedia.repo - - sed -i '0,/enabled=1/{s/enabled=1/enabled=1\npriority=90/}' /etc/yum.repos.d/negativo17-fedora-multimedia.repo + - sed -i '0,/enabled=1/{s/enabled=1/enabled=1\npriority=90/}' /etc/yum.repos.d/fedora-multimedia.repo # Replace Fedora packages with Negativos (Mesa & HEIF) - echo -e "\033[90mReplacing Fedora packages with Negativos\033[0m" - - rpm-ostree override replace --experimental --from repo='fedora-multimedia' libheif libva libva-intel-media-driver mesa-dri-drivers mesa-filesystem mesa-libEGL mesa-libGL mesa-libgbm mesa-libglapi mesa-libxatracker mesa-va-drivers mesa-vulkan-drivers + + - type: dnf + source: local + replace: + - from-repo: fedora-multimedia + packages: + - libheif + - libva + - libva-intel-media-driver + - mesa-dri-drivers + - mesa-filesystem + - mesa-libEGL + - mesa-libGL + - mesa-libgbm + - mesa-libglapi + - mesa-libxatracker + - mesa-va-drivers + - mesa-vulkan-drivers + + - type: script + snippets: # Remove chsh - echo -e "\033[90mRemoving chsh\033[0m" - rm /usr/bin/chsh @@ -104,7 +126,8 @@ modules: - echo -e "\033[90mRemove avif thumbnailer, as HEIF thumbnailer already covers it (not done in Ublue)\033[0m" - rm /usr/share/thumbnailers/avif.thumbnailer - - type: rpm-ostree + - type: dnf + source: local remove: - fdk-aac-free - ffmpeg-free @@ -163,6 +186,12 @@ modules: snippets: # Workaround non-working Chinese, Japanese & Korean fonts - ln -s "/usr/share/fonts/google-noto-sans-cjk-fonts" "/usr/share/fonts/noto-cjk" - # Workaround OpenCL bug - # https://github.com/ublue-os/main/pull/692 - - "rpm-ostree override replace --from repo='fedora' --experimental --remove=OpenCL-ICD-Loader ocl-icd || true" + + # Workaround OpenCL bug + - type: dnf + source: local + remove: + - OpenCL-ICD-Loader + install: + - ocl-icd + \ No newline at end of file diff --git a/recipes/module-recipes/dnf.yml b/recipes/module-recipes/dnf.yml index 6188ecd6..1251a077 100644 --- a/recipes/module-recipes/dnf.yml +++ b/recipes/module-recipes/dnf.yml @@ -49,6 +49,6 @@ modules: snippets: - "dnf -y install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" - "dnf -y install faad2" - - "dnf -y uninstall rpmfusion-free-release" + - "dnf -y remove rpmfusion-free-release" - "dnf -y copr enable sassam/dr14_tmeter" - "dnf -y install dr14_t.meter"