Support building a spl-modules-dkms sub package

This commit adds support for building a spl-modules-dkms sub package
built around Dynamic Kernel Module Support. This is to allow building
packages using the DKMS infrastructure which is intended to ease the
burden of kernel version changes, upgrades, etc.

By default spl-modules-dkms-* sub package will be built as part of
the 'make rpm' target.  Alternately, you can build only the DKMS
module package using the 'make rpm-dkms' target.

Examples:

    # To build packaged binaries as well as a dkms packages
    $ ./configure && make rpm

    # To build only the packaged binary utilities and dkms packages
    $ ./configure && make rpm-utils rpm-dkms

Note: Only the RHEL 5/6, CHAOS 5, and Fedora distributions are
      supported for building the dkms sub package.

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue zfsonlinux/zfs#535
This commit is contained in:
Prakash Surya 2012-08-07 13:57:03 -07:00 committed by Brian Behlendorf
parent 476ff5a4da
commit d83d25c2f8
8 changed files with 201 additions and 10 deletions

View File

@ -14,6 +14,7 @@ SUBDIRS = $(USER_DIR) $(KERNEL_DIR)
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = autogen.sh spl.spec.in spl-modules.spec.in META DISCLAIMER EXTRA_DIST = autogen.sh spl.spec.in spl-modules.spec.in META DISCLAIMER
EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am
EXTRA_DIST += dkms.postinst
noinst_HEADERS = spl_config.h spl.release noinst_HEADERS = spl_config.h spl.release
distclean-local:: distclean-local::

View File

