kexec-tools/tests/scripts/copy-from-image.sh
Kairui Song c44cdb6703 selftest: Show the path of dumped vmcore on test end
Make the test script print following line when the test is finished and vmcore is successfully dumped:

  You can retrive the verify the vmcore file using following command:
  ./scripts/copy-from-image.sh \
      /home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/0-server.img \
      /var/crash/192.168.77.62-2020-09-02-05:16:26/vmcore.flat ./
  Kernel package verion is: kernel-core-5.6.6-300.fc32.x86_64

Also add a helper to copy files out of the VM image.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2020-09-17 10:43:02 +08:00

26 lines
423 B
Bash
Executable File

#!/usr/bin/env bash
BASEDIR=$(realpath $(dirname "$0"))
. $BASEDIR/image-init-lib.sh
# Base image to copy from
BOOT_IMAGE=$1 && shift
if [ ! -e "$BOOT_IMAGE" ]; then
perror_exit "Image '$BOOT_IMAGE' not found"
else
BOOT_IMAGE=$(realpath "$BOOT_IMAGE")
fi
mount_image $BOOT_IMAGE
IMAGE_MNT=$(get_image_mount_root $BOOT_IMAGE)
SRC=
while [ $# -gt 1 ]; do
SRC="$SRC $IMAGE_MNT/$1"
shift
done
DST=$1
cp -rv $SRC $DST