From 70af39999c681566bd1c66f23834daa37b996aaa Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Tue, 26 Sep 2023 12:02:11 -0500 Subject: [PATCH] fix: everything asus and surface (#73) Co-authored-by: RJ Trujillo --- .github/workflows/build.yml | 8 ++++++++ Containerfile.common | 27 ++++++++++++++++----------- Containerfile.nvidia | 7 ++++++- build-kmod-evdi.sh | 2 +- build-kmod-gasket.sh | 2 +- build-kmod-gcadapter_oc.sh | 2 +- build-kmod-nct6687d.sh | 2 +- build-kmod-nvidia.sh | 2 +- build-kmod-openrazer.sh | 2 +- build-kmod-openrgb.sh | 2 +- build-kmod-ryzen-smu.sh | 2 +- build-kmod-steamdeck.sh | 2 +- build-kmod-v4l2loopback.sh | 2 +- build-kmod-wl.sh | 2 +- build-kmod-xone.sh | 2 +- build-kmod-xpad-noone.sh | 2 +- build-kmod-xpadneo.sh | 2 +- build-prep.sh | 31 +++++++++++++++++++++---------- 18 files changed, 65 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1fe63e9..640e3822 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,14 @@ jobs: nvidia_version: 535 - cfile_suffix: nvidia nvidia_version: 0 + - kernel_flavor: asus + major_version: 37 + - kernel_flavor: surface + major_version: 37 + - kernel_flavor: surface + major_version: 39 + - kernel_flavor: surface + nvidia_version: 470 steps: # Checkout push-to-registry action GitHub repository - name: Checkout Push to Registry action diff --git a/Containerfile.common b/Containerfile.common index 51466c34..3ffce826 100644 --- a/Containerfile.common +++ b/Containerfile.common @@ -27,18 +27,23 @@ RUN /tmp/build-prep.sh RUN /tmp/build-ublue-os-akmods-addons.sh -RUN /tmp/build-kmod-gasket.sh -RUN /tmp/build-kmod-gcadapter_oc.sh -RUN /tmp/build-kmod-nct6687d.sh -RUN /tmp/build-kmod-openrazer.sh -RUN /tmp/build-kmod-openrgb.sh -RUN /tmp/build-kmod-ryzen-smu.sh -RUN /tmp/build-kmod-steamdeck.sh -RUN /tmp/build-kmod-v4l2loopback.sh -RUN /tmp/build-kmod-wl.sh - +# Set kernel name # Exclude negativo17 kmods from Fedora 39 -RUN if grep -qv "39" <<< ${FEDORA_MAJOR_VERSION}; then \ +RUN if grep -qv "surface" <<< "${KERNEL_FLAVOR}"; then \ + export KERNEL_NAME="kernel" \ + ; else \ + export KERNEL_NAME="kernel-surface" \ + ; fi && \ + /tmp/build-kmod-gasket.sh && \ + /tmp/build-kmod-gcadapter_oc.sh && \ + /tmp/build-kmod-nct6687d.sh && \ + /tmp/build-kmod-openrazer.sh && \ + /tmp/build-kmod-openrgb.sh && \ + /tmp/build-kmod-ryzen-smu.sh && \ + /tmp/build-kmod-steamdeck.sh && \ + /tmp/build-kmod-v4l2loopback.sh && \ + /tmp/build-kmod-wl.sh && \ + if grep -qv "39" <<< ${FEDORA_MAJOR_VERSION}; then \ /tmp/build-kmod-evdi.sh && \ /tmp/build-kmod-xpadneo.sh && \ /tmp/build-kmod-xpad-noone.sh && \ diff --git a/Containerfile.nvidia b/Containerfile.nvidia index 48f57b0c..85175c2b 100644 --- a/Containerfile.nvidia +++ b/Containerfile.nvidia @@ -32,7 +32,12 @@ RUN /tmp/build-prep.sh RUN /tmp/build-ublue-os-nvidia-addons.sh -RUN /tmp/build-kmod-nvidia.sh ${NVIDIA_MAJOR_VERSION} +RUN if grep -qv "surface" <<< "${KERNEL_FLAVOR}"; then \ + export KERNEL_NAME="kernel" \ + ; else \ + export KERNEL_NAME="kernel-surface" \ + ; fi && \ + /tmp/build-kmod-nvidia.sh ${NVIDIA_MAJOR_VERSION} RUN cp /tmp/ublue-os-nvidia-addons/rpmbuild/RPMS/noarch/ublue-os-nvidia-addons*.rpm \ /var/cache/rpms/ublue-os/ diff --git a/build-kmod-evdi.sh b/build-kmod-evdi.sh index c3f6f06c..f206afa5 100755 --- a/build-kmod-evdi.sh +++ b/build-kmod-evdi.sh @@ -6,7 +6,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-multimedia.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" diff --git a/build-kmod-gasket.sh b/build-kmod-gasket.sh index 979a0657..7a1254f9 100755 --- a/build-kmod-gasket.sh +++ b/build-kmod-gasket.sh @@ -5,7 +5,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" rpm-ostree install \ diff --git a/build-kmod-gcadapter_oc.sh b/build-kmod-gcadapter_oc.sh index ac9792a1..d174a48b 100755 --- a/build-kmod-gcadapter_oc.sh +++ b/build-kmod-gcadapter_oc.sh @@ -5,7 +5,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" rpm-ostree install \ diff --git a/build-kmod-nct6687d.sh b/build-kmod-nct6687d.sh index 39e25c07..9f1520bb 100755 --- a/build-kmod-nct6687d.sh +++ b/build-kmod-nct6687d.sh @@ -5,7 +5,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" diff --git a/build-kmod-nvidia.sh b/build-kmod-nvidia.sh index 16f0399d..2948701e 100755 --- a/build-kmod-nvidia.sh +++ b/build-kmod-nvidia.sh @@ -23,7 +23,7 @@ rpm-ostree install \ xorg-x11-drv-${NVIDIA_PACKAGE_NAME}-{,cuda,devel,kmodsrc,power}*:${NVIDIA_MAJOR_VERSION}.*.fc${RELEASE} # Either successfully build and install the kernel modules, or fail early with debug output -KERNEL_VERSION="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL_VERSION="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" NVIDIA_AKMOD_VERSION="$(basename "$(rpm -q "akmod-${NVIDIA_PACKAGE_NAME}" --queryformat '%{VERSION}-%{RELEASE}')" ".fc${RELEASE%%.*}")" NVIDIA_LIB_VERSION="$(basename "$(rpm -q "xorg-x11-drv-${NVIDIA_PACKAGE_NAME}" --queryformat '%{VERSION}-%{RELEASE}')" ".fc${RELEASE%%.*}")" NVIDIA_FULL_VERSION="$(rpm -q "xorg-x11-drv-${NVIDIA_PACKAGE_NAME}" --queryformat '%{EPOCH}:%{VERSION}-%{RELEASE}.%{ARCH}')" diff --git a/build-kmod-openrazer.sh b/build-kmod-openrazer.sh index c54ae849..b819ff0a 100755 --- a/build-kmod-openrazer.sh +++ b/build-kmod-openrazer.sh @@ -5,7 +5,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" diff --git a/build-kmod-openrgb.sh b/build-kmod-openrgb.sh index 7f1207f0..2120c23d 100755 --- a/build-kmod-openrgb.sh +++ b/build-kmod-openrgb.sh @@ -5,7 +5,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" rpm-ostree install \ diff --git a/build-kmod-ryzen-smu.sh b/build-kmod-ryzen-smu.sh index 1e930fd4..ea5228c8 100755 --- a/build-kmod-ryzen-smu.sh +++ b/build-kmod-ryzen-smu.sh @@ -5,7 +5,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" diff --git a/build-kmod-steamdeck.sh b/build-kmod-steamdeck.sh index 026cf02b..00933774 100755 --- a/build-kmod-steamdeck.sh +++ b/build-kmod-steamdeck.sh @@ -5,7 +5,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" rpm-ostree install \ diff --git a/build-kmod-v4l2loopback.sh b/build-kmod-v4l2loopback.sh index 7609b027..66cef2a8 100755 --- a/build-kmod-v4l2loopback.sh +++ b/build-kmod-v4l2loopback.sh @@ -4,7 +4,7 @@ set -oeux pipefail ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" diff --git a/build-kmod-wl.sh b/build-kmod-wl.sh index 1e7a6254..6081b43c 100755 --- a/build-kmod-wl.sh +++ b/build-kmod-wl.sh @@ -4,7 +4,7 @@ set -oeux pipefail ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" diff --git a/build-kmod-xone.sh b/build-kmod-xone.sh index 0fe8aa72..1c448143 100755 --- a/build-kmod-xone.sh +++ b/build-kmod-xone.sh @@ -6,7 +6,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-steam.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" diff --git a/build-kmod-xpad-noone.sh b/build-kmod-xpad-noone.sh index 78d83e49..3f44ef03 100755 --- a/build-kmod-xpad-noone.sh +++ b/build-kmod-xpad-noone.sh @@ -5,7 +5,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" diff --git a/build-kmod-xpadneo.sh b/build-kmod-xpadneo.sh index 145f4f53..d2776d53 100755 --- a/build-kmod-xpadneo.sh +++ b/build-kmod-xpadneo.sh @@ -6,7 +6,7 @@ set -oeux pipefail cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-steam.repo /etc/yum.repos.d/ ARCH="$(rpm -E '%_arch')" -KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RELEASE="$(rpm -E '%fedora')" diff --git a/build-prep.sh b/build-prep.sh index 21f4cffa..e12c95ee 100755 --- a/build-prep.sh +++ b/build-prep.sh @@ -18,7 +18,9 @@ fi mkdir -p /var/lib/alternatives # allow simple `dnf install` style commands to work (in some spec scripts) -ln -s /usr/bin/rpm-ostree /usr/bin/dnf +if [[ "${RELEASE}" -eq "37" ]]; then + ln -s /usr/bin/rpm-ostree /usr/bin/dnf +fi # enable more repos rpm-ostree install \ @@ -37,28 +39,37 @@ fi ### PREPARE CUSTOM KERNEL SUPPORT if [[ "asus" == "${KERNEL_FLAVOR}" ]]; then - echo "Installing ASUS Kernel:" && \ - rpm-ostree cliwrap install-to-root / && \ + echo "Installing ASUS Kernel:" + wget https://copr.fedorainfracloud.org/coprs/lukenukem/asus-kernel/repo/fedora-$(rpm -E %fedora)/lukenukem-asus-kernel-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_lukenukem-asus-kernel.repo + rpm-ostree cliwrap install-to-root / rpm-ostree override replace \ --experimental \ --from repo=copr:copr.fedorainfracloud.org:lukenukem:asus-kernel \ kernel \ kernel-core \ + kernel-devel \ + kernel-devel-matched \ kernel-modules \ kernel-modules-core \ - kernel-modules-extra \ - kernel-uki-virt + kernel-modules-extra elif [[ "surface" == "${KERNEL_FLAVOR}" ]]; then - echo "Installing Surface Kernel:" && \ + echo "Installing Surface Kernel:" + # Add Linux Surface repo + wget https://pkg.surfacelinux.com/fedora/linux-surface.repo -P /etc/yum.repos.d wget https://github.com/linux-surface/linux-surface/releases/download/silverblue-20201215-1/kernel-20201215-1.x86_64.rpm -O \ - /tmp/surface-kernel.rpm && \ - rpm-ostree cliwrap install-to-root / && \ + /tmp/surface-kernel.rpm + rpm-ostree cliwrap install-to-root / rpm-ostree override replace /tmp/surface-kernel.rpm \ --remove kernel-core \ - --remove kernel-devel-matched \ --remove kernel-modules \ --remove kernel-modules-extra \ - --install kernel-surface + --install kernel-surface \ + --install kernel-surface-core \ + --install kernel-surface-devel \ + --install kernel-surface-devel-matched \ + --install kernel-surface-modules \ + --install kernel-surface-modules-core \ + --install kernel-surface-modules-extra else echo "Default main kernel needs no customization." fi