File lpcie-dkms.spec of Package lpcie-dkms
Summary: Kernel module for L Card PCI-Express boards
Name: lpcie-dkms
Version: 1.0.9
Release: 1
Vendor: L Card
URL: http://www.lcard.ru
License: GPL-2.0+
Group: System/Kernel
BuildArch: noarch
BuildRequires: kernel-devel
BuildRequires: dkms
Requires: dkms, bash, gcc, make
Source: lpcie-dkms_1.0.9.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root/
%description
This package contains linux kernel module for L Card PCI-Express
data acquisition boards wrapped for the DKMS framework.
%prep
%setup
%build
%install
if [ "$RPM_BUILD_ROOT" != "/" ]; then
rm -rf $RPM_BUILD_ROOT
fi
make install-src DESTDIR=$RPM_BUILD_ROOT
%clean
if [ "$RPM_BUILD_ROOT" != "/" ]; then
rm -rf $RPM_BUILD_ROOT
fi
%files
%defattr(-,root,root)
/usr/src/lpcie-%{version}/
%pre
%post
if [ -z "`dkms status -m lpcie -v %{version}`" ]; then
echo "Add module source to dkms"
dkms add -m lpcie -v %{version} --rpm_safe_upgrade
fi
# If we haven't loaded a tarball, then try building it for the current kernel
if [ `uname -r | grep -c "BOOT"` -eq 0 ] && [ -e /lib/modules/`uname -r`/build/include ]; then
dkms build -m lpcie -v %{version}
dkms install -m lpcie -v %{version}
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 source for this kernel does not seem to be installed."
fi
exit 0
%preun
echo -e
echo -e "Uninstall of lpcie module (version %{version}) beginning:"
dkms remove -m lpcie -v %{version} --all --rpm_safe_upgrade
exit 0