#!/bin/sh # # Copyright IBM Corp. 2021 # # s390-tools is free software; you can redistribute it and/or modify # it under the terms of the MIT license. See LICENSE for details. # . /lib/dracut-lib.sh MNTDIR="/ngdump" DUMP="dump.elf" META="ngdump.meta" VMCORE="/proc/vmcore" is_dump_part_ok() { ismounted "$MNTDIR" && [ -e "$MNTDIR/$META" ] } save_logs() { is_dump_part_ok || return [ -e "$VMCORE" ] && makedumpfile -f --dump-dmesg "$VMCORE" "$MNTDIR/crash.log" journalctl -b >"$MNTDIR/boot.log" } cleanup() { sync umount "$MNTDIR" } bail_out() { warn "$1" save_logs cleanup exit 1 } save_meta() { local hash=$(sha256sum "$MNTDIR/$DUMP" | cut -f1 -d ' ') cat >"$MNTDIR/$META" <