############################################################################## # # # This spec file produces kernel modules _only_ for the # # currently running kernel. It sets _target_cpu also for # # the program itself but this is really only a side-effect. # # # # To build kernel modules only use these specs as follows: # # # # rpmbuild -bb --without main slmodem.spec # # # ############################################################################## # Generate version information for kernel modules %define kname %(echo `uname -r`) %define kver %(echo %{kname} | sed -e 's/smp//' -e 's/bigmem//' -e 's/enterprise//') %define ktype %(echo kernel-%{kname}|sed -e 's/%{kver}//' -e 's/-$//') %define krel %(echo %{kname}|tr - _) # Make an arch of packages to agree with that one of a target kernel # but first record a default one, without triggering a recursion, # to use as a fallback. %{expand: %%define TTCPU %{_target_cpu}} %define _target_cpu %(t=`[ -r /boot/kernel.h ] && sed -n '/^#define __MODULE_KERNEL_/{s///;s/ .*1$//p}' /boot/kernel.h`; [ "$t" ] && echo $t || echo %{TTCPU} ) %{?_without_main: %{expand: %%define kmods_only 1}} ############################################################################### # # Common Package Information # ############################################################################### Name: slmodem Version: 2.9.7 Release: 1 Distribution: Unknown License: SmartLink URL: ftp://ftp.smlink.com/linux/unsupported/ # Alternative: URL: http://linmodems.technion.ac.il/packages/smartlink/ Vendor: Smart Link Ltd. # # Source files (taken from $RPM_SOURCE_DIR) # Source0: %{name}-%{version}.tar.gz # Source1: slmodem.init Source2: slmodemd.config # # Patches (taken from $RPM_SOURCE_DIR)) # Patch0: slmodem-2.9.6-init.patch # # Build Requirements # #buildarch: noarch BuildRequires: kernel-source = %{kver} # Package preparation area BuildRoot: %{_tmppath}/%{name} ############################################################################### # # Package Information (Main) # ############################################################################### Summary: Driver for Smart Link HAMR5600 winmodem (user space) Group: System Environment/Driver AutoReq: 1 #PreReq: Describe dependencies to install this package (see %pre/%post) #Requires: Describe dependencies to use this package AutoProv: 1 #Provides: Describe what this package provides %description This is the Linux driver for the Smart Link Soft Modem HAMR5600 hardware. It provides a full-featured 56K Voice Fax Modem. This winmodem hardware is used e.g. in the IBM ThinkPad T30. This package includes the generic application (slmodemd) and the init script for it. %package modules-k.%{krel} ############################################################################### # # Subpackage Information (kernel module) # ############################################################################### Summary: Driver for Smart Link HAMR5600 winmodem (kernel space) Group: System Environment/Kernel Release: %{release} AutoReq: 0 #PreReq: Describe dependencies to install this subpackage (see %pre/%post) Requires: %{name} = %{version} Requires: %{ktype} = %{kver} AutoProv: 0 Obsoletes: kernel-module-%{name} #Provides: Describe what this subpackage provides %description modules-k.%{krel} This is the Linux driver for the Smart Link Soft Modem HAMR5600 hardware. It provides a full-featured 56K Voice Fax Modem. This winmodem hardware is used e.g. in the IBM ThinkPad T30. This package includes the hardware specific kernel-space drivers (slamr, slusb) and the device nodes for them. ############################################################################### # # Build Phase Information # ############################################################################### # Define %_make_cmd in $HOME/.rpmmacros to override the standard make %if !%{?_make_cmd:1}0 %define _make_cmd make %endif # Use '--define "_skip_build 1"' during package testing to skip build phases %if !%{?_skip_build:1}0 %prep # # Preparation (-bp): Unpack the source files to $RPM_BUILD_DIR... # %setup -q # ... apply patches %patch0 -p1 -b .perm %build # # Compilation (-bc): Configure and build sources in $RPM_BUILD_DIR # export KERNEL_VER=%{kver} %{_make_cmd} KERNEL_DIR=/lib/modules/%{kname}/build drivers %if %{?kmods_only:0}%{!?kmods_only:1} %{_make_cmd} KERNEL_DIR=/lib/modules/%{kname}/build %endif %install # # Installation (-bi): Copy data from build $RPM_BUILD_DIR to # package preparation area %{buildroot} # # "install" from Makefile is broken, so do everything by hand... rm -rf %{buildroot} %if %{?kmods_only:0}%{!?kmods_only:1} install -D -m 755 modem/slmodemd %{buildroot}/usr/sbin/slmodemd install -D -m 755 -d %{buildroot}/var/lib/slmodemd # Install service file and its configuration file install -D -p -m 755 \ scripts/slmodemd %{buildroot}%{_sysconfdir}/init.d/slmodemd install -D -p -m 644 \ %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/slmodemd %endif install -D -m 644 drivers/slamr.o %{buildroot}/lib/modules/%{kname}/misc/slamr.o install -D -m 644 drivers/slusb.o %{buildroot}/lib/modules/%{kname}/misc/slusb.o # Hack device for kppp mkdir -p %{buildroot}/dev ( cd %{buildroot}/dev && ln -sf ttySL0 modem ) %clean # # Installation cleanup: Delete package preparation area %{buildroot} # rm -rf %{buildroot} %else # !%{_skip_build} # Fix environment when build phases are skipped... %define _builddir %{_topdir}/BUILD/%{name}-%{version} %endif # !%{_skip_build} %if %{?kmods_only:0}%{!?kmods_only:1} %files ############################################################################### # # Packaging Phase Information (Main) # ############################################################################### # # Package Content # %defattr (-,root,root) # Documentation for this package (taken from $RPM_BUILD_DIR) %doc README README.1st Changes # Directories owned by this package %dir /var/lib/slmodemd # Files owned by this package (taken from %{buildroot} /usr/sbin/slmodemd %{_sysconfdir}/init.d/slmodemd %config %{_sysconfdir}/sysconfig/slmodemd # Devices %defattr (600,root,root) %dev (c, 212, 0) /dev/slamr0 %dev (c, 212, 1) /dev/slamr1 %dev (c, 212, 2) /dev/slamr2 %dev (c, 212, 3) /dev/slamr3 %dev (c, 213, 0) /dev/slusb0 %dev (c, 213, 1) /dev/slusb1 %dev (c, 213, 2) /dev/slusb2 %dev (c, 213, 3) /dev/slusb3 /dev/modem # # Package Installation Scripts # # NOTE: During "update" of a package the order of execution is # # %pre (NEW) # %post (NEW) # %preun (OLD) # %postun (OLD) # #%pre # Commands to execute before package is installed (see also Prereq:) # Parameter $1: 1 = install, 2 = update %post # Commands to execute after package is installed (see also Prereq:) # Parameter $1: 1 = install, 2 = update if [ $1 = 1 ]; then cat << EOF >> %{_sysconfdir}/modules.conf # added by slmodem package alias char-major-212 slamr alias char-major-213 slusb EOF fi %preun # Commands to execute before package is uninstalled # Parameter $1: 0 = remove, 1 = update service slmodemd stop || : modprobe -r slamr slusb || : if [ $1 = 0 ]; then egrep -ve 'added by slmodem package|alias char-major-212 slamr|alias char-major-213 slusb' %{_sysconfdir}/modules.conf >/tmp/modules.conf.slmodem$$ mv /tmp/modules.conf.slmodem$$ %{_sysconfdir}/modules.conf fi # /sbin/depmod -ae -F /boot/System.map-%{kname} %{kname} #%postun # Commands to execute after package is uninstalled # Parameter $1: 0 = remove, 1 = update %endif %files modules-k.%{krel} ############################################################################### # # Packaging Phase Information (Subpackage kernel module) # ############################################################################### # # Package Content # %defattr (-,root,root) # Directories owned by this package #%dir %{_datadir}/... # Files owned by this package (taken from %{buildroot}) /lib/modules/%{kname}/misc/slamr.o /lib/modules/%{kname}/misc/slusb.o # Documentation for this package (taken from $RPM_BUILD_DIR) #%doc ChangeLog # # Package Installation Scripts # # NOTE: During "update" of a package the order of execution is # # %pre (NEW) # %post (NEW) # %preun (OLD) # %postun (OLD) # #%pre modules-k.%{krel} # Commands to execute before package is installed (see also Prereq:) # Parameter $1: 1 = install, 2 = update %post modules-k.%{krel} # Commands to execute after package is installed (see also Prereq:) # Parameter $1: 1 = install, 2 = update /sbin/depmod -ae -F /boot/System.map-%{kname} %{kname} %preun modules-k.%{krel} # Commands to execute before package is uninstalled # Parameter $1: 0 = remove, 1 = update # /sbin/depmod -ae -F /boot/System.map-%{kname} %{kname} #%postun modules-k.%{krel} # Commands to execute after package is uninstalled # Parameter $1: 0 = remove, 1 = update ############################################################################### # # Package Change History # ############################################################################### %changelog * Thu May 6 2004 Michal Jaegermann 2.9.7-1 - update to 2.9.7 - delete /sbin/depmod runs from %preun scripts; no really useful function and only are causing troubles if a kernel was updated * Mon Feb 23 2004 Michal Jaegermann 2.9.6-1 - update to 2.9.6 - make config file into a separate source to keep changes to original tar files to minimum (they are not useful with 'rpmbuild -ta ...' anyway - sigh! ) - make '%preun' script to succeed even if stopping a service or removing old modules does not work; these actions are going to fail if we just replaced a kernel * Tue Jan 27 2004 Michal Jaegermann 2.9.5-2 - permission change option was not changing anything; make it to work * Tue Jan 13 2004 Michal Jaegermann 2.9.5-1 - update to version 2.9.5-1 - fixed read permission for doc files * Wed Dec 10 2003 Michal Jaegermann 2.9.3-2 - rewrote spec file to allow multiple module packages for different kernels - added a configuration file in /etc/sysconfig - startup script optionally modifies groups and permission on a modem pseudo-terminal * Fri Dec 5 2003 Michal Jaegermann 2.9.3-1 - updated to 2.9.3-1 - added "License" tag as required by newer rpm utility * Tue Nov 05 2003 Stefan Becker - The HW doesn't seem to like suspend. Added removal of the kernel modules when slmodemd is stopped, so HW can be kicked by restarting the service. * Mon Nov 04 2003 Stefan Becker - Initial version based on slmodem-2.9.2