Accepting request 835986 from home:jirislaby:branches:Kernel:kdump

- add kdump-make-sure-that-initrd.target.wants-directory-exists.patch
  (bsc#1172670)
- clean up spec file
  * systemd is available on all distros the package builds on
  * use %cmake* macros for build/test/install
- use %systemd_ordering only if defined
- it now builds as back as SLE 12

OBS-URL: https://build.opensuse.org/request/show/835986
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=201
This commit is contained in:
Jiri Slaby 2020-09-29 05:53:11 +00:00 committed by Git OBS Bridge
parent 004160d078
commit 073c0edd32
3 changed files with 65 additions and 46 deletions

View File

@ -0,0 +1,38 @@
From: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Date: Wed, 29 Jul 2020 14:40:10 +0800
Subject: Make sure that initrd.target.wants directory exists
Git-repo: https://github.com/openSUSE/kdump.git
Git-commit: 506794bf323ceb27f4796e60e311fad11e6d6986
Patch-mainline: yes
References: bsc#1172670
Creation of symbolic link to kdump-save.service will fail if the directory
doesn't exists, and dump will not be captured because kdump-save.service is
never started.
The user will see the rescue mode prompt when the kernel crashed because
systemd will proceed to initrd-switch-root, which will fail (thus triggering
rescue mode) because kdump initrd does not setup /sysroot properly.
Reference: bsc#1172670
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
init/module-setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/init/module-setup.sh b/init/module-setup.sh
index 9c1e6feb..057e5800 100755
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -281,6 +281,7 @@ install() {
done
) > "$_d"/kdump.conf
+ mkdir -p "$initdir/$systemdsystemunitdir"/initrd.target.wants
ln_r "$systemdsystemunitdir"/kdump-save.service \
"$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
else
--
2.26.2

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Tue Sep 22 05:51:13 UTC 2020 - Jiri Slaby <jslaby@suse.com>
- add kdump-make-sure-that-initrd.target.wants-directory-exists.patch
(bsc#1172670)
- clean up spec file
* systemd is available on all distros the package builds on
* use %cmake* macros for build/test/install
- use %systemd_ordering only if defined
- it now builds as back as SLE 12
-------------------------------------------------------------------
Tue Jul 21 12:43:49 UTC 2020 - Thorsten Kukuk <kukuk@suse.com>

View File

@ -16,10 +16,6 @@
#
# on systemd distros, rpm-build requires systemd-rpm-macros,
# which in turn defines %%systemd_requires
%define systemd_present %{defined systemd_requires}
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir %{_localstatedir}/adm/fillup-templates
@ -68,6 +64,7 @@ Patch29: %{name}-prefer-by-path-and-device-mapper.patch
Patch30: %{name}-calibrate-Update-values.patch
Patch31: %{name}-activate-udev-rules-late-during-boot.patch
Patch32: %{name}-make-sure-that-the-udev-runtime-directory-exists.patch
Patch33: %{name}-make-sure-that-initrd.target.wants-directory-exists.patch
BuildRequires: asciidoc
BuildRequires: cmake
BuildRequires: gcc-c++
@ -79,6 +76,7 @@ BuildRequires: libopenssl-devel
BuildRequires: libxslt
BuildRequires: pkgconfig
BuildRequires: zlib-devel
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
#!BuildIgnore: fop
Requires: /usr/bin/sed
@ -95,15 +93,7 @@ Recommends: nfs-client
# update should detect the split-off from kexec-tools
Provides: kexec-tools:%{_initddir}/kdump
ExcludeArch: s390 ppc
%if %{systemd_present}
BuildRequires: pkgconfig(systemd)
%else
# FIXME: use proper Requires(pre/post/preun/...)
PreReq: %insserv_prereq
%endif
%if %{systemd_present}
%systemd_ordering
%endif
%{?systemd_ordering}
%description
kdump is a package that includes several scripts for kdump, including
@ -158,41 +148,38 @@ after a crash dump has occured.
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=gnu++98"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} ..
make %{?_smp_mflags}
%cmake
# for SLE_15
%if %{undefined cmake_build}
%define cmake_build make %{?_smp_mflags}
%define ctest cd build; ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags}
%define cmake_install DESTDIR=%{buildroot} make -C build %{?_smp_mflags} install
%endif
%cmake_build
%check
cd build
ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags}
%ctest
%install
DESTDIR=%{buildroot} make -C build %{?_smp_mflags} install
%cmake_install
# remove executable bit from non-binaries
chmod -x %{buildroot}/lib/kdump/setup-kdump.functions
# empty directory
mkdir -p %{buildroot}%{_localstatedir}/crash
# symlink for init script
%if %{systemd_present}
rm %{buildroot}%{_initddir}/boot.kdump
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rckdump
%else
rm %{buildroot}%{_prefix}/lib/systemd/system/kdump.service
rm %{buildroot}%{_prefix}/lib/systemd/system/kdump-early.service
ln -s ../..%{_initddir}/boot.kdump %{buildroot}%{_sbindir}/rckdump
%endif
%if %{systemd_present}
%pre
%service_add_pre kdump.service
%service_add_pre kdump-early.service
%endif
%post
# change only permission if the file exists before /etc/sysconfig/kdump
@ -201,7 +188,6 @@ change_permission=0
if [ ! -f %{_sysconfdir}/sysconfig/kdump ] ; then
change_permission=1
fi
%if %{systemd_present}
%{fillup_only -n kdump}
%service_add_post kdump.service
%service_add_post kdump-early.service
@ -209,9 +195,6 @@ fi
if [ -x %{_bindir}/systemctl ] && %{_bindir}/systemctl is-enabled kdump.service &>/dev/null ; then
%{_bindir}/systemctl reenable kdump.service || :
fi
%else
%{fillup_and_insserv -n kdump boot.kdump}
%endif
if [ "$change_permission" = 1 ]; then
chmod 0600 %{_sysconfdir}/sysconfig/kdump
fi
@ -223,25 +206,16 @@ fi
%preun
echo "Stopping kdump ..."
%if %{systemd_present}
%service_del_preun kdump.service
%service_del_preun kdump-early.service
%else
%stop_on_removal boot.kdump
%endif
%postun
# force regeneration of kdumprd
touch %{_sysconfdir}/sysconfig/kdump
# delete symbolic link
rm %{_localstatedir}/log/dump >/dev/null 2>&1 || true
%if %{systemd_present}
%service_del_postun kdump.service
%service_del_postun kdump-early.service
%else
%restart_on_update boot.kdump
%insserv_cleanup
%endif
# Compatibility cruft
# there is no %%license prior to SLE12
@ -273,12 +247,8 @@ rm %{_localstatedir}/log/dump >/dev/null 2>&1 || true
/lib/kdump/*
%dir /usr/lib/kdump
/usr/lib/kdump/70-kdump.rules
%if %{systemd_present}
%{_unitdir}/kdump.service
%{_unitdir}/kdump-early.service
%else
%{_sysconfdir}/init.d/boot.kdump
%endif
%{_sbindir}/rckdump
%changelog