Split out kdump-utils and makedumpfile

Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2024-04-25 13:18:23 +08:00
commit 28ced791b4
3 changed files with 200 additions and 199 deletions

134
kdump-utils.spec Normal file
View file

@ -0,0 +1,134 @@
Name: kdump-utils
Version: 1.0.42
Release: 10%{?dist}
Summary: Kernel crash dump collection utilities
License: GPL-2.0-only AND LGPL-2.1-or-later
URL: https://github.com/rhkdump/kdump-utils
Source0: https://github.com/rhkdump/kdump-utils/archive/v%{version}/%{name}-%{version}.tar.gz
%ifarch ppc64 ppc64le
Requires(post): servicelog
Recommends: keyutils
%endif
Requires(pre): coreutils
Requires(pre): sed
Requires: kexec-tools >= 2.0.28-8
Requires: makedumpfile
Requires: dracut >= 058
Requires: dracut-network >= 058
Requires: dracut-squash >= 058
Requires: ethtool
Requires: util-linux
# Needed for UKI support
Recommends: binutils
Recommends: grubby
Recommends: hostname
BuildRequires: make
BuildRequires: systemd-rpm-macros
%ifnarch s390x
Requires: systemd-udev%{?_isa}
%endif
%description
kdump-utils is responsible for collecting the crash kernel dump. It builds and
loads the kdump initramfs so when a kernel crashes, the system will boot the
kdump kernel and initramfs to save the collected crash kernel dump to specified
target.
%prep
%autosetup
%install
%make_install sbindir=%_sbindir
%post
# don't try to systemctl preset the kdump service for old kexec-tools
#
# when the old kexec-tools gets removed, this trigger will be excuted to
# create a file. So later the posttrans scriptlet will know there is no need to
# systemctl preset the kdump service.
# This solution can be dropped in F41 when we assume no users will use old
# version of kexec-tools.
%define kexec_tools_no_preset %{_localstatedir}/lib/rpm-state/kexec-tools.no-preset
%triggerun -- kexec-tools
touch %{kexec_tools_no_preset}
touch /etc/kdump.conf
%ifarch ppc64 ppc64le
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null
servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin >/dev/null
%endif
%postun
%systemd_postun_with_restart kdump.service
%preun
%ifarch ppc64 ppc64le
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh >/dev/null
%endif
%systemd_preun kdump.service
%posttrans
# don't try to systemctl preset the kdump service for old kexec-tools
if [[ -f %{kexec_tools_no_preset} ]]; then
# this if branch can be removed in F41 when we assume no users will use the old kexec-tools
rm %{kexec_tools_no_preset}
else
# Initial installation
%systemd_post kdump.service
fi
# Try to reset kernel crashkernel value to new default value or set up
# crasherkernel value for new install
#
# Note
# 1. Skip ostree systems as they are not supported.
# 2. For Fedora 36 and RHEL9, "[ $1 == 1 ]" in posttrans scriptlet means both install and upgrade;
# For Fedora > 36, "[ $1 == 1 ]" only means install and "[ $1 == 2 ]" means upgrade
if [ ! -f /run/ostree-booted ] && [ $1 == 1 -o $1 == 2 ]; then
kdumpctl _reset-crashkernel-after-update
:
fi
%files
%ifarch ppc64 ppc64le
%{_sbindir}/mkfadumprd
%{_prefix}/lib/kernel/install.d/60-fadump.install
%endif
%{_bindir}/kdumpctl
%{_sbindir}/mkdumprd
%{_prefix}/lib/kdump
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump
%config(noreplace,missingok) %verify(not mtime) %{_sysconfdir}/kdump.conf
%ifnarch s390x
%{_udevrulesdir}
%{_udevrulesdir}/../kdump-udev-throttler
%endif
%{_prefix}/lib/dracut/modules.d/*
%dir %{_localstatedir}/crash
%dir %{_sysconfdir}/kdump
%dir %{_sysconfdir}/kdump/pre.d
%dir %{_sysconfdir}/kdump/post.d
%dir %{_sharedstatedir}/kdump
%{_mandir}/man8/kdumpctl.8*
%{_mandir}/man8/mkdumprd.8*
%{_mandir}/man5/kdump.conf.5*
%{_unitdir}/kdump.service
%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
%{_prefix}/lib/kernel/install.d/60-kdump.install
%{_prefix}/lib/kernel/install.d/92-crashkernel.install
%license COPYING
%doc kexec-kdump-howto.txt
%doc early-kdump-howto.txt
%doc fadump-howto.txt
%doc kdump-in-cluster-environment.txt
%doc live-image-kdump-howto.txt
%doc crashkernel-howto.txt
%doc supported-kdump-targets.txt
%changelog
* Tue Oct 24 2023 Coiby <coxu@redhat.com> - 1.0.42-10
- split from kexec-tools

View file

@ -1,21 +1,12 @@
%global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
%global mkdf_ver 1.7.5
%global kdump_utils_ver 1.0.42
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
Name: kexec-tools
Version: 2.0.28
Release: 9%{?dist}
Release: 10%{?dist}
URL: https://kernel.org/pub/linux/utils/kernel/kexec
License: GPL-2.0-only
Summary: The kexec/kdump userspace component
Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
Recommends: kdump-utils
Source1: https://github.com/rhkdump/kdump-utils/archive/v%{kdump_utils_ver}/kdump-utils-%{kdump_utils_ver}.tar.gz
Source9: https://github.com/makedumpfile/makedumpfile/archive/%{mkdf_ver}/makedumpfile-%{mkdf_shortver}.tar.gz
Source19: https://github.com/lucchouina/eppic/archive/%{eppic_ver}/eppic-%{eppic_shortver}.tar.gz
BuildRequires: automake
BuildRequires: autoconf
@ -61,79 +52,10 @@ normal or a panic reboot. This package contains the /sbin/kexec
binary and ancillary utilities that together form the userspace
component of the kernel's kexec feature.
%package -n makedumpfile
Version: %{mkdf_ver}
Summary: make a small dumpfile of kdump
License: GPL-2.0-only
URL: https://github.com/makedumpfile/makedumpfile
Conflicts: kexec-tools < 2.0.28-5
BuildRequires: make
BuildRequires: gcc
BuildRequires: zlib-devel
BuildRequires: elfutils-devel
BuildRequires: glib2-devel
BuildRequires: bzip2-devel
BuildRequires: ncurses-devel
BuildRequires: bison
BuildRequires: flex
BuildRequires: lzo-devel
BuildRequires: snappy-devel
BuildRequires: libzstd-devel
BuildRequires: pkgconfig
BuildRequires: intltool
BuildRequires: gettext
%description -n makedumpfile
makedumpfile is a tool to compress and filter out unneeded data from kernel
dumps to reduce its file size. It is typically used with the kdump mechanism.
%package -n kdump-utils
Version: 1.0.42
License: GPL-2.0-only AND LGPL-2.1-or-later
URL: https://github.com/rhkdump/kdump-utils
Summary: Kernel crash dump collection utilities
%ifarch ppc64 ppc64le
Requires(post): servicelog
Recommends: keyutils
%endif
Requires(pre): coreutils
Requires(pre): sed
Requires: kexec-tools >= 2.0.28-8
Requires: makedumpfile
Requires: dracut >= 058
Requires: dracut-network >= 058
Requires: dracut-squash >= 058
Requires: ethtool
Requires: util-linux
# Needed for UKI support
Recommends: binutils
Recommends: grubby
Recommends: hostname
BuildRequires: systemd-rpm-macros
%ifnarch s390x
Requires: systemd-udev%{?_isa}
%endif
%description -n kdump-utils
kdump-utils is responsible for collecting the crash kernel dump. It builds and
loads the kdump initramfs so when a kernel crashes, the system will boot the
kdump kernel and initramfs to save the collected crash kernel dump to specified
target.
%prep
%setup -q
tar -z -x -v -f %{SOURCE1}
mkdir -p -m755 kcp
tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
%patch 101 -p1
%patch 601 -p1
@ -142,8 +64,6 @@ tar -z -x -v -f %{SOURCE19}
%define archdef ARCH=ppc
%endif
sed -r -i 's|/usr/sbin|%_sbindir|g' makedumpfile-*/Makefile
%build
autoreconf
%configure \
@ -159,80 +79,10 @@ autoreconf
rm -f kexec-tools.spec.in
%make_build
# makedumpfile
make -C eppic-%{eppic_ver}/libeppic
make -C makedumpfile-%{mkdf_ver} LINKTYPE=dynamic USELZO=on USESNAPPY=on USEZSTD=on
make -C makedumpfile-%{mkdf_ver} LDFLAGS="$LDFLAGS -I../eppic-%{eppic_ver}/libeppic -L../eppic-%{eppic_ver}/libeppic" eppic_makedumpfile.so
%install
%make_install
rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
# kdump-utils
%define kdump_utils_dir kdump-utils-%{kdump_utils_ver}
%make_install -C %kdump_utils_dir sbindir=%_sbindir
# makedumpfile
make DESTDIR=%{buildroot} -C makedumpfile-%{mkdf_ver} install
install -m 644 -D makedumpfile-%{mkdf_ver}/makedumpfile.conf %{buildroot}/%{_sysconfdir}/makedumpfile.conf.sample
rm %{buildroot}/%{_sbindir}/makedumpfile-R.pl
install -m 755 -D makedumpfile-%{mkdf_ver}/eppic_makedumpfile.so %{buildroot}/%{_libdir}/eppic_makedumpfile.so
%post -n kdump-utils
# don't try to systemctl preset the kdump service for old kexec-tools
#
# when the old kexec-tools gets removed, this trigger will be excuted to
# create a file. So later the posttrans scriptlet will know there is no need to
# systemctl preset the kdump service.
# This solution can be dropped in F41 when we assume no users will use old
# version of kexec-tools.
%define kexec_tools_no_preset %{_localstatedir}/lib/rpm-state/kexec-tools.no-preset
%triggerun -- kexec-tools
touch %{kexec_tools_no_preset}
touch /etc/kdump.conf
%ifarch ppc64 ppc64le
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null
servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin >/dev/null
%endif
:
%postun -n kdump-utils
%systemd_postun_with_restart kdump.service
%preun -n kdump-utils
%ifarch ppc64 ppc64le
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh >/dev/null
%endif
%systemd_preun kdump.service
%posttrans -n kdump-utils
# don't try to systemctl preset the kdump service for old kexec-tools
if [[ -f %{kexec_tools_no_preset} ]]; then
# this if branch can be removed in F41 when we assume no users will use the old kexec-tools
rm %{kexec_tools_no_preset}
else
# Initial installation
%systemd_post kdump.service
fi
# Try to reset kernel crashkernel value to new default value or set up
# crasherkernel value for new install
#
# Note
# 1. Skip ostree systems as they are not supported.
# 2. For Fedora 36 and RHEL9, "[ $1 == 1 ]" in posttrans scriptlet means both install and upgrade;
# For Fedora > 36, "[ $1 == 1 ]" only means install and "[ $1 == 2 ]" means upgrade
if [ ! -f /run/ostree-booted ] && [ $1 == 1 -o $1 == 2 ]; then
kdumpctl _reset-crashkernel-after-update
:
fi
%files
%{_sbindir}/kexec
@ -243,55 +93,10 @@ fi
%license COPYING
%doc TODO
%files -n kdump-utils
%ifarch ppc64 ppc64le
%{_sbindir}/mkfadumprd
%{_prefix}/lib/kernel/install.d/60-fadump.install
%endif
%{_bindir}/kdumpctl
%{_sbindir}/mkdumprd
%{_sbindir}/vmcore-dmesg
%{_prefix}/lib/kdump
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump
%config(noreplace,missingok) %verify(not mtime) %{_sysconfdir}/kdump.conf
%ifnarch s390x
%{_udevrulesdir}
%{_udevrulesdir}/../kdump-udev-throttler
%endif
%{_prefix}/lib/dracut/modules.d/*
%dir %{_localstatedir}/crash
%dir %{_sysconfdir}/kdump
%dir %{_sysconfdir}/kdump/pre.d
%dir %{_sysconfdir}/kdump/post.d
%dir %{_sharedstatedir}/kdump
%{_mandir}/man8/kdumpctl.8*
%{_mandir}/man8/mkdumprd.8*
%{_mandir}/man5/kdump.conf.5*
%{_unitdir}/kdump.service
%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
%{_prefix}/lib/kernel/install.d/60-kdump.install
%{_prefix}/lib/kernel/install.d/92-crashkernel.install
%license %kdump_utils_dir/COPYING
%doc %kdump_utils_dir/kexec-kdump-howto.txt
%doc %kdump_utils_dir/early-kdump-howto.txt
%doc %kdump_utils_dir/fadump-howto.txt
%doc %kdump_utils_dir/kdump-in-cluster-environment.txt
%doc %kdump_utils_dir/live-image-kdump-howto.txt
%doc %kdump_utils_dir/crashkernel-howto.txt
%doc %kdump_utils_dir/supported-kdump-targets.txt
%files -n makedumpfile
%license makedumpfile-%{mkdf_ver}/COPYING
%{_sbindir}/makedumpfile
%{_mandir}/man5/makedumpfile.conf.5.*
%{_mandir}/man8/makedumpfile.8.*
%{_sysconfdir}/makedumpfile.conf.sample
%{_libdir}/eppic_makedumpfile.so
%{_datadir}/makedumpfile/
%changelog
* Thu Apr 25 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-10
- Split out kdump-utils and makedumpfile
* Thu Apr 25 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-9
- Update to makedumpfile-1.7.5

62
makedumpfile.spec Normal file
View file

@ -0,0 +1,62 @@
%global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
Name: makedumpfile
Version: 1.7.5
Summary: make a small dumpfile of kdump
Release: 10%{?dist}
License: GPL-2.0-only
URL: https://github.com/makedumpfile/makedumpfile
Source0: https://github.com/makedumpfile/makedumpfile/archive/%{version}/%{name}-%{version}.tar.gz
Source1: https://github.com/lucchouina/eppic/archive/%{eppic_ver}/eppic-%{eppic_shortver}.tar.gz
Conflicts: kexec-tools < 2.0.28-5
BuildRequires: make
BuildRequires: gcc
BuildRequires: zlib-devel
BuildRequires: elfutils-devel
BuildRequires: glib2-devel
BuildRequires: bzip2-devel
BuildRequires: ncurses-devel
BuildRequires: bison
BuildRequires: flex
BuildRequires: lzo-devel
BuildRequires: snappy-devel
BuildRequires: libzstd-devel
BuildRequires: pkgconfig
BuildRequires: intltool
BuildRequires: gettext
%description
makedumpfile is a tool to compress and filter out unneeded data from kernel
dumps to reduce its file size. It is typically used with the kdump mechanism.
%prep
%autosetup -p1
tar -z -x -v -f %{SOURCE1}
sed -r -i 's|/usr/sbin|%_sbindir|g' Makefile
%build
%make_build LINKTYPE=dynamic USELZO=on USESNAPPY=on USEZSTD=on
%make_build -C eppic-%{eppic_ver}/libeppic
%make_build LDFLAGS="$LDFLAGS -Ieppic-%{eppic_ver}/libeppic -Leppic-%{eppic_ver}/libeppic" eppic_makedumpfile.so
%install
%make_install
install -m 644 -D makedumpfile.conf %{buildroot}/%{_sysconfdir}/makedumpfile.conf.sample
rm %{buildroot}/%{_sbindir}/makedumpfile-R.pl
install -m 755 -D eppic_makedumpfile.so %{buildroot}/%{_libdir}/eppic_makedumpfile.so
%files
%{_sbindir}/makedumpfile
%{_mandir}/man5/makedumpfile.conf.5*
%{_mandir}/man8/makedumpfile.8*
%{_sysconfdir}/makedumpfile.conf.sample
%{_libdir}/eppic_makedumpfile.so
%{_datadir}/makedumpfile/
%license COPYING
%changelog
* Thu Nov 23 2023 Coiby Xu <coxu@redhat.com> - 1.7.5-1
- split from kexec-tools