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