iscsitarget-kmp.spec 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. %define kmod_name ##KMOD_NAME##
  2. %define kmod_ver ##KMOD_VER##
  3. %define kversion %(uname -r)
  4. %define kver %(uname -r | sed -e 's/-/_/g')
  5. %define kflavor %(uname -r | sed -e 's/.*vl.//')
  6. %if "%kflavor" == ""
  7. %undefine kflavor
  8. %endif
  9. Name: kmod-%{kmod_name}%{?kflavor:-%{kflavor}}-source
  10. Version: %(echo %{kmod_ver} | sed -e 's/-.*//g')
  11. Release: %(echo %{kmod_ver} | sed -e 's/.*-//g')
  12. License: ##LICENSE##
  13. Group: System Environment/Kernel
  14. Summary: source of %{kmod_name} kernel module
  15. Source: %{kmod_name}-%{kmod_ver}.tar.bz2
  16. BuildRequires: dkms >= 2.0.21.1-2vl5
  17. BuildRoot: %{_tmppath}/%{name}-%{version}-root
  18. %description
  19. source of %{kmod_name} kernel module
  20. %package -n kmod-%{kmod_name}%{?kflavor:-%{kflavor}}
  21. Version: %(echo %{kmod_ver} | sed -e 's/-.*//g')_%{kver}
  22. Release: %(echo %{kmod_ver} | sed -e 's/.*-//g')
  23. Requires: kernel = %{kversion}
  24. Group: System Environment/Kernel
  25. Summary: prebuilt %{kmod_name} module for kernel %{version}%{?kflavor:-%{kflavor}}
  26. %description -n kmod-%{kmod_name}%{?kflavor:-%{kflavor}}
  27. source of prebuilt %{kmod_name} module for kernel %{version}%{?kflavor:-%{kflavor}}
  28. %prep
  29. %setup -q -n %{kmod_name}-%{kmod_ver}
  30. %build
  31. %install
  32. rm -rf %{buildroot}
  33. mkdir -p %{buildroot}/var/lib/dkms
  34. mkdir -p %{buildroot}/lib/modules/%{kversion}
  35. dkms add -m %{kmod_name} -v %{kmod_ver} -c dkms.conf \
  36. --dkmstree %{buildroot}/var/lib/dkms
  37. dkms build -m %{kmod_name} -v %{kmod_ver} -c dkms.conf \
  38. --dkmstree %{buildroot}/var/lib/dkms
  39. dkms install-fakeroot -m %{kmod_name} -v %{kmod_ver} -c dkms.conf \
  40. --dkmstree %{buildroot}/var/lib/dkms \
  41. --installtree %{buildroot}/lib/modules
  42. find %{buildroot}/lib/modules/%{kversion} -name "*.ko" | \
  43. sed -e "s|%{buildroot}||" > kmod.filelist
  44. rm -rf %{buildroot}/var
  45. %post -n kmod-%{kmod_name}%{?kflavor:-%{kflavor}}
  46. /sbin/depmod -a -F /boot/System.map-%{kversion} %{kversion}
  47. %files -n kmod-%{kmod_name}%{?kflavor:-%{kflavor}} -f kmod.filelist
  48. %defattr(-,root,root,0744)
  49. %changelog
  50. * Sun Apr 26 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org>
  51. - initial kmp spec file