diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 7baa673..84dd72e 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -2,6 +2,7 @@ exec &> /dev/console . /lib/dracut-lib.sh +. /lib/kdump-lib.sh if [ -f "$initdir/lib/dracut/no-emergency-shell" ]; then rm -f -- $initdir/lib/dracut/no-emergency-shell @@ -198,21 +199,6 @@ save_vmcore_dmesg_ssh() { } -is_ssh_dump_target() -{ - grep -q "^ssh[[:blank:]].*@" $conf_file -} - -is_nfs_dump_target() -{ - grep -q "^nfs.*:" $conf_file -} - -is_raw_dump_target() -{ - grep -q "^raw" $conf_file -} - get_host_ip() { local _host diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index f49f7fe..10ecec6 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -1,6 +1,7 @@ #!/bin/bash . $dracutfunctions +. /lib/kdump/kdump-lib.sh check() { [[ $debug ]] && set -x @@ -23,11 +24,6 @@ depends() { return 0 } -is_ssh_dump_target() -{ - grep -q "^ssh[[:blank:]].*@" /etc/kdump.conf -} - kdump_to_udev_name() { local dev="${1//\"/}" @@ -413,6 +409,7 @@ install() { inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg" inst_hook pre-pivot 9999 "$moddir/kdump.sh" + inst "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh" # Check for all the devices and if any device is iscsi, bring up iscsi # target. Ideally all this should be pushed into dracut iscsi module diff --git a/kdump-lib.sh b/kdump-lib.sh new file mode 100755 index 0000000..1d00f67 --- /dev/null +++ b/kdump-lib.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +# Kdump common functions +# + +is_ssh_dump_target() +{ + grep -q "^ssh[[:blank:]].*@" /etc/kdump.conf +} + +is_nfs_dump_target() +{ + grep -q "^nfs" /etc/kdump.conf +} + +is_raw_dump_target() +{ + grep -q "^raw" /etc/kdump.conf +} diff --git a/kexec-tools.spec b/kexec-tools.spec index b0775cd..7a43777 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -24,6 +24,7 @@ Source16: kdump.service Source17: rhcrashkernel-param Source18: kdump.sysconfig.s390x Source19: eppic_030413.tar.gz +Source20: kdump-lib.sh ####################################### # These are sources for mkdumpramfs @@ -156,6 +157,7 @@ mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d 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 install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu} @@ -168,6 +170,7 @@ install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8 install -m 755 %{SOURCE11} $RPM_BUILD_ROOT%{_datadir}/kdump/firstboot_kdump.py install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8 +install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh %ifnarch s390x # For s390x the ELF header is created in the kdump kernel and therefore kexec # udev rules are not required @@ -298,6 +301,7 @@ done /usr/sbin/* %{_bindir}/* %{_datadir}/kdump +%{_prefix}/lib/kdump %config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump %config(noreplace,missingok) %{_sysconfdir}/kdump.conf %ifnarch s390x diff --git a/mkdumprd b/mkdumprd index 26fe5af..ea84df5 100644 --- a/mkdumprd +++ b/mkdumprd @@ -6,6 +6,7 @@ # Written by Cong Wang # +. /lib/kdump/kdump-lib.sh export IN_KDUMP=1 conf_file="/etc/kdump.conf" @@ -243,21 +244,6 @@ check_size() { fi } -is_nfs_dump_target() -{ - grep -q "^nfs" $conf_file -} - -is_ssh_dump_target() -{ - grep -q "^ssh.*@" $conf_file -} - -is_raw_dump_target() -{ - grep -q "^raw" $conf_file -} - # $1: core_collector config value verify_core_collector() { if grep -q "^raw" $conf_file && [ "${1%% *}" != "makedumpfile" ]; then