Rephrase the create-fixed-helper usage msg
[snf-image] / snf-image-host / snf-image-create-fixed-helper.in
index 9731bed..14fa1e9 100644 (file)
@@ -30,9 +30,9 @@ usage() {
 
 Usage: $0 [options]
 
-This script runs a debootstrap and creates a small Debian image populated with
-the snf-image-helper package. This needs to be done before the first use of
-ganeti's \`snf-image' guest OS type.
+This script runs multistrap and creates a small Debian image populated with
+the snf-image-helper package. This image is needed for ganeti's \`snf-image'
+guest OS type to work.
 
 OPTIONS:
     -d DIRECTORY
@@ -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 :