From d246bf823adcbc75236e2232bc99e7c7812a2a89 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 21:26:12 +0100 Subject: [PATCH] switched to dkms [release 2.4.0beta1.svn20080426-13mamba;Tue Jul 01 2014] --- cm2020.spec | 111 +++++++++++++++++++--------------------------------- 1 file changed, 41 insertions(+), 70 deletions(-) diff --git a/cm2020.spec b/cm2020.spec index 8c8cc8a..4c7db47 100644 --- a/cm2020.spec +++ b/cm2020.spec @@ -1,30 +1,6 @@ -# openmamba 2.6 kernel module specfile -# Copyright (C) 2004-2010 by Silvan Calarco -# -# To build for a specific target: -# -# rpm -ba --define="KERNEL_TARGET mamba" cm2020.spec -# -# default is "mamba" -# - -%define kernel_ver %{version} -%define build_version %{kernel_ver} -%define BUILD_CC %{_target_platform}-gcc -%define BUILD_CXX %{_target_platform}-g++ - -%if "%{?KERNEL_TARGET}" == "" - # build a mamba kernel by default - %define KERNEL_TARGET mamba -%endif - -%if "%{?KERNEL_VER}" == "" - %define KERNEL_VER %(uname -r | sed "s|\\([0-9.]*\\).*|\\1|" ) -%endif - Name: cm2020 Version: 2.4.0beta1.svn20080426 -Release: 12mamba +Release: 13mamba Summary: Driver for the Omnikey Cardman 2020 USB smart card reader Group: System/Kernel and Hardware/Drivers Vendor: openmamba @@ -36,80 +12,75 @@ Source: http://svn.gula.es/cm2020/cm2020-%{version}.tar.bz2 Patch0: %{name}-2.4.0beta1.svn20080426-kernel-2.6.37.patch Patch1: %{name}-2.4.0beta1.svn20080426-kernel-2.6.39.patch License: GPL +Obsoletes: kernel-mamba-64GB-cm2020 +Obsoletes: kernel-mamba-64GB-rt-cm2020 +Obsoletes: kernel-mamba-cm2020 +## AUTOBUILDREQ-BEGIN +## AUTOBUILDREQ-END +Requires(post): dkms BuildRoot: %{_tmppath}/%{name}-%{version}-root %description Driver for the Omnikey Cardman 2020 USB smart card reader. -%package -n kernel-%{KERNEL_TARGET}-cm2020 -Summary: Driver for the Omnikey Cardman 2020 USB smart card reader -Group: System/Kernel and Hardware/Drivers -Requires(pre): kernel-%{KERNEL_TARGET} >= %{KERNEL_VER} -Requires(pre): kernel-%{KERNEL_TARGET} <= %{KERNEL_VER}.255 -## KERNELOBSOLETES-BEGIN 3.4 -Obsoletes: kernel-%{KERNEL_TARGET}-cm2020 = 2.4.0beta1.svn20080426-9mamba -Obsoletes: kernel-%{KERNEL_TARGET}-cm2020 = 2.4.0beta1.svn20080426-10mamba -## KERNELOBSOLETES-END - -%description -n kernel-%{KERNEL_TARGET}-cm2020 -Driver for the Omnikey Cardman 2020 USB smart card reader. - %prep %setup -q -n %{name} %patch0 -p1 %patch1 -p1 -%if "%{?KERNEL_TARGET}" == "" - echo "No target specified, aborting." - exit 1 -%else - echo "I'm going to build module for a %{KERNEL_TARGET} kernel..." -%endif - cd src/cm2020 mv makefile.26 Makefile %build -# -# build for KERNEL_TARGET -# -BUILD_OPTS="CC=%{BUILD_CC} CXX=%{BUILD_CXX} %{_smp_mflags}" - -# build cm2020 module -make CROSS_COMPILE=%{_target_platform}- -C src/cm2020 \ - ${BUILD_OPTS} \ - KVER=%{KERNEL_VER}%{?KERNEL_TARGET} \ - KDIR=%{_prefix}/src/linux-%{KERNEL_VER}%{?KERNEL_TARGET} %install [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" -# install cm2020 module -install -D -m 0644 \ - src/cm2020/cardman.ko \ - %{buildroot}/lib/modules/%{KERNEL_VER}%{?KERNEL_TARGET}/extra/cardman.ko + +# dkms +install -d -m0755 %{buildroot}%{_prefix}/src/%{name}-%{version} +cp -a src/* %{buildroot}%{_prefix}/src/%{name}-%{version} +rm -rf %{buildroot}%{_prefix}/src/%{name}-%{version}/cm2020/.svn +cat > %{buildroot}%{_prefix}/src/%{name}-%{version}/dkms.conf << _EOF +PACKAGE_NAME=%{name} +PACKAGE_VERSION=%{version} +MAKE="make -C \${kernel_source_dir} SUBDIRS=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE_VERSION}/build/cm2020" +CLEAN="make -C \${kernel_source_dir} SUBDIRS=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE_VERSION}/build/cm2020 clean" +BUILT_MODULE_NAME=cardman +BUILT_MODULE_LOCATION=cm2020/ +DEST_MODULE_LOCATION=/extra/drivers/misc/ +REMAKE_INITRD=no +AUTOINSTALL=yes +_EOF %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" -%post -n kernel-%{KERNEL_TARGET}-cm2020 -# new install or upgrade -/sbin/depmod -a -F /boot/System.map-%{KERNEL_VER}%{?KERNEL_TARGET} \ - %{KERNEL_VER}%{?KERNEL_TARGET} >/dev/null 2>&1 +%preun +dkms remove -q -m %{name} -v %{version} --all --rpm_safe_upgrade : -%postun -n kernel-%{KERNEL_TARGET}-cm2020 -# erase this package -[ $1 -eq 0 ] && - /sbin/depmod -a -F /boot/System.map-%{KERNEL_VER}%{?KERNEL_TARGET} \ - %{KERNEL_VER}%{?KERNEL_TARGET} >/dev/null 2>&1 +%posttrans +if [ $1 -ge 1 ]; then + # clean any legacy alternatives symlink + dkms remove -q -m %{name} -v %{version} --all --rpm_safe_upgrade + dkms add -q -m %{name} -v %{version} + dkms install -q -m %{name} -v %{version} +fi : -%files -n kernel-%{KERNEL_TARGET}-cm2020 +%files %defattr(-,root,root) -/lib/modules/%{KERNEL_VER}%{?KERNEL_TARGET}/extra/cardman.ko +%dir %{_prefix}/src/%{name}-%{version} +%{_prefix}/src/%{name}-%{version}/cardman.h +%{_prefix}/src/%{name}-%{version}/dkms.conf +%dir %{_prefix}/src/%{name}-%{version}/cm2020 +%{_prefix}/src/%{name}-%{version}/cm2020/* %doc COPYING README %changelog +* Tue Jul 01 2014 Silvan Calarco 2.4.0beta1.svn20080426-13mamba +- switched to dkms + * Sun Sep 15 2013 Silvan Calarco 2.4.0beta1.svn20080426-12mamba - kernel 3.10 rebuild