@ -80,11 +80,12 @@ target_triplet = @target@
DIST_COMMON = $(am__configure_deps) $(noinst_HEADERS) \ DIST_COMMON = $(am__configure_deps) $(noinst_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/PKGBUILD-spl-modules.in $(srcdir)/PKGBUILD-spl.in \ $(srcdir)/PKGBUILD-spl-modules.in $(srcdir)/PKGBUILD-spl.in \
$(srcdir)/spl-modules.spec.in $(srcdir)/spl.release.in \ $(srcdir)/dkms.conf.in $(srcdir)/spl-modules.spec.in \
$(srcdir)/spl.spec.in $(srcdir)/spl_config.h.in \ $(srcdir)/spl.release.in $(srcdir)/spl.spec.in \
$(top_srcdir)/config/arch.am $(top_srcdir)/config/deb.am \ $(srcdir)/spl_config.h.in $(top_srcdir)/config/arch.am \
$(top_srcdir)/config/rpm.am $(top_srcdir)/config/tgz.am \ $(top_srcdir)/config/deb.am $(top_srcdir)/config/rpm.am \
$(top_srcdir)/configure $(top_srcdir)/module/Makefile.in \ $(top_srcdir)/config/tgz.am $(top_srcdir)/configure \
$(top_srcdir)/module/Makefile.in \
$(top_srcdir)/module/spl/Makefile.in \ $(top_srcdir)/module/spl/Makefile.in \
$(top_srcdir)/module/splat/Makefile.in AUTHORS COPYING \ $(top_srcdir)/module/splat/Makefile.in AUTHORS COPYING \
ChangeLog INSTALL config/config.guess config/config.sub \ ChangeLog INSTALL config/config.guess config/config.sub \
@ -102,7 +103,7 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = spl_config.h CONFIG_HEADER = spl_config.h
CONFIG_CLEAN_FILES = module/Makefile module/spl/Makefile \ CONFIG_CLEAN_FILES = module/Makefile module/spl/Makefile \
module/splat/Makefile spl.spec spl-modules.spec PKGBUILD-spl \ module/splat/Makefile spl.spec spl-modules.spec PKGBUILD-spl \
PKGBUILD-spl-modules spl.release PKGBUILD-spl-modules spl.release dkms.conf
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
AM_V_GEN = $(am__v_GEN_$(V)) AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
@ -331,7 +332,7 @@ SUBDIRS = $(USER_DIR) $(KERNEL_DIR)
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = autogen.sh spl.spec.in spl-modules.spec.in META \ EXTRA_DIST = autogen.sh spl.spec.in spl-modules.spec.in META \
DISCLAIMER config/config.awk config/rpm.am config/deb.am \ DISCLAIMER config/config.awk config/rpm.am config/deb.am \
config/tgz.am config/tgz.am dkms.postinst
noinst_HEADERS = spl_config.h spl.release noinst_HEADERS = spl_config.h spl.release
all: spl_config.h all: spl_config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive $(MAKE) $(AM_MAKEFLAGS) all-recursive
@ -404,6 +405,8 @@ PKGBUILD-spl-modules: $(top_builddir)/config.status $(srcdir)/PKGBUILD-spl-modul
cd $(top_builddir) && $(SHELL) ./config.status $@ cd $(top_builddir) && $(SHELL) ./config.status $@
spl.release: $(top_builddir)/config.status $(srcdir)/spl.release.in spl.release: $(top_builddir)/config.status $(srcdir)/spl.release.in
cd $(top_builddir) && $(SHELL) ./config.status $@ cd $(top_builddir) && $(SHELL) ./config.status $@
dkms.conf: $(top_builddir)/config.status $(srcdir)/dkms.conf.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo
@ -852,13 +855,16 @@ srpm-utils:
srpm: srpm-modules srpm-utils srpm: srpm-modules srpm-utils
rpm-dkms: srpm-modules
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" dkms-common
rpm-modules: srpm-modules rpm-modules: srpm-modules
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common @CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
rpm-utils: srpm-utils rpm-utils: srpm-utils
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common @CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
rpm: rpm-modules rpm-utils rpm: rpm-modules rpm-utils rpm-dkms
rpm-local: rpm-local:
@(if test "${HAVE_RPMBUILD}" = "no"; then \ @(if test "${HAVE_RPMBUILD}" = "no"; then \
@ -877,6 +883,26 @@ rpm-local:
mkdir -p $(rpmbuild)/SOURCES && \ mkdir -p $(rpmbuild)/SOURCES && \
cp $(distdir).tar.gz $(rpmbuild)/SOURCES) cp $(distdir).tar.gz $(rpmbuild)/SOURCES)
dkms-common:
rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
rpmspec=$(pkg).spec; \
rpmdkms=$(pkg)-dkms-$(SPL_META_VERSION)-$(SPL_META_RELEASE).noarch.rpm;\
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
$(MAKE) $(AM_MAKEFLAGS) \
rpmbuild="$$rpmbuild" \
rpmspec="$$rpmspec" \
rpm-local || exit 1; \
$(RPMBUILD) \
--define "_tmppath $$rpmbuild/TMP" \
--define "_topdir $$rpmbuild" \
--define "dist %{nil}" \
--define "_without_kernel 1" \
--define "_without_kernel_debug 1" \
--define "_with_kernel_dkms 1" \
--nodeps --rebuild $$rpmpkg || exit 1; \
cp $$rpmbuild/RPMS/noarch/$$rpmdkms . || exit 1; \
$(RM) -R $$rpmbuild
srpm-common: dist srpm-common: dist
rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \ rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
rpmspec=$(pkg).spec; \ rpmspec=$(pkg).spec; \

View File

@ -18,6 +18,11 @@ endif
srpm: srpm-modules srpm-utils srpm: srpm-modules srpm-utils
rpm-dkms: srpm-modules
if CONFIG_KERNEL
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" dkms-common
endif
rpm-modules: srpm-modules rpm-modules: srpm-modules
if CONFIG_KERNEL if CONFIG_KERNEL
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
@ -28,7 +33,7 @@ if CONFIG_USER
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
endif endif
rpm: rpm-modules rpm-utils rpm: rpm-modules rpm-utils rpm-dkms
rpm-local: rpm-local:
@(if test "${HAVE_RPMBUILD}" = "no"; then \ @(if test "${HAVE_RPMBUILD}" = "no"; then \
@ -47,6 +52,26 @@ rpm-local:
mkdir -p $(rpmbuild)/SOURCES && \ mkdir -p $(rpmbuild)/SOURCES && \
cp $(distdir).tar.gz $(rpmbuild)/SOURCES) cp $(distdir).tar.gz $(rpmbuild)/SOURCES)
dkms-common:
rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
rpmspec=$(pkg).spec; \
rpmdkms=$(pkg)-dkms-$(SPL_META_VERSION)-$(SPL_META_RELEASE).noarch.rpm;\
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
$(MAKE) $(AM_MAKEFLAGS) \
rpmbuild="$$rpmbuild" \
rpmspec="$$rpmspec" \
rpm-local || exit 1; \
$(RPMBUILD) \
--define "_tmppath $$rpmbuild/TMP" \
--define "_topdir $$rpmbuild" \
--define "dist %{nil}" \
--define "_without_kernel 1" \
--define "_without_kernel_debug 1" \
--define "_with_kernel_dkms 1" \
--nodeps --rebuild $$rpmpkg || exit 1; \
cp $$rpmbuild/RPMS/noarch/$$rpmdkms . || exit 1; \
$(RM) -R $$rpmbuild
srpm-common: dist srpm-common: dist
rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \ rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
rpmspec=$(pkg).spec; \ rpmspec=$(pkg).spec; \

3
configure vendored
View File

@ -24169,7 +24169,7 @@ fi
ac_config_files="$ac_config_files Makefile lib/Makefile cmd/Makefile module/Makefile module/spl/Makefile module/splat/Makefile include/Makefile scripts/Makefile spl.spec spl-modules.spec PKGBUILD-spl PKGBUILD-spl-modules spl.release" ac_config_files="$ac_config_files Makefile lib/Makefile cmd/Makefile module/Makefile module/spl/Makefile module/splat/Makefile include/Makefile scripts/Makefile spl.spec spl-modules.spec PKGBUILD-spl PKGBUILD-spl-modules spl.release dkms.conf"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
@ -25091,6 +25091,7 @@ do
"PKGBUILD-spl") CONFIG_FILES="$CONFIG_FILES PKGBUILD-spl" ;; "PKGBUILD-spl") CONFIG_FILES="$CONFIG_FILES PKGBUILD-spl" ;;
"PKGBUILD-spl-modules") CONFIG_FILES="$CONFIG_FILES PKGBUILD-spl-modules" ;; "PKGBUILD-spl-modules") CONFIG_FILES="$CONFIG_FILES PKGBUILD-spl-modules" ;;
"spl.release") CONFIG_FILES="$CONFIG_FILES spl.release" ;; "spl.release") CONFIG_FILES="$CONFIG_FILES spl.release" ;;
"dkms.conf") CONFIG_FILES="$CONFIG_FILES dkms.conf" ;;
*) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}

