# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Node ID b86fe3d23f05f88e971a5d2ffd8aae0b60ece925
# Parent 69d8263d5f856a6a360d381d97c44c440dd574d7
Replace uses of [ ... == ... ] with the POSIX-legal single-equals. Tidy up
external-device-migrate script in its handling of parameters.
Patch from Roland Illig <roland.illig@xxxxxx>.
Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
tools/examples/blktap | 2 -
tools/examples/block | 30 ++++++++---------
tools/examples/external-device-migrate | 56 ++++++++++++---------------------
tools/examples/vif-bridge | 2 -
tools/examples/vif-nat | 4 +-
tools/examples/vif-route | 2 -
6 files changed, 41 insertions(+), 55 deletions(-)
diff -r 69d8263d5f85 -r b86fe3d23f05 tools/examples/blktap
--- a/tools/examples/blktap Wed Nov 08 12:56:45 2006 +0000
+++ b/tools/examples/blktap Wed Nov 08 13:22:08 2006 +0000
@@ -7,7 +7,7 @@ dir=$(dirname "$0")
findCommand "$@"
-if [ "$command" == 'add' ]
+if [ "$command" = 'add' ]
then
success
fi
diff -r 69d8263d5f85 -r b86fe3d23f05 tools/examples/block
--- a/tools/examples/block Wed Nov 08 12:56:45 2006 +0000
+++ b/tools/examples/block Wed Nov 08 13:22:08 2006 +0000
@@ -68,7 +68,7 @@ check_sharing()
local devmm=$(device_major_minor "$dev")
local file
- if [ "$mode" == 'w' ]
+ if [ "$mode" = 'w' ]
then
toskip="^$"
else
@@ -81,7 +81,7 @@ check_sharing()
then
local d=$(device_major_minor "$file")
- if [ "$d" == "$devmm" ]
+ if [ "$d" = "$devmm" ]
then
echo 'local'
return
@@ -96,9 +96,9 @@ check_sharing()
do
d=$(xenstore_read_default "$base_path/$dom/$dev/physical-device" "")
- if [ "$d" == "$devmm" ]
+ if [ "$d" = "$devmm" ]
then
- if [ "$mode" == 'w' ]
+ if [ "$mode" = 'w' ]
then
if ! same_vm $dom
then
@@ -109,7 +109,7 @@ check_sharing()
local m=$(xenstore_read "$base_path/$dom/$dev/mode")
m=$(canonicalise_mode "$m")
- if [ "$m" == 'w' ]
+ if [ "$m" = 'w' ]
then
if ! same_vm $dom
then
@@ -138,7 +138,7 @@ same_vm()
local othervm=$(xenstore_read_default "/local/domain/$otherdom/vm" \
"$FRONTEND_UUID")
- [ "$FRONTEND_UUID" == "$othervm" ]
+ [ "$FRONTEND_UUID" = "$othervm" ]
}
@@ -153,7 +153,7 @@ check_device_sharing()
local mode=$(canonicalise_mode "$2")
local result
- if [ "$mode" == '!' ]
+ if [ "x$mode" = 'x!' ]
then
return 0
fi
@@ -202,7 +202,7 @@ do_ebusy()
local mode="$2"
local result="$3"
- if [ "$result" == 'guest' ]
+ if [ "$result" = 'guest' ]
then
dom='a guest '
when='now'
@@ -211,7 +211,7 @@ do_ebusy()
when='by a guest'
fi
- if [ "$mode" == 'w' ]
+ if [ "$mode" = 'w' ]
then
m1=''
m2=''
@@ -266,7 +266,7 @@ case "$command" in
claim_lock "block"
- if [ "$mode" == 'w' ] && ! stat "$file" -c %A | grep -q w
+ if [ "$mode" = 'w' ] && ! stat "$file" -c %A | grep -q w
then
release_lock "block"
ebusy \
@@ -287,7 +287,7 @@ mount it read-write in a guest domain."
if [ "$f" ]
then
# $dev is in use. Check sharing.
- if [ "$mode" == '!' ]
+ if [ "x$mode" = 'x!' ]
then
continue
fi
@@ -307,7 +307,7 @@ mount it read-write in a guest domain."
do
d=$(xenstore_read_default \
"$XENBUS_BASE_PATH/$dom/$domdev/node" "")
- if [ "$d" == "$dev" ]
+ if [ "$d" = "$dev" ]
then
f=$(xenstore_read "$XENBUS_BASE_PATH/$dom/$domdev/params")
found=1
@@ -347,7 +347,7 @@ mount it read-write in a guest domain."
f=$(readlink -f "$f" || echo $(dirname "$file")/$(basename "$f"))
- if [ "$f" == "$file" ]
+ if [ "$f" = "$file" ]
then
check_file_sharing "$file" "$dev" "$mode"
fi
@@ -355,14 +355,14 @@ mount it read-write in a guest domain."
# $dev is not in use, so we'll remember it for use later; we want
# to finish the sharing check first.
- if [ "$loopdev" == '' ]
+ if [ "$loopdev" = '' ]
then
loopdev="$dev"
fi
fi
done
- if [ "$loopdev" == '' ]
+ if [ "$loopdev" = '' ]
then
fatal 'Failed to find an unused loop device'
fi
diff -r 69d8263d5f85 -r b86fe3d23f05 tools/examples/external-device-migrate
--- a/tools/examples/external-device-migrate Wed Nov 08 12:56:45 2006 +0000
+++ b/tools/examples/external-device-migrate Wed Nov 08 13:22:08 2006 +0000
@@ -55,41 +55,27 @@ function evaluate_params()
{
local step host domname typ recover filename func stype
stype=""
- while [ 1 ]; do
- if [ "$1" == "-step" ]; then
- shift
- step=$1
- elif [ "$1" == "-host" ]; then
- shift
- host=$1
- elif [ "$1" == "-domname" ]; then
- shift
- domname=$1
- elif [ "$1" == "-type" ]; then
- shift
- typ=$1
- elif [ "$1" == "-subtype" ]; then
- shift
- stype="_$1"
- elif [ "$1" == "-recover" ]; then
- recover=1
- elif [ "$1" == "-help" ]; then
- ext_dev_migrate_usage
- exit
- else
- break
- fi
- shift
+ while [ $# -ge 1 ]; do
+ case "$1" in
+ -step) step=$2; shift 2;;
+ -host) host=$2; shift 2;;
+ -domname) domname=$2; shift 2;;
+ -type) type=$2; shift 2;;
+ -subtype) subtype=$2; shift 2;;
+ -recover) recover=1; shift;;
+ -help) ext_dev_migrate_usage; exit 0;;
+ *) break;;
+ esac
done
- if [ "$step" == "" -o \
- "$host" == "" -o \
- "$typ" == "" -o \
- "$domname" == "" ]; then
- echo "Error: Parameter(s) missing (-step/-host/-type/-domname)"
- echo ""
- echo "$0 -help for usage."
- exit
+ if [ "$step" = "" -o \
+ "$host" = "" -o \
+ "$typ" = "" -o \
+ "$domname" = "" ]; then
+ echo "Error: Parameter(s) missing (-step/-host/-type/-domname)"
1>&2
+ echo "" 1>&2
+ echo "$0 -help for usage." 1>&2
+ exit 1
fi
filename="$dir/$typ$stype-migration.sh"
@@ -99,7 +85,7 @@ function evaluate_params()
fi
. "$filename"
- if [ "$recover" == "1" ]; then
+ if [ "$recover" = "1" ]; then
func="$typ"_recover
eval $func $host $domname $step $*
else
@@ -108,4 +94,4 @@ function evaluate_params()
fi
}
-evaluate_params $*
+evaluate_params "$@"
diff -r 69d8263d5f85 -r b86fe3d23f05 tools/examples/vif-bridge
--- a/tools/examples/vif-bridge Wed Nov 08 12:56:45 2006 +0000
+++ b/tools/examples/vif-bridge Wed Nov 08 13:22:08 2006 +0000
@@ -61,7 +61,7 @@ handle_iptable
handle_iptable
log debug "Successful vif-bridge $command for $vif, bridge $bridge."
-if [ "$command" == "online" ]
+if [ "$command" = "online" ]
then
success
fi
diff -r 69d8263d5f85 -r b86fe3d23f05 tools/examples/vif-nat
--- a/tools/examples/vif-nat Wed Nov 08 12:56:45 2006 +0000
+++ b/tools/examples/vif-nat Wed Nov 08 13:22:08 2006 +0000
@@ -72,7 +72,7 @@ dotted_quad()
}
-if [ "$ip" == "" ]
+if [ "$ip" = "" ]
then
ip=$(ip_from_dom)
fi
@@ -152,7 +152,7 @@ handle_iptable
handle_iptable
log debug "Successful vif-nat $command for $vif."
-if [ "$command" == "online" ]
+if [ "$command" = "online" ]
then
success
fi
diff -r 69d8263d5f85 -r b86fe3d23f05 tools/examples/vif-route
--- a/tools/examples/vif-route Wed Nov 08 12:56:45 2006 +0000
+++ b/tools/examples/vif-route Wed Nov 08 13:22:08 2006 +0000
@@ -50,7 +50,7 @@ handle_iptable
handle_iptable
log debug "Successful vif-route $command for $vif."
-if [ "$command" == "online" ]
+if [ "$command" = "online" ]
then
success
fi
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|