As suggested by Carl [1],
> Consider converting instances of $RPM_BUILD_ROOT to %{buildroot}. This is not required, as the guidelines only say that you need to use one or the other consistently, but the latter is considered more modern and is more common in Fedora spec files.
>
> https://docs.fedoraproject.org/en-US/packaging-guidelines/#_using_buildroot_and_optflags_vs_rpm_build_root_and_rpm_opt_flags
[1] https://bugzilla.redhat.com/show_bug.cgi?id=2239566#c2
Suggested-by: Carl George <carl@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
238 lines
8.4 KiB
RPMSpec
238 lines
8.4 KiB
RPMSpec
Name: kdump-utils
|
|
Version: 1.0.42
|
|
Release: 1%{?dist}
|
|
License: GPL-2.0-only
|
|
Summary: Kernel crash dump collection utilities
|
|
|
|
Source1: kdumpctl
|
|
Source2: COPYING
|
|
Source3: gen-kdump-sysconfig.sh
|
|
Source4: gen-kdump-conf.sh
|
|
Source7: mkdumprd
|
|
Source10: kexec-kdump-howto.txt
|
|
Source11: fadump-howto.txt
|
|
Source12: mkdumprd.8
|
|
Source13: 98-kexec.rules
|
|
Source14: 98-kexec.rules.ppc64
|
|
Source15: kdump.conf.5
|
|
Source16: kdump.service
|
|
Source20: kdump-lib.sh
|
|
Source21: kdump-in-cluster-environment.txt
|
|
Source22: kdump-dep-generator.sh
|
|
Source23: kdump-lib-initramfs.sh
|
|
Source25: kdumpctl.8
|
|
Source26: live-image-kdump-howto.txt
|
|
Source27: early-kdump-howto.txt
|
|
Source28: kdump-udev-throttler
|
|
Source30: 60-kdump.install
|
|
Source31: kdump-logger.sh
|
|
Source32: mkfadumprd
|
|
Source33: 92-crashkernel.install
|
|
Source34: crashkernel-howto.txt
|
|
Source35: kdump-migrate-action.sh
|
|
Source36: kdump-restart.sh
|
|
Source37: 60-fadump.install
|
|
|
|
Source100: dracut-kdump.sh
|
|
Source101: dracut-module-setup.sh
|
|
Source102: dracut-monitor_dd_progress
|
|
Source104: dracut-kdump-emergency.service
|
|
Source106: dracut-kdump-capture.service
|
|
Source107: dracut-kdump-emergency.target
|
|
Source108: dracut-early-kdump.sh
|
|
Source109: dracut-early-kdump-module-setup.sh
|
|
|
|
Source200: dracut-fadump-init-fadump.sh
|
|
Source201: dracut-fadump-module-setup.sh
|
|
|
|
%ifarch ppc64 ppc64le
|
|
Requires(post): servicelog
|
|
Recommends: keyutils
|
|
%endif
|
|
Requires(pre): coreutils
|
|
Requires(pre): sed
|
|
Requires: kexec-tools >= 2.0.28-5
|
|
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
|
|
kdump-utils is reponsible 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 colletecd crash kernel dump to specified
|
|
target.
|
|
|
|
%build
|
|
# setup the license and docs
|
|
# don't copy the files if they exist otherwise building the packages locally
|
|
# using tools like fedpkg will fail
|
|
if [ ! -e COPYING ]; then
|
|
cp %{SOURCE2} .
|
|
cp %{SOURCE10} .
|
|
cp %{SOURCE11} .
|
|
cp %{SOURCE21} .
|
|
cp %{SOURCE26} .
|
|
cp %{SOURCE27} .
|
|
cp %{SOURCE34} .
|
|
fi
|
|
|
|
# Generate sysconfig file
|
|
%{SOURCE3} %{_target_cpu} > kdump.sysconfig
|
|
%{SOURCE4} %{_target_cpu} > kdump.conf
|
|
|
|
%install
|
|
mkdir -p -m755 %{buildroot}%{_sysconfdir}/kdump/pre.d
|
|
mkdir -p -m755 %{buildroot}%{_sysconfdir}/kdump/post.d
|
|
mkdir -p -m755 %{buildroot}%{_localstatedir}/crash
|
|
mkdir -p -m755 %{buildroot}%{_udevrulesdir}
|
|
mkdir -p -m755 %{buildroot}%{_sharedstatedir}/kdump
|
|
|
|
install -D -m 755 %{SOURCE1} %{buildroot}%{_bindir}/kdumpctl
|
|
install -D -m 755 %{SOURCE7} %{buildroot}%{_sbindir}/mkdumprd
|
|
install -D -m 644 kdump.conf %{buildroot}%{_sysconfdir}/kdump.conf
|
|
install -D -m 644 kdump.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/kdump
|
|
install -D -m 644 %{SOURCE12} %{SOURCE25} -t %{buildroot}%{_mandir}/man8
|
|
install -D -m 755 %{SOURCE20} %{SOURCE23} %{SOURCE31} -t %{buildroot}%{_prefix}/lib/kdump
|
|
%ifarch ppc64 ppc64le
|
|
install -m 755 %{SOURCE32} %{buildroot}%{_sbindir}/mkfadumprd
|
|
install -m 755 %{SOURCE35} %{SOURCE36} -t %{buildroot}%{_prefix}/lib/kdump
|
|
%endif
|
|
%ifnarch s390x
|
|
install -m 755 %{SOURCE28} %{buildroot}%{_udevrulesdir}/../kdump-udev-throttler
|
|
%endif
|
|
%ifnarch s390x ppc64 ppc64le
|
|
# For s390x the ELF header is created in the kdump kernel and therefore kexec
|
|
# udev rules are not required
|
|
install -m 644 %{SOURCE13} %{buildroot}%{_udevrulesdir}/98-kexec.rules
|
|
%endif
|
|
%ifarch ppc64 ppc64le
|
|
install -m 644 %{SOURCE14} %{buildroot}%{_udevrulesdir}/98-kexec.rules
|
|
install -m 755 -D %{SOURCE37} %{buildroot}%{_prefix}/lib/kernel/install.d/60-fadump.install
|
|
%endif
|
|
install -D -m 644 %{SOURCE15} %{buildroot}%{_mandir}/man5/kdump.conf.5
|
|
install -D -m 644 %{SOURCE16} %{buildroot}%{_unitdir}/kdump.service
|
|
install -m 755 -D %{SOURCE22} %{buildroot}%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
|
|
install -m 755 -D %{SOURCE30} %{buildroot}%{_prefix}/lib/kernel/install.d/60-kdump.install
|
|
install -m 755 -D %{SOURCE33} %{buildroot}%{_prefix}/lib/kernel/install.d/92-crashkernel.install
|
|
|
|
%define dracutdir %{_prefix}/lib/dracut/modules.d
|
|
%define remove_prefix() %(echo -n %2|sed 's/.*%1-//g')
|
|
|
|
# deal with dracut modules
|
|
mkdir -p -m755 %{buildroot}/%{dracutdir}/99kdumpbase
|
|
install -m 755 %{SOURCE100} %{buildroot}/%{dracutdir}/99kdumpbase/%{remove_prefix dracut %{SOURCE100}}
|
|
install -m 755 %{SOURCE101} %{buildroot}/%{dracutdir}/99kdumpbase/%{remove_prefix dracut %{SOURCE101}}
|
|
install -m 644 %{SOURCE102} %{buildroot}/%{dracutdir}/99kdumpbase/%{remove_prefix dracut %{SOURCE102}}
|
|
install -m 644 %{SOURCE104} %{buildroot}/%{dracutdir}/99kdumpbase/%{remove_prefix dracut %{SOURCE104}}
|
|
install -m 644 %{SOURCE106} %{buildroot}/%{dracutdir}/99kdumpbase/%{remove_prefix dracut %{SOURCE106}}
|
|
install -m 644 %{SOURCE107} %{buildroot}/%{dracutdir}/99kdumpbase/%{remove_prefix dracut %{SOURCE107}}
|
|
|
|
mkdir -p -m755 %{buildroot}/%{dracutdir}/99earlykdump
|
|
install -m 755 %{SOURCE108} %{buildroot}/%{dracutdir}/99earlykdump/%{remove_prefix dracut %{SOURCE108}}
|
|
install -m 755 %{SOURCE109} %{buildroot}/%{dracutdir}/99earlykdump/%{remove_prefix dracut-early-kdump %{SOURCE109}}
|
|
|
|
%ifarch ppc64 ppc64le
|
|
mkdir -p -m755 %{buildroot}/%{dracutdir}/99zz-fadumpinit
|
|
install -m 755 %{SOURCE200} %{buildroot}/%{dracutdir}/99zz-fadumpinit/%{remove_prefix dracut-fadump %{SOURCE200}}
|
|
install -m 755 %{SOURCE201} %{buildroot}/%{dracutdir}/99zz-fadumpinit/%{remove_prefix dracut-fadump %{SOURCE201}}
|
|
%endif
|
|
|
|
%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
|
|
%{_sbindir}/mkdumprd
|
|
%{_bindir}/*
|
|
%{_prefix}/lib/kdump
|
|
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump
|
|
%config(noreplace,missingok) %verify(not mtime) %{_sysconfdir}/kdump.conf
|
|
%ifnarch s390x
|
|
%config %{_udevrulesdir}
|
|
%{_udevrulesdir}/../kdump-udev-throttler
|
|
%endif
|
|
%{dracutdir}/*
|
|
%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
|
|
|
|
%changelog
|
|
* Tue Oct 24 2023 Coiby <coxu@redhat.com> - 1.0.42-1
|
|
- split from kexec-tools
|