# source http://12244.wpc.azureedge.net/8012244/drivers/rtdrivers/cn/nic/0005-r8168-8.042.00.tar.bz2 %global module r8168 Name: dkms-%{module} Version: 8.042.00 Release: %mkrel 5 Source0: %{module}-%{version}.tar.xz Source1: linux-40.patch Source2: linux-47.patch Source3: linux-48.patch License: GPLv2 Group: System/Kernel and hardware URL: http://www.realtek.com.tw/ Summary: dkms package for %{module} driver Requires(post,preun): dkms BuildRoot: %defaultbuildroot BuildArch: noarch %description A kernel module for Realtek 8168 network cards %prep %setup -qn %{module}-%{version} find -type f -exec chmod 0644 {} \; %install %__rm -rf %{buildroot} %__install -Dm644 %{S:1} %{buildroot}%{_usrsrc}/%{module}-%{version}-%{release}/patches/linux-40.patch %__install -Dm644 %{S:2} %{buildroot}%{_usrsrc}/%{module}-%{version}-%{release}/patches/linux-47.patch %__install -Dm644 %{S:3} %{buildroot}%{_usrsrc}/%{module}-%{version}-%{release}/patches/linux-48.patch %__cp -a ./{autorun.sh,Makefile,src} %{buildroot}%{_usrsrc}/%{module}-%{version}-%{release} cat < %{buildroot}%{_usrsrc}/%{module}-%{version}-%{release}/dkms.conf PACKAGE_NAME="%{module}" PACKAGE_VERSION="%{version}-%{release}" BUILT_MODULE_NAME[0]="\$PACKAGE_NAME" BUILT_MODULE_LOCATION[0]="src/" DEST_MODULE_LOCATION[0]="/kernel/drivers/net/ethernet/realtek" PATCH[0]="linux-40.patch" PATCH_MATCH[0]="4\.0\.[1-9]" PATCH[1]="linux-47.patch" PATCH_MATCH[1]="4\.7\.[2-9]" PATCH[2]="linux-48.patch" PATCH_MATCH[2]="4\.8\.[1-9]" MAKE[0]="'make' clean KSRC=$kernel_source_dir EXTRA_CFLAGS='-DCONFIG_R8168_NAPI -DCONFIG_R8168_VLAN' modules" AUTOINSTALL="yes" CLEAN="make clean" EOF %clean %__rm -rf %{buildroot} %files %defattr(-,root,root) %doc README %{_usrsrc}/%{module}-%{version}-%{release} %post -n dkms-%{module} /usr/sbin/dkms --rpm_safe_upgrade add -m %{module} -v %{version}-%{release} /usr/sbin/dkms --rpm_safe_upgrade build -m %{module} -v %{version}-%{release} /usr/sbin/dkms --rpm_safe_upgrade install -m %{module} -v %{version}-%{release} if [ "$1" = 1 ]; then /sbin/rmmod r8169 >/dev/null 2>&1 /sbin/modprobe r8168 >/dev/null 2>&1 echo "Reloading network configuration ... " /sbin/service network reload >/dev/null 2>&1 echo "blacklist r8169" >> /etc/modprobe.d/blacklist echo "r8168" >> /etc/modprobe.preload echo -e \ '\n> The module r8168 conflicts with r8169. Module r8169 has just been blacklisted by adding it to > /etc/modprobe.d/blacklist file. Module r8168 will be loaded automatically at boot time from next boot. > Deinstallation of dkms-r8168 package will revert changes to a previous state.\n' fi %preun -n dkms-%{module} /usr/sbin/dkms --rpm_safe_upgrade remove -m %{module} -v %{version}-%{release} --all if [ "$1" = 0 ]; then /sbin/rmmod r8168 >/dev/null 2>&1 /sbin/modprobe r8169 >/dev/null 2>&1 echo "Reloading network configuration ... " /sbin/service network reload >/dev/null 2>&1 sed -i '/r8169/ d' /etc/modprobe.d/blacklist sed -i '/r8168/ d' /etc/modprobe.preload fi %changelog * Mon Oct 10 2016 onkelho 8.042.00-5pclos2016 - test rebuild on linux4.8.1 - rel4 add patch48 - rel5 %__install -Dm644 %{S:3}.... * Sun Aug 28 2016 marcin82 8.042.00-2pclos2016 - rebuilt and patched for kernel-4.7.2 * Sun May 22 2016 marcin82 8.042.00-1pclos2016 - update - changes in spec file * Fri Dec 15 2015 marcin82 8.041.00-2pclos2015 - amendment in dkms.conf file * Fri Dec 11 2015 marcin82 8.041.00-1pclos2015 - updated to new version, improvements in spec file * Fri Jul 24 2015 marcin82 8.040.00-2pclos2015 - updated dkms.conf for all 4.0.[1-9] kernels * Mon Jun 22 2015 marcin82 8.040.00-1pclos2015 - updated, improvements in spec file * Sun Apr 19 2015 marcin82 8.039.00-1pclos2015 - built for PCLinuxOS