File kdump.spec of Package kdump.624

# spec file for package kdump
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%define dracutlibdir %{_prefix}/lib/dracut

%{!?_udevdir: %global _udevdir %(pkg-config --variable=udevdir udev)}
%if "%{_udevdir}" == ""
%if 0%{?suse_version} >= 1230
%global _udevdir /usr/lib/udev
%global _udevdir /lib/udev
%define _udevrulesdir %{_udevdir}/rules.d


Name:           kdump
Version:        0.8.15
Release:        0
Requires:       curl
Requires:       makedumpfile
Requires:       openssh
Summary:        Script for kdump
License:        GPL-2.0+
Group:          System/Kernel
BuildRequires:  asciidoc
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libcurl-devel
BuildRequires:  libelf-devel
BuildRequires:  libesmtp-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libssh2-devel
BuildRequires:  libxslt
BuildRequires:  pkg-config
BuildRequires:  udev
BuildRequires:  zlib-devel
#!BuildIgnore:  fop
%if 0%{?suse_version} > 1220
BuildRequires:  systemd
PreReq:         %insserv_prereq %fillup_prereq
%if 0%{?suse_version} > 1310
PreReq:         dracut
PreReq:         mkinitrd
Source:         %{name}-%{version}.tar.bz2
Source2:        %{name}-rpmlintrc
Source3:        kdump.service
Patch0:         0001-multipath-Write-proper-regex-into-multipath-conf.patch
Patch1:         %{name}-use-fstab-device.patch
Patch2:         %{name}-count-framebuffer.patch
Patch3:         %{name}-count-const-slabs.patch
Patch4:         %{name}-remove-root-and-resume.patch
Patch5:         %{name}-systemd-support.patch
Patch6:         %{name}-calibrate-systemd-runtime.patch
Patch7:         %{name}-calibrate-systemd-initramfs.patch
Patch8:         %{name}-get-multipath-wwid-from-sysfs.patch
Patch9:         %{name}-split-kdump_default_netdev.patch
Patch10:        %{name}-move-network-setup-to-module-setup.patch
Patch11:        %{name}-add-IPv6-KDUMP_NETCONFIG-modes.patch
Patch12:        %{name}-enable-fadump-ppc64le.patch
Patch13:        %{name}-fadump-bootloader-always.patch
Patch14:        %{name}-bootloader-grub2.patch
Patch15:        %{name}-fadump-keep-sysroot.patch
Patch16:        %{name}-no-xen-secondary-kernel.patch
Patch17:        %{name}-always-pass-kernelver-to-dracut.patch
Patch18:        %{name}-root-parameter.patch
Patch19:        %{name}-device-timeout.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2)
Provides:       kdump-helpers = %{version}
Obsoletes:      kdump-helpers < %{version}
# update should detect the split-off from kexec-tools
Provides:       kexec-tools:/etc/init.d/kdump
Requires:       kexec-tools
%if 0%{?suse_version} > 1220
Recommends:     nfs-client cifs-utils
PreReq:         coreutils sed
ExcludeArch:    s390 ppc

kdump is a package that includes several scripts for kdump, including
the init script /etc/init.d/kdump and the configuration file for kdump.

The kernel package and this package are all that are required for a
crash dump to occur. However, if you wish to debug the crash dump
yourself you will need several debugging packages installed for each
kernel flavor and release you wish to debug.

For example, if you are debugging kernel-default, you will need:
- kernel-default-debuginfo
- kernel-default-devel
- kernel-default-devel-debuginfo

These packages are not needed to create the dump and can be installed
after a crash dump has occured.

    Bernhard Walle <>

%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1

export CFLAGS="%optflags"
export CXXFLAGS="%optflags"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} ..
cd -

cd build
make test

cd build
cd -
# move udev rules
mkdir -p $RPM_BUILD_ROOT/%{_udevrulesdir}
mv $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/* $RPM_BUILD_ROOT/%{_udevrulesdir}/
# remove executable bit from non-binaries
chmod -x $RPM_BUILD_ROOT/lib/kdump/setup-kdump.functions
# symlink for init script
mkdir -p $RPM_BUILD_ROOT/sbin
ln -s /etc/init.d/boot.kdump $RPM_BUILD_ROOT/sbin/rckdump
# empty directory
mkdir $RPM_BUILD_ROOT/var/crash
%if 0%{?suse_version} > 1310
rm -r $RPM_BUILD_ROOT/lib/mkinitrd

%if 0%{?suse_version} > 1220
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
install -m644 %{S:3} $RPM_BUILD_ROOT%{_unitdir}

%if 0%{?suse_version} > 1220
%service_add_pre kdump.service

# change only permission if the file exists before /etc/sysconfig/kdump
# has been created from /var/adm/fillup-templates/sysconfig.kdump
if [ ! -f /etc/sysconfig/kdump ] ; then
%{fillup_and_insserv -n kdump boot.kdump}
if (( $change_permission )) ; then
    chmod 0600 /etc/sysconfig/kdump
# if /var/log/dump is empty, make it a symlink to /var/crash
if test -d /var/log/dump && rmdir /var/log/dump &>/dev/null ||
        ! test -d /var/log/dump ; then
    ln -snf /var/crash /var/log/dump
%if 0%{?suse_version} > 1220
%service_add_post kdump.service

echo "Stopping kdump ..."
%stop_on_removal boot.kdump
%if 0%{?suse_version} > 1220
%service_del_preun kdump.service

# force regeneration of kdumprd
touch /etc/sysconfig/kdump
# delete symbolic link
rm /var/log/dump &>/dev/null || true
%restart_on_update boot.kdump
%if 0%{?suse_version} > 1220
%service_del_postun kdump.service


%if 0%{?suse_version} <= 1310
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%dir /lib/kdump
%if 0%{?suse_version} > 1220