%define real_name rtl8126 %global commit a77d4e6807a5fb19652325be6168c093847bce9b %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global gitdate 20241105 Summary: Driver for RTL8126 PCI Express 5 Gigabit Ethernet controllers Name: dkms-r8126 Version: 10.014.01 Release: 1.git%{gitdate}%{?dist} License: GPL-2.0-only Group: System Environment/Kernel URL: https://github.com/openwrt/rtl8126 Source0: https://github.com/openwrt/rtl8126/archive/%{commit}/r8126-%{shortcommit}.tar.gz Source1: r8169-blacklist.conf Source2: dkms-r8126.metainfo.xml BuildArch: noarch Requires: gcc Requires: make %if 0%{?el9} Requires: kernel-devel >= 5.14.0-82 %else Requires: kernel-devel %endif #Requires: bc Requires: kernel-modules Requires(post): dkms Requires(preun): dkms %description Linux Driver for USB RTL8126 PCI Express 5 Gigabit Ethernet controllers %prep %setup -q -n %{real_name}-%{commit} %build %install %{__rm} -rf %{buildroot} #blacklist r8169 module %__install -Dm0644 %{SOURCE1} -t %{buildroot}%{_sysconfdir}/modprobe.d #install appstream metainfo %__install -Dm0644 %{SOURCE2} -t %{buildroot}%{_metainfodir} %define dkms_name r8126 %define dkms_vers %{version}-%{release} %define quiet -q # Kernel module sources install for dkms %{__mkdir_p} %{buildroot}%{_usrsrc}/%{dkms_name}-%{dkms_vers}/ %{__cp} -a * %{buildroot}%{_usrsrc}/%{dkms_name}-%{dkms_vers}/ # Configuration for dkms %{__cat} <<'EOF' >%{buildroot}%{_usrsrc}/%{dkms_name}-%{dkms_vers}/dkms.conf PACKAGE_NAME=%{dkms_name} PACKAGE_VERSION=%{dkms_vers} MAKE[0]="'make' -j$(nproc) KVER=${kernelver}" CLEAN[0]="'make' clean" BUILT_MODULE_NAME[0]=%{dkms_name} DEST_MODULE_LOCATION[0]=/kernel/drivers/net AUTOINSTALL="YES" EOF %post # Add to DKMS registry dkms --rpm_safe_upgrade add -m %{dkms_name} -v %{dkms_vers} %{?quiet} || : # Rebuild and make available for the currenty running kernel dkms --rpm_safe_upgrade build -m %{dkms_name} -v %{dkms_vers} %{?quiet} || : dkms --rpm_safe_upgrade install -m %{dkms_name} -v %{dkms_vers} %{?quiet} --force || : %preun # Remove all versions from DKMS registry dkms --rpm_safe_upgrade remove -m %{dkms_name} -v %{dkms_vers} %{?quiet} --all || : %files %defattr(-, root, root, -) %{_usrsrc}/%{dkms_name}-%{dkms_vers}/ %{_sysconfdir}/modprobe.d/r8169-blacklist.conf %{_metainfodir}/*.metainfo.xml %changelog * Tue Nov 05 2024 Paweł Marciniak - 10.014.01-1.git20241105 - Update to v10.014.01 * Sat Aug 24 2024 Paweł Marciniak - 10.013.00-1 - Initial release