Permalink
Browse files

Attempt to merge spec file with RHEL/Fedora/CentOS spec file. Ideally…

… it's better if everyone is using closer packaging
  • Loading branch information...
superm1 committed Sep 22, 2014
1 parent 910500d commit c663ff7290cb0aa13c3ea2a60557612635fc8d55
Showing with 126 additions and 45 deletions.
  1. +91 −18 dkms.spec
  2. +35 −27 dkms_autoinstaller
View
109 dkms.spec
@@ -1,12 +1,49 @@
%if 0%{?rhel} == 5
%define _sharedstatedir /var/lib
%endif
Summary: Dynamic Kernel Module Support Framework
Name: dkms
Version: [INSERT_VERSION_HERE]
Release: 1%{?dist}
License: GPLv2+
Group: System Environment/Base
BuildArch: noarch
Requires: sed gawk findutils modutils tar cpio gzip grep coreutils
URL: http://linux.dell.com/dkms
Source0: %{name}.service
Source1: %{name}_autoinstaller.init
Requires: coreutils
Requires: cpio
Requires: findutils
Requires: gawk
Requires: gcc
Requires: grep
Requires: gzip
Requires: kernel-devel
Requires: sed
Requires: tar
Requires: bash > 1.99
%if 0%{?fedora} || 0%{?rhel} >= 7
Requires: kmod
%else
Requires: module-init-tools
%endif
%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(postun): /sbin/service
%endif
# because Mandriva calls this package dkms-minimal
Provides: dkms-minimal = %{version}
URL: http://linux.dell.com/dkms
@@ -18,13 +55,13 @@ Requires: kernel-devel
%endif
%description
This package contains the framework for the Dynamic
Kernel Module Support (DKMS) method for installing
module RPMS as originally developed by Dell.
This package contains the framework for the Dynamic Kernel Module Support (DKMS)
method for installing module RPMS as originally developed by Dell.
%prep
%setup -q
%build
%triggerpostun -- %{name} < 1.90.00-1
@@ -84,25 +121,67 @@ make install-redhat DESTDIR=$RPM_BUILD_ROOT \
BASHDIR=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d \
LIBDIR=$RPM_BUILD_ROOT%{_prefix}/lib/%{name}
%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
# Systemd unit files
rm -rf %{buildroot}%{_initrddir}
mkdir -p %{buildroot}%{_unitdir}
install -p -m 644 -D %{SOURCE0} %{buildroot}%{_unitdir}/%{name}.service
%else
# Initscripts
mkdir -p %{buildroot}%{_initrddir}
install -p -m 755 -D %{SOURCE1} %{buildroot}%{_initrddir}/%{name}_autoinstaller
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
%post
%systemd_post %{name}_autoinstaller.service
%preun
%systemd_preun %{name}_autoinstaller.service
%postun
%systemd_postun %{name}_autoinstaller.service
%else
%post
# enable on initial install
[ $1 -lt 2 ] && /sbin/chkconfig dkms_autoinstaller on ||:
%preun
# remove on uninstall
[ $1 -lt 1 ] && /sbin/chkconfig dkms_autoinstaller off ||:
%endif
%files
%defattr(-,root,root)
%{_sbindir}/%{name}
%{_localstatedir}/lib/%{name}
%doc sample.spec sample.conf AUTHORS COPYING README.dkms
%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
%{_unitdir}/%{name}.service
%else
%{_initrddir}/%{name}_autoinstaller
%endif
%{_prefix}/lib/%{name}
%{_mandir}/*/*
%{_sbindir}/%{name}
%{_localstatedir}/lib/%{name}
%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
%{_sysconfdir}/init.d/dkms_autoinstaller
%{_sysconfdir}/kernel/postinst.d/%{name}
%{_sysconfdir}/kernel/prerm.d/%{name}
%{_sysconfdir}/bash_completion.d/%{name}
%if 0%{?suse_version}
%doc sample-suse-9-mkkmp.spec sample-suse-10-mkkmp.spec
# suse doesnt yet support /etc/kernel/{prerm.d,postinst.d}, but will fail build
# with unowned dirs if we dont own them ourselves
# when opensuse *does* add this support, we will need to BuildRequires kernel
@@ -111,16 +190,10 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_sysconfdir}/kernel/prerm.d
%endif
%post
# enable on initial install
[ $1 -lt 2 ] && /sbin/chkconfig dkms_autoinstaller on ||:
%preun
# remove on uninstall
[ $1 -lt 1 ] && /sbin/chkconfig dkms_autoinstaller off ||:
%changelog
* Mon Sept 22 2014 Mario Limonciello <Mario_Limonciello@dell.com>
- Merge with the spec file that has been adopted for RHEL/Fedora/CentOS.
* Sat Aug 22 2009 Matt Domsch <Matt_Domsch@dell.com> - 2.1.0.0-1
- update to latest upstream
- drop Requires: lsb. avoid calling rpm (recursively) if possible.
View
@@ -1,25 +1,27 @@
#!/bin/sh
#
# dkms_autoinstaller A service to automatically install DKMS modules
# for new kernels.
# chkconfig: 345 04 04
# description: An autoinstaller bootup service for DKMS
# dkms_autoinstaller - A service to automatically install DKMS modules for new kernels.
#
# chkconfig: 345 04 04
# description: Compiles and install kernel modules automatically for new \
# kernels at boot.
### BEGIN INIT INFO
# Provides: dkms_autoinstaller dkms
# Default-Start: 2 3 4 5
# Default-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Required-Start: $local_fs
# Required-Stop: $null
# Short-Description: Automatically install DKMS modules for new kernels
# Short-Description: DKMS kernel modules installer service
# Description: A service to automatically install DKMS modules for new kernels.
### END INIT INFO
test -f /usr/sbin/dkms || exit 0
if [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
#We only have these functions on debian/ubuntu
# so on other distros just stub them out
if [ ! -f /etc/debian_version ]; then
@@ -29,24 +31,30 @@ if [ ! -f /etc/debian_version ]; then
alias log_action_end_msg=log_end_msg
fi
if [ -n "$2" ]; then
kernel="$2"
else
kernel=`uname -r`
fi
exec="/usr/sbin/dkms"
prog=${exec##*/}
test -f $exec || exit 0
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
# See how we were called.
case "$1" in
start)
log_daemon_msg "dkms: running auto installation service for kernel $kernel"
dkms autoinstall --kernelver $kernel
log_end_msg $?
;;
stop|restart|force-reload|status|reload)
# ignore
;;
*)
echo "Usage: $0 {start}"
start)
if [ -n "$2" ]; then
kernel="$2"
else
kernel=`uname -r`
fi
log_daemon_msg "$prog: running auto installation service for kernel $kernel"
dkms autoinstall --kernelver $kernel
log_end_msg $?
;;
stop|restart|force-reload|status|reload)
# There is no stop action, this and the 04 priority during stop is
# added to make RHEL chkconfig happy.
# Ignore others on debian/ubuntu too
;;
*)
echo $"Usage: $0 {start}"
exit 2
esac
exit 0

0 comments on commit c663ff7

Please sign in to comment.