From c67afe0431f4abfc16eb9994239c3f21b56ad303 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Thu, 25 Oct 2012 11:06:57 +0100 Subject: Write metadata for the rootfs itself into the rootfs This makes it easier to identify what version of a system we are running. Tests are updated to check inside the contents of the rootfs we created, and the code to mount the rootfs as a loopback device was extracted out into tests.as-root/lib --- scripts/test-morph | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'scripts/test-morph') diff --git a/scripts/test-morph b/scripts/test-morph index 2b7fb57d..fb3e2cd4 100755 --- a/scripts/test-morph +++ b/scripts/test-morph @@ -27,7 +27,25 @@ set -eu # distributed builds, which invoke morph as a sub-process. export PATH="$SRCDIR:$PATH" -"$SRCDIR/scripts/cmd-filter" "$SRCDIR/morph" --no-default-config \ - --tarball-server= --cache-server= \ - --config="$DATADIR/morph.conf" "$@" +if [ "$1" = "--find-system-artifact" ]; then + shift + "$SRCDIR/morph" --no-default-config \ + --tarball-server= --cache-server= \ + --config="$DATADIR/morph.conf" --verbose "$@" > $DATADIR/stdout + + ARTIFACT=$(grep "system \S\+-rootfs is cached at" "$DATADIR/stdout" | \ + sed -nre "s/^.*system \S+-rootfs is cached at (\S+)$/\1/p") + rm "$DATADIR/stdout" + + if [ ! -e "$ARTIFACT" ]; then + echo "Unable to find rootfs artifact: $ARTIFACT" 1>&2 + exit 1 + fi + + echo $ARTIFACT +else + "$SRCDIR/scripts/cmd-filter" "$SRCDIR/morph" --no-default-config \ + --tarball-server= --cache-server= \ + --config="$DATADIR/morph.conf" "$@" +fi -- cgit v1.2.1