dracut-kdump.sh: Use stat instead of ls to get vmcore size

ls output is fragile, so use stat instead.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
This commit is contained in:
Kairui Song 2021-09-14 03:00:48 +08:00
parent 7a9823b42e
commit b1c794a2cf
2 changed files with 2 additions and 1 deletions

View File

@ -366,7 +366,7 @@ dump_raw()
dinfo "saving to raw disk $_raw"
if ! $(echo -n $CORE_COLLECTOR|grep -q makedumpfile); then
_src_size=`ls -l /proc/vmcore | cut -d' ' -f5`
_src_size=$(stat --format %s /proc/vmcore)
_src_size_mb=$(($_src_size / 1048576))
/kdumpscripts/monitor_dd_progress $_src_size_mb &
fi

View File

@ -1029,6 +1029,7 @@ install() {
inst "/bin/head" "/bin/head"
inst "/bin/awk" "/bin/awk"
inst "/bin/sed" "/bin/sed"
inst "/bin/stat" "/bin/stat"
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
inst "/usr/bin/printf" "/sbin/printf"