import kexec-tools-2.0.20-46.el8_4.2

This commit is contained in:
CentOS Sources 2021-08-10 08:02:47 -04:00 committed by Andrew Lukoshko
parent 2a129b2686
commit 0d79822752
4 changed files with 35 additions and 14 deletions

View File

@ -2,17 +2,23 @@
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KDUMP_INITRD_DIR_ABS="$3"
KERNEL_IMAGE="$4"
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
exit 0
fi
if [[ -d "$BOOT_DIR_ABS" ]]; then
if [[ -d "$KDUMP_INITRD_DIR_ABS" ]]; then
KDUMP_INITRD="initrdkdump"
else
BOOT_DIR_ABS="/boot"
# If `KDUMP_BOOTDIR` is not writable, then the kdump
# initrd must have been placed at `/var/lib/kdump`
if [[ ! -w "/boot" ]]; then
KDUMP_INITRD_DIR_ABS="/var/lib/kdump"
else
KDUMP_INITRD_DIR_ABS="/boot"
fi
KDUMP_INITRD="initramfs-${KERNEL_VERSION}kdump.img"
fi
@ -23,7 +29,7 @@ case "$COMMAND" in
# and managed by kdump service
;;
remove)
rm -f -- "$BOOT_DIR_ABS/$KDUMP_INITRD"
rm -f -- "$KDUMP_INITRD_DIR_ABS/$KDUMP_INITRD"
ret=$?
;;
esac

View File

@ -729,20 +729,30 @@ prepare_kdump_bootinfo()
boot_initrdlist="initramfs-$KDUMP_KERNELVER.img initrd"
for initrd in $boot_initrdlist; do
if [ -f "$KDUMP_BOOTDIR/$initrd" ]; then
DEFAULT_INITRD="$KDUMP_BOOTDIR/$initrd"
defaut_initrd_base="$initrd"
DEFAULT_INITRD="$KDUMP_BOOTDIR/$defaut_initrd_base"
break
fi
done
# Get kdump initrd from default initrd filename
# Create kdump initrd basename from default initrd basename
# initramfs-5.7.9-200.fc32.x86_64.img => initramfs-5.7.9-200.fc32.x86_64kdump.img
# initrd => initrdkdump
if [[ -z "$DEFAULT_INITRD" ]]; then
KDUMP_INITRD=${KDUMP_BOOTDIR}/initramfs-${KDUMP_KERNELVER}kdump.img
elif [[ $(basename $DEFAULT_INITRD) == *.* ]]; then
KDUMP_INITRD=${DEFAULT_INITRD%.*}kdump.${DEFAULT_INITRD##*.}
if [[ -z "$defaut_initrd_base" ]]; then
kdump_initrd_base=initramfs-${KDUMP_KERNELVER}kdump.img
elif [[ $defaut_initrd_base == *.* ]]; then
kdump_initrd_base=${defaut_initrd_base%.*}kdump.${DEFAULT_INITRD##*.}
else
KDUMP_INITRD=${DEFAULT_INITRD}kdump
kdump_initrd_base=${defaut_initrd_base}kdump
fi
# Place kdump initrd in `/var/lib/kdump` if `KDUMP_BOOTDIR` not writable
if [[ ! -w "$KDUMP_BOOTDIR" ]];then
var_target_initrd_dir="/var/lib/kdump"
mkdir -p "$var_target_initrd_dir"
KDUMP_INITRD="$var_target_initrd_dir/$kdump_initrd_base"
else
KDUMP_INITRD="$KDUMP_BOOTDIR/$kdump_initrd_base"
fi
}

View File

@ -151,8 +151,8 @@ rebuild_kdump_initrd()
rebuild_initrd()
{
if [[ ! -w "$KDUMP_BOOTDIR" ]];then
derror "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD"
if [[ ! -w $(dirname $TARGET_INITRD) ]];then
derror "$(dirname $TARGET_INITRD) does not have write permission. Cannot rebuild $TARGET_INITRD"
return 1
fi

View File

@ -1,6 +1,6 @@
Name: kexec-tools
Version: 2.0.20
Release: 46%{?dist}.1
Release: 46%{?dist}.2
License: GPLv2
Group: Applications/System
Summary: The kexec/kdump userspace component
@ -190,6 +190,7 @@ mkdir -p $RPM_BUILD_ROOT%{_unitdir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_bindir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_prefix}/lib/kdump
mkdir -p -m755 $RPM_BUILD_ROOT%{_sharedstatedir}/kdump
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl
install -m 755 build/sbin/kexec $RPM_BUILD_ROOT/usr/sbin/kexec
@ -354,6 +355,7 @@ done
%dir %{_sysconfdir}/kdump
%dir %{_sysconfdir}/kdump/pre.d
%dir %{_sysconfdir}/kdump/post.d
%dir %{_sharedstatedir}/kdump
%{_mandir}/man8/kdumpctl.8.gz
%{_mandir}/man8/kexec.8.gz
%{_mandir}/man8/makedumpfile.8.gz
@ -378,6 +380,9 @@ done
%endif
%changelog
* Thu Jul 1 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-46.2
- Write to `/var/lib/kdump` if $KDUMP_BOOTDIR not writable
* Wed May 12 2021 Pingfan Liu <piliu@redhat.com> - 2.0.20-46.1
- Implement IP netmask calculation to replace "ipcalc -m"