View File

@ -59,6 +59,7 @@ AC_CONFIG_FILES([
PKGBUILD-spl PKGBUILD-spl
PKGBUILD-spl-modules PKGBUILD-spl-modules
spl.release spl.release
dkms.conf
]) ])
AC_OUTPUT AC_OUTPUT

23
dkms.conf.in Normal file
View File

@ -0,0 +1,23 @@
AUTOINSTALL="yes"
PACKAGE_NAME="@PACKAGE@"
PACKAGE_VERSION="@VERSION@"
PRE_BUILD="configure
--prefix=/usr
--with-config=kernel
--with-linux=$(case `lsb_release -is` in
(Debian) echo ${kernel_source_dir/%build/source} ;;
(*) echo ${kernel_source_dir} ;;
esac)
--with-linux-obj=${kernel_source_dir}
"
POST_INSTALL="dkms.postinst -a ${arch} -k ${kernelver} -t ${dkms_tree}
-n ${PACKAGE_NAME} -v ${PACKAGE_VERSION}
"
REMAKE_INITRD="no"
MAKE[0]="make"
BUILT_MODULE_NAME[0]="spl"
BUILT_MODULE_LOCATION[0]="module/spl/"
DEST_MODULE_LOCATION[0]="/extra/spl/spl"
BUILT_MODULE_NAME[1]="splat"
BUILT_MODULE_LOCATION[1]="module/splat/"
DEST_MODULE_LOCATION[1]="/extra/splat/splat"

24
dkms.postinst Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
PROG=$0
while getopts "a:k:n:t:v:" opt; do
case $opt in
a) arch=$OPTARG ;;
k) kver=$OPTARG ;;
n) pkgname=$OPTARG ;;
t) tree=$OPTARG ;;
v) pkgver=$OPTARG ;;
esac
done
if [ -z "${arch}" -o -z "${kver}" -o -z "${pkgname}" -o \
-z "${tree}" -o -z "${pkgver}" ]; then
echo "Usage: $PROG -a <arch> -k <kver> -n <pkgname>" \
"-t <tree> -v <pkgver>"
exit 1
fi
cp ${tree}/${pkgname}/${pkgver}/build/spl_config.h \
${tree}/${pkgname}/${pkgver}/build/module/Module.symvers \
${tree}/${pkgname}/${pkgver}/${kver}/${arch}/

View File

