# THIS PACKAGE REQUIRES dkms >= 1.90 and kernel_ppp_mppe RPMs to be INSTALLED # DO NOT ATTEMPT TO BUILD BEFORE INSTALLING THESE PACKAGES # Get the name of the kernel RPM to build against. # Use either the name of the running kernel, or use the value # of the `kernel' macro passed in from the command line. # e.g. rpmbuild -bb --define "kernel 2.4.20-28.8smp" kernel_ppp_mppe-modules.spec %define kernelname %{!?kernel:%(uname -r)}%{?kernel:%{kernel}} %define kernelrpm %(rpm -qf --queryformat '%%{NAME}-%%{VERSION}-%%{RELEASE}' /boot/vmlinuz-%{kernelname}) %define kernelver %(rpm -q --queryformat '%%{VERSION}' %{kernelrpm}) %define kernelrel %(rpm -q --queryformat '%%{RELEASE}' %{kernelrpm}) %define kernelarch %(rpm -q --queryformat '%%{ARCH}' %{kernelrpm}) %define kernelrpmname %(rpm -q --queryformat '%%{NAME}' %{kernelrpm}) %define kernelrpmver %(rpm -q --queryformat '%%{VERSION}-%%{RELEASE}' %{kernelrpm}) %define kernelsuffix %(echo '%{kernelrpmname}' | %{__sed} -e 's/kernel-\\?//') %define modulename kernel_ppp_mppe %define moduleversion %(rpm -q --queryformat '%%{VERSION}' %{modulename}) %define dkms_moduledir %{_var}/lib/dkms/%{modulename}/%{moduleversion} %define dkms_tarballdir %{dkms_moduledir}/tarball %define dkms_tarball %{dkms_tarballdir}/%{modulename}-%{moduleversion}-kernel%{kernelname}-%{kernelarch}.dkms.tar.gz Summary: Pre-built ppp_mppe modules for kernel %{kernelname}, %{kernelarch} architecture Name: %{modulename}-modules Version: %{kernelver} Release: %{kernelrel}%{kernelsuffix}.dkms%{moduleversion} License: Dual BSD/GPL Group: System Environment/Base Requires: dkms >= 1.90, bash, %{kernelrpmname} = %{kernelrpmver} BuildRequires: dkms >= 1.90, bash, %{kernelrpmname} = %{kernelrpmver}, %{modulename} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root/ BuildArch: %{kernelarch} Conflicts: %{modulename} = %{moduleversion} Provides: kernel-mppe %description This package contains the MPPE kernel module wrapped for the DKMS framework, pre-built for kernel %{kernelname}, %{kernelarch} architecture. %prep #echo "modulename = %{modulename}" #echo "moduleversion = %{moduleversion}" #echo "kernelname = %{kernelname}" #echo "kernelrpm = %{kernelrpm}" #echo "kernelver = %{kernelver}" #echo "kernelrel = %{kernelrel}" #echo "kernelarch = %{kernelarch}" #echo "kernelrpmname = %{kernelrpmname}" #echo "kernelrpmver = %{kernelrpmver}" %build # Make sure the target module is built if [ `%{_sbindir}/dkms status -m %{modulename} -v %{moduleversion} -k %{kernelname} -a %{kernelarch} | %{__grep} -E -c '(built|installed)'` -lt 1 ]; then %{_sbindir}/dkms build -m %{modulename} -v %{moduleversion} -k %{kernelname} -a %{kernelarch} fi # Create a binaries-only tarball for our modules %{_sbindir}/dkms mktarball -m %{modulename} -v %{moduleversion} -k %{kernelname} -a %{kernelarch} --binaries-only if [ ! -d %{dkms_tarballdir} ]; then echo "DKMS tarball directory not present: %{dkms_tarballdir}" 1>&2 exit 1 fi if [ ! -f %{dkms_tarball} ]; then echo "DKMS tarball not found: %{dkms_tarball}" 1>&2 echo "DKMS tarball directory contains the following:" 1>&2 ls -l %{dkms_tarballdir} 1>&2 exit 1 fi %install [ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf "$RPM_BUILD_ROOT" %{__install} -m 0755 -d $RPM_BUILD_ROOT%{dkms_tarballdir} %{__install} -m 0755 -d $RPM_BUILD_ROOT/usr/src/%{modulename}-%{moduleversion} %{__install} -m 0644 %{dkms_tarball} $RPM_BUILD_ROOT%{dkms_tarballdir} %{__install} -m 0644 /usr/src/%{modulename}-%{moduleversion}/dkms.conf $RPM_BUILD_ROOT/usr/src/%{modulename}-%{moduleversion} %clean [ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf "$RPM_BUILD_ROOT" %post %{_sbindir}/dkms ldtarball --archive %{dkms_tarball} --force %{_sbindir}/dkms install -m %{modulename} -v %{moduleversion} -k %{kernelname} -a %{kernelarch} %preun echo -e "" echo -e "Uninstall of %{modulename} module, version %{moduleversion} beginning for kernel %{kernelname} (%{kernelarch}):" %{_sbindir}/dkms remove -m %{modulename} -v %{moduleversion} -k %{kernelname} -a %{kernelarch} --rpm_safe_upgrade exit 0 %files %defattr(0644,root,root) %{dkms_tarball} /usr/src/%{modulename}-%{moduleversion}/dkms.conf %changelog * Sun Aug 29 2004 Paul Howarth - Add %%kernelsuffix to get smp etc. kernel RPM names right * Wed Jun 23 2004 Paul Howarth - use specific architecture support provided by dkms >= 1.90 * Thu Jun 17 2004 Paul Howarth - better detection of the RPM for the running kernel - can build modules for non-running but installed kernels, by specifying the kernel macro on the rpmbuild command line * Mon Jun 07 2004 Paul Howarth - Initial RPM version.