File dkms.spec of Package dkms
#
# spec file for package dkms (Version 2.1.1.2)
#
# norootforbuild
#
Summary: Dynamic Kernel Module Support Framework
Name: dkms
Version: 2.1.1.2
Release: 1
License: GPLv2+
Group: System/Kernel
BuildArch: noarch
Requires: sed gawk findutils modutils tar cpio gzip grep mktemp
Requires: bash > 1.99
URL: http://linux.dell.com/dkms
Source0: http://linux.dell.com/dkms/permalink/dkms-%{version}.tar.bz2
Source100: %{name}.changes
Source101: %{name}.rpmlintrc
Patch0: %{name}-add_remote_fs_to_init_script.diff
BuildRoot: %{_tmppath}/%{name}-%{version}
%description
This package contains the framework for the Dynamic Kernel Module Support (DKMS) method
for installing modules (or module packages as RPMs/DEBs/etc.) as originally developed by Dell.
%prep
%setup -q
%patch0 -p0
%build
%triggerpostun -- %{name} < 1.90.00-1
for dir in `find %{_localstatedir}/%{name} -type d -maxdepth 1 -mindepth 1`; do
mv -f $dir %{_localstatedir}/lib/%{name}
done
[ -e %{_sysconfdir}/dkms_framework.conf ] && ! [ -e %{_sysconfdir}/%{name}/framework.conf ] && mkdir %{_sysconfdir}/%{name} && cp -a %{_sysconfdir}/dkms_framework.conf %{_sysconfdir}/%{name}/framework.conf
arch_used=""
[ `uname -m` == "x86_64" ] && [ `cat /proc/cpuinfo | grep -c "Intel"` -gt 0 ] && arch_used="ia32e" || arch_used=`uname -m`
echo ""
echo "ALERT! ALERT! ALERT!"
echo ""
echo "You are using a version of DKMS which does not support multiple system"
echo "architectures. Your DKMS tree will now be modified to add this support."
echo ""
echo "The upgrade will assume all built modules are for arch: $arch_used"
current_kernel=`uname -r`
dkms_tree="%{_localstatedir}/lib/%{name}"
source_tree="%{_prefix}/src"
tmp_location="/tmp"
dkms_frameworkconf="%{_sysconfdir}/%{name}/framework.conf"
. $dkms_frameworkconf 2>/dev/null
echo ""
echo "Fixing directories."
for directory in `find $dkms_tree -type d -name "module" -mindepth 3 -maxdepth 4`; do
dir_to_fix=`echo $directory | sed 's#/module$##'`
echo "Creating $dir_to_fix/$arch_used..."
mkdir $dir_to_fix/$arch_used
mv -f $dir_to_fix/* $dir_to_fix/$arch_used 2>/dev/null
done
echo ""
echo "Fixing symlinks."
for symlink in `find $dkms_tree -type l -name "kernel*" -mindepth 2 -maxdepth 2`; do
symlink_kernelname=`echo $symlink | sed 's#.*/kernel-##'`
dir_of_symlink=`echo $symlink | sed 's#/kernel-.*$##'`
cd $dir_of_symlink
read_link="$symlink"
while [ -L "$read_link" ]; do
read_link=`ls -l $read_link | sed 's/.*-> //'`
done
if [ `echo $read_link | sed 's#/# #g' | wc -w | awk {'print $1'}` -lt 3 ]; then
echo "Updating $symlink..."
ln -sf $read_link/$arch_used kernel-$symlink_kernelname-$arch_used
rm -f $symlink
fi
cd -
done
echo ""
%install
make install-redhat DESTDIR=$RPM_BUILD_ROOT \
SBIN=$RPM_BUILD_ROOT%{_sbindir} \
VAR=$RPM_BUILD_ROOT%{_localstatedir}/lib/%{name} \
MAN=$RPM_BUILD_ROOT%{_mandir}/man8 \
ETC=$RPM_BUILD_ROOT%{_sysconfdir}/%{name} \
BASHDIR=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d \
LIBDIR=$RPM_BUILD_ROOT%{_prefix}/lib/%{name}
# create rcdkms_autoinstaller symlink for openSUSE
ln -sf /etc/init.d/dkms_autoinstaller $RPM_BUILD_ROOT/usr/sbin/rcdkms_autoinstaller
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_sbindir}/%{name}
%{_sbindir}/rcdkms_autoinstaller
%{_localstatedir}/lib/%{name}
%{_sysconfdir}/init.d/dkms_autoinstaller
%{_prefix}/lib/%{name}
%{_mandir}/*/*
%config(noreplace) %{_sysconfdir}/%{name}
%doc sample.spec sample.conf AUTHORS COPYING README.dkms
%doc sample-suse-9-mkkmp.spec sample-suse-10-mkkmp.spec
# these dirs are for plugins - owned by other packages
%dir %{_sysconfdir}/kernel
%dir %{_sysconfdir}/kernel/postinst.d
%dir %{_sysconfdir}/kernel/prerm.d
%{_sysconfdir}/kernel/postinst.d/%{name}
%{_sysconfdir}/kernel/prerm.d/%{name}
%config %{_sysconfdir}/bash_completion.d/%{name}
%dir %{_datadir}/apport/
%dir %{_datadir}/apport/package-hooks/
%{_datadir}/apport/package-hooks/dkms.py
%post
[ -e /sbin/dkms ] && mv -f /sbin/dkms /sbin/dkms.old 2>/dev/null
# enable on initial install
[ $1 -lt 2 ] && /sbin/chkconfig dkms_autoinstaller on ||:
%preun
# remove on uninstall
[ $1 -lt 1 ] && /sbin/chkconfig dkms_autoinstaller off ||:
%stop_on_removal
%postun
%insserv_cleanup
%changelog
* Sat Oct 9 2010 packman@links2linux.de - 2.1.1.2
- moved to packman repository
* Tue Feb 23 2010 AxelKoellhofer@web.de - 2.1.1.2
- updated to 2.1.1.2
- obsolete patch for init script removed (fixed upstream)
* Fri Feb 5 2010 AxelKoellhofer@web.de - 2.1.1.1
- updated to 2.1.1.1
- fixed init script dkms_autoinstaller (line 142, if - then - elif
without a command to be executed after the if statement)
- RPM group switched to "Sytstem/Kernel"
- added PreReqs for coreutils, /bin/sed and /usr/bin/grep on openSUSE =< 11.0