%global commit0 f66dfdc8355564733affda615a86d8b95fb952d5 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) %define module comedi %define base_version 0.7.76.1 %define version %{base_version}.%{shortcommit0}git Name: %{module} Version: %{version} Release: 1.dkms%{?dist} URL: http://www.comedi.org/ Summary: Linux Control and Measurement Device Interface Kernel Drivers License: GPLv3 Packager: GA Group: System Environment/Base BuildArch: noarch Requires: dkms >= 1.00 Requires: bash Requires: kernel-headers Requires: kernel-devel Requires: gcc Requires: make # Because it is a git snapshot Requires: automake >= 1.6 Requires: autoconf >= 2.54 Source0: https://github.com/Linux-Comedi/%{name}/archive/%{commit0}/%{name}-%{base_version}.tar.gz Patch0: comedi-dkms.patch %description This package contains the kernel driver module from comedi.org wrapped for the DKMS framework. %prep %setup -n %{name}-%{commit0} -q %patch0 -p1 %install rm -rf %{buildroot} mkdir -p %{buildroot}/usr/src/%{module}-%{version}/ cp -rf * %{buildroot}/usr/src/%{module}-%{version} %clean rm -rf %{buildroot} %files %defattr(-,root,root) /usr/src/%{module}-%{version}/ %pre %post dkms add -m %{module} -v %{version} --rpm_safe_upgrade # try building it for the current kernel if [ `uname -r | grep -c "BOOT"` -eq 0 ] && [ -e /lib/modules/`uname -r`/build/include ]; then echo -e echo -e "Build of comedi module (version %{version}) beginning:" dkms build -m %{module} -v %{version} echo -e "Install of comedi module (version %{version}) beginning:" dkms install -m %{module} -v %{version} echo -e "Install of comedi module (version %{version}) complete." elif [ `uname -r | grep -c "BOOT"` -gt 0 ]; then echo -e "" echo -e "Module build for the currently running kernel was skipped since you" echo -e "are running a BOOT variant of the kernel." else echo -e "" echo -e "Module build for the currently running kernel was skipped since the" echo -e "kernel headers for this kernel do not seem to be installed." fi exit 0 %preun echo -e echo -e "Uninstall of comedi module (version %{version}) beginning:" dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade exit 0 %files %defattr(-,root,root) /usr/src/%{module}-%{version}/ %changelog * Thu Jul 25 2019 George A - 0.7.76.1-1dkms - 1st dkms release