@ -44,6 +44,17 @@
%endif %endif
%endif %endif
# Set using 'rpmbuild ... --with kernel-dkms ...', defaults to disabled.
%if %{defined _with_kernel_dkms}
%define with_kernel_dkms 1
%else
%if %{defined _without_kernel_dkms}
%define with_kernel_dkms 0
%else
%define with_kernel_dkms 0
%endif
%endif
# Set using 'rpmbuild ... --with debug ...', defaults to disabled. # Set using 'rpmbuild ... --with debug ...', defaults to disabled.
%if %{defined _with_debug} %if %{defined _with_debug}
%define kdebug --enable-debug %define kdebug --enable-debug
@ -118,12 +129,15 @@
%define kpkg_kern kernel-%{kverextra} %define kpkg_kern kernel-%{kverextra}
%define kpkg_dbug %{nil} %define kpkg_dbug %{nil}
%define kpkg_dkms dkms
%define kdevpkg_kern kernel-source %define kdevpkg_kern kernel-source
%define kdevpkg_dbug %{nil} %define kdevpkg_dbug %{nil}
%define kdevpkg_dkms dkms
%define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/-%{kverextra}//g') %define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/-%{kverextra}//g')
%define kverpkg_dbug %{nil} %define kverpkg_dbug %{nil}
%define kverpkg_dkms 2.2.0.2
# The kernel and rpm versions do not strictly match under SLES11 # The kernel and rpm versions do not strictly match under SLES11
# e.g. kernel version 2.6.27.19-5 != rpm version 2.6.27.19-5.1 # e.g. kernel version 2.6.27.19-5 != rpm version 2.6.27.19-5.1
@ -165,10 +179,13 @@
%define kpkg_kern kernel %define kpkg_kern kernel
%define kpkg_dbug kernel-debug %define kpkg_dbug kernel-debug
%define kpkg_dkms dkms
%define kdevpkg_kern kernel-devel %define kdevpkg_kern kernel-devel
%define kdevpkg_dbug kernel-debug-devel %define kdevpkg_dbug kernel-debug-devel
%define kdevpkg_dkms dkms
%define kverpkg_dkms 2.2.0.2
%if %{defined el6} || %{defined ch5} %if %{defined el6} || %{defined ch5}
%define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/.%{_target_cpu}//g') %define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/.%{_target_cpu}//g')
%define kverpkg_dbug %(echo %{kver_dbug} | %{__sed} -e 's/.%{_target_cpu}//g' | %{__sed} -e 's/.debug//g') %define kverpkg_dbug %(echo %{kver_dbug} | %{__sed} -e 's/.%{_target_cpu}//g' | %{__sed} -e 's/.debug//g')
@ -216,10 +233,13 @@
%define kpkg_kern kernel %define kpkg_kern kernel
%define kpkg_dbug kernel-debug %define kpkg_dbug kernel-debug
%define kpkg_dkms dkms
%define kdevpkg_kern kernel-devel %define kdevpkg_kern kernel-devel
%define kdevpkg_dbug kernel-debug-devel %define kdevpkg_dbug kernel-debug-devel
%define kdevpkg_dkms dkms
%define kverpkg_dkms 2.2.0.2
%define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/.%{_target_cpu}//g') %define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/.%{_target_cpu}//g')
%define kverpkg_dbug %(echo %{kver_dbug} | %{__sed} -e 's/.%{_target_cpu}//g' | %{__sed} -e 's/.debug//g') %define kverpkg_dbug %(echo %{kver_dbug} | %{__sed} -e 's/.%{_target_cpu}//g' | %{__sed} -e 's/.debug//g')
@ -253,6 +273,7 @@
%define kverpkg_kern %{kver_kern} %define kverpkg_kern %{kver_kern}
%define kverpkg_dbug %{nil} %define kverpkg_dbug %{nil}
%define kverpkg_dkms %{nil}
%if %{undefined kdir} %if %{undefined kdir}
%define kdir_kern /lib/modules/%{kver_kern}/build %define kdir_kern /lib/modules/%{kver_kern}/build
@ -285,12 +306,16 @@
%if %{defined build_src_rpm} %if %{defined build_src_rpm}
%define rel_kern @SPL_META_RELEASE@ %define rel_kern @SPL_META_RELEASE@
%define rel_dbug @SPL_META_RELEASE@ %define rel_dbug @SPL_META_RELEASE@
%define rel_dkms @SPL_META_RELEASE@
%if %{defined kpkg_kern} %if %{defined kpkg_kern}
%define req_kern %{kpkg_kern} %define req_kern %{kpkg_kern}
%endif %endif
%if %{defined kpkg_dbug} %if %{defined kpkg_dbug}
%define req_dbug %{kpkg_dbug} %define req_dbug %{kpkg_dbug}
%endif %endif
%if %{defined kpkg_dkms}
%define req_dkms %{kpkg_dkms}
%endif
%if %{defined kdevpkg_kern} %if %{defined kdevpkg_kern}
%define devreq_kern %{kdevpkg_kern} %define devreq_kern %{kdevpkg_kern}
%endif %endif
@ -302,12 +327,16 @@
%define relext_dbug %(echo %{kverpkg_dbug} | %{__sed} -e 's/-/_/g') %define relext_dbug %(echo %{kverpkg_dbug} | %{__sed} -e 's/-/_/g')
%define rel_kern @SPL_META_RELEASE@_%{relext_kern} %define rel_kern @SPL_META_RELEASE@_%{relext_kern}
%define rel_dbug @SPL_META_RELEASE@_%{relext_dbug} %define rel_dbug @SPL_META_RELEASE@_%{relext_dbug}
%define rel_dkms @SPL_META_RELEASE@
%if %{defined kpkg_kern} %if %{defined kpkg_kern}
%define req_kern %{kpkg_kern} %{koppkg} %{kverpkg_kern} %define req_kern %{kpkg_kern} %{koppkg} %{kverpkg_kern}
%endif %endif
%if %{defined kpkg_dbug} %if %{defined kpkg_dbug}
%define req_dbug %{kpkg_dbug} %{koppkg} %{kverpkg_dbug} %define req_dbug %{kpkg_dbug} %{koppkg} %{kverpkg_dbug}
%endif %endif
%if %{defined kpkg_dkms}
%define req_dkms %{kpkg_dkms} >= %{kverpkg_dkms}
%endif
%if %{defined kdevpkg_kern} %if %{defined kdevpkg_kern}
%define devreq_kern %{kdevpkg_kern} %{koppkg} %{kverpkg_kern} %define devreq_kern %{kdevpkg_kern} %{koppkg} %{kverpkg_kern}
%endif %endif
@ -397,6 +426,30 @@ The %{name}-debug-devel package contains the header files and
Module{s}.symvers symbols needed for building additional modules which Module{s}.symvers symbols needed for building additional modules which
use %{name}-debug. use %{name}-debug.
%endif
%if %{?with_kernel_dkms}
%package dkms
Summary: Solaris Porting Layer Modules (DKMS)
Group: Utilities/System
Release: %{rel_dkms}
Provides: %{name}
BuildArch: noarch
%if %{defined req_dkms}
Requires: %{req_dkms}
%endif
%if %{defined kdevpkg_dkms}
BuildRequires: %{kdevpkg_dkms}
%endif
%description dkms
The %{name}-dkms package contains all the necessary pieces to build and
install Solaris Porting Layer (SPL) kernel modules with Dynamic Kernel
Modules Support (DKMS). The SPL modules emulate Solaris style primatives
in the the linux kernel. They include, but are not limited to: atomic,
condvar, debug, error, memory, kobject, kstat, mutex, rwlock, taskq,
thread, time, and vnode APIs.
%endif %endif
%prep %prep
@ -421,6 +474,16 @@ make DESTDIR=$RPM_BUILD_ROOT install
make make
make DESTDIR=$RPM_BUILD_ROOT install make DESTDIR=$RPM_BUILD_ROOT install
%endif
%if %{?with_kernel_dkms}
%configure --with-config=kernel \
%{kdebug} %{kdebug_log} %{kdebug_kmem} %{kdebug_kmem_tracking}
make dist
mkdir -p $RPM_BUILD_ROOT/%{_prefix}/src
tar -xf @PACKAGE@-%{version}.tar.gz -C $RPM_BUILD_ROOT/%{_prefix}/src
cp -af dkms.conf $RPM_BUILD_ROOT/%{_prefix}/src/@PACKAGE@-%{version}
%endif %endif
%clean %clean
@ -476,3 +539,30 @@ else
fi fi
%endif %endif
%if %{?with_kernel_dkms}
%files dkms
%defattr(-,root,root)
%{_prefix}/src/@PACKAGE@-%{version}/*
%post dkms
for POSTINST in %{_prefix}/lib/dkms/common.postinst; do
if [ -f $POSTINST ]; then
$POSTINST @PACKAGE@ %{version}
exit $?
fi
echo "WARNING: $POSTINST does not exist."
done
echo -e "ERROR: DKMS version is too old and @PACKAGE@ was not"
echo -e "built with legacy DKMS support."
echo -e "You must either rebuild @PACKAGE@ with legacy postinst"
echo -e "support or upgrade DKMS to a more current version."
exit 1
%preun dkms
echo -e
echo -e "Uninstall of @PACKAGE@ module (version %{version}) beginning:"
dkms remove -m @PACKAGE@ -v %{version} --all --rpm_safe_upgrade
exit 0
%endif