Commit 6fe48058 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Add code to create a fixed appliance archive

When you run snf-image-create-fixed-helper an archive of the fixed
helper is created under /tmp
parent 34e34e80
......@@ -25,6 +25,7 @@ INSTALL_MBR="install-mbr"
TIMEOUT="timeout"
CURL="curl"
TAR="tar"
XZ="xz"
DATE="date -u" # Time in UTC
# Temporary use stderr as monitoring file descriptor.
......
......@@ -78,3 +78,5 @@
# INSTALL_MBR="install-mbr"
# TIMEOUT="timeout"
# CURL="curl"
# TAR="tar"
# XZ="xz"
......@@ -218,9 +218,10 @@ else
echo "snf-image-helper pkg was installed from the apt repository."
fi
helper_version="$(grep ^snf-image-helper[[:space:]] "$HELPER_DIR/packages" | cut -f2)"
host_version="$(dpkg-query -W -f "\${Version}\n" snf-image)"
if [ "$VERSION_CHECK" == yes -a -z "$HELPER_PKG" ]; then
helper_version="$(grep ^snf-image-helper[[:space:]] "$HELPER_DIR/packages" | cut -f2)"
host_version="$(dpkg-query -W -f "\${Version}\n" snf-image)"
if [ "$host_version" != "$helper_version" ]; then
log_error "snf-image version (=$host_version) and " \
"snf-image-helper version (=$helper_version) don't match."
......@@ -230,7 +231,18 @@ fi
mv "$helper_img" "$HELPER_DIR/image"
echo "Files in \`$HELPER_DIR' were updated successfully"
echo "Files in \`$HELPER_DIR' were updated successfully" >&2
TMPDIR=$(mktemp -d)
echo "Creating fixed appliance in \`$TMPDIR':" >&2
echo >&2
(cd "$HELPER_DIR"; $TAR -cvf "$TMPDIR/snf_image_helper_image-${helper_version}.tar" "$kernel_xen" "$initrd_xen" "$kernel" "$initrd" kernel initrd kernel-xen initrd-xen image packages)
echo >&2
echo -n "Compressing fixed appliance ..." >&2
(cd "$HELPER_DIR"; $XZ -9 "$TMPDIR/snf_image_helper_image-${helper_version}.tar")
echo "done" >&2
exit 0
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment