Skip to content

Commit

Permalink
update & test
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftydinar authored Dec 23, 2024
1 parent 51ff8bc commit b5e102b
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 19 deletions.
39 changes: 30 additions & 9 deletions modules/dnf/dnf.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -33,21 +33,22 @@ 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
if [[ "${repo}" =~ ^https?:\/\/.* ]]; 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 }"
Expand Down Expand Up @@ -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}"

Expand All @@ -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}")
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -180,4 +201,4 @@ if [[ ${#REPLACE[@]} -gt 0 ]]; then
dnf -y "${WEAK_DEPS_FLAG}" distro-sync --refresh --repo "${REPO}" "${PACKEGES[@]}"

done
fi
fi
47 changes: 38 additions & 9 deletions recipes/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

2 changes: 1 addition & 1 deletion recipes/module-recipes/dnf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit b5e102b

Please sign in to comment.