[Ovirt-devel] [PATCH] create-wui-appliance.sh: minor fixes

Jim Meyering jim at meyering.net
Mon Aug 4 09:39:20 UTC 2008


I'll probably use the patch below to test the new commit/push hook
(which I'm about to enable), by appending a space somewhere.

>From 9a5ab820510ab9ae4430aba7f3fa5f0313bfd085 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 4 Aug 2008 11:36:22 +0200
Subject: [PATCH] create-wui-appliance.sh: minor fixes

* wui-appliance/create-wui-appliance.sh: Initialize, so that a
stray KICKSTART=garbage definition in the environment can't
make this script malfunction.  Change var name to lower case:
s/KICKSTART/kickstart/.
Use printf instead of less-portable "echo -n".
Factor out a common "echo done".
---
 wui-appliance/create-wui-appliance.sh |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/wui-appliance/create-wui-appliance.sh b/wui-appliance/create-wui-appliance.sh
index 6365ddb..c69b10f 100755
--- a/wui-appliance/create-wui-appliance.sh
+++ b/wui-appliance/create-wui-appliance.sh
@@ -31,11 +31,12 @@ EOF
 err=0 help=0
 compress=0
 bridge=
+kickstart=
 while getopts :d:k:he: c; do
     case $c in
         d) IMGDIR=$OPTARG;;
         c) compress=1;;
-        k) KICKSTART=$OPTARG;;
+        k) kickstart=$OPTARG;;
         e) bridge=$OPTARG;;
         h) help=1;;
         '?') err=1; warn "invalid option: \`-$OPTARG'";;
@@ -271,22 +272,21 @@ mkdir -p $IMGDIR
 virsh destroy $NAME > /dev/null 2>&1
 virsh undefine $NAME > /dev/null 2>&1

-if [ -n "$KICKSTART" ]; then
+if [ -n "$kickstart" ]; then
     mkdir -p tmp
     set -e
-    appliance-creator --config $KICKSTART --name $NAME --tmpdir $(pwd)/tmp
+    appliance-creator --config $kickstart --name $NAME --tmpdir $(pwd)/tmp
     # FIXME add --compress option to appliance-creator
     if [ $compress -ne 0 ]; then
-        echo -n "Compressing the image..."
+        printf "Compressing the image..."
         qemu-img convert -c $NAME-sda.raw -O qcow2 "$IMGDIR/$IMGNAME"
         rm ovirt-appliance-sda.raw
-        echo "done"
     else
-        echo -n "Moving the image..."
+        printf "Moving the image..."
         mv ovirt-appliance-sda.raw "$IMGDIR/$IMGNAME"
         restorecon -v "$IMGDIR/$IMGNAME"
-        echo "done"
     fi
+    echo done
     set +e
 fi

--
1.6.0.rc1.36.g5ff70




More information about the ovirt-devel mailing list