ia64/xen-unstable

changeset 12316:b86fe3d23f05

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@gmx.de>.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Wed Nov 08 13:22:08 2006 +0000 (2006-11-08)
parents 69d8263d5f85
children 4e3ddf1288fb
files tools/examples/blktap tools/examples/block tools/examples/external-device-migrate tools/examples/vif-bridge tools/examples/vif-nat tools/examples/vif-route
line diff
     1.1 --- a/tools/examples/blktap	Wed Nov 08 12:56:45 2006 +0000
     1.2 +++ b/tools/examples/blktap	Wed Nov 08 13:22:08 2006 +0000
     1.3 @@ -7,7 +7,7 @@ dir=$(dirname "$0")
     1.4  
     1.5  findCommand "$@"
     1.6  
     1.7 -if [ "$command" == 'add' ]
     1.8 +if [ "$command" = 'add' ]
     1.9  then
    1.10    success
    1.11  fi
     2.1 --- a/tools/examples/block	Wed Nov 08 12:56:45 2006 +0000
     2.2 +++ b/tools/examples/block	Wed Nov 08 13:22:08 2006 +0000
     2.3 @@ -68,7 +68,7 @@ check_sharing()
     2.4    local devmm=$(device_major_minor "$dev")
     2.5    local file
     2.6  
     2.7 -  if [ "$mode" == 'w' ]
     2.8 +  if [ "$mode" = 'w' ]
     2.9    then
    2.10      toskip="^$"
    2.11    else
    2.12 @@ -81,7 +81,7 @@ check_sharing()
    2.13      then
    2.14        local d=$(device_major_minor "$file")
    2.15  
    2.16 -      if [ "$d" == "$devmm" ]
    2.17 +      if [ "$d" = "$devmm" ]
    2.18        then
    2.19          echo 'local'
    2.20          return
    2.21 @@ -96,9 +96,9 @@ check_sharing()
    2.22      do
    2.23        d=$(xenstore_read_default "$base_path/$dom/$dev/physical-device" "")
    2.24  
    2.25 -      if [ "$d" == "$devmm" ]
    2.26 +      if [ "$d" = "$devmm" ]
    2.27        then
    2.28 -        if [ "$mode" == 'w' ]
    2.29 +        if [ "$mode" = 'w' ]
    2.30          then
    2.31            if ! same_vm $dom
    2.32            then
    2.33 @@ -109,7 +109,7 @@ check_sharing()
    2.34            local m=$(xenstore_read "$base_path/$dom/$dev/mode")
    2.35            m=$(canonicalise_mode "$m")
    2.36  
    2.37 -          if [ "$m" == 'w' ]
    2.38 +          if [ "$m" = 'w' ]
    2.39            then
    2.40              if ! same_vm $dom
    2.41              then
    2.42 @@ -138,7 +138,7 @@ same_vm()
    2.43    local othervm=$(xenstore_read_default "/local/domain/$otherdom/vm"         \
    2.44                    "$FRONTEND_UUID")
    2.45  
    2.46 -  [ "$FRONTEND_UUID" == "$othervm" ]
    2.47 +  [ "$FRONTEND_UUID" = "$othervm" ]
    2.48  }
    2.49  
    2.50  
    2.51 @@ -153,7 +153,7 @@ check_device_sharing()
    2.52    local mode=$(canonicalise_mode "$2")
    2.53    local result
    2.54  
    2.55 -  if [ "$mode" == '!' ]
    2.56 +  if [ "x$mode" = 'x!' ]
    2.57    then
    2.58      return 0
    2.59    fi
    2.60 @@ -202,7 +202,7 @@ do_ebusy()
    2.61    local mode="$2"
    2.62    local result="$3"
    2.63  
    2.64 -  if [ "$result" == 'guest' ]
    2.65 +  if [ "$result" = 'guest' ]
    2.66    then
    2.67      dom='a guest '
    2.68      when='now'
    2.69 @@ -211,7 +211,7 @@ do_ebusy()
    2.70      when='by a guest'
    2.71    fi
    2.72  
    2.73 -  if [ "$mode" == 'w' ]
    2.74 +  if [ "$mode" = 'w' ]
    2.75    then
    2.76      m1=''
    2.77      m2=''
    2.78 @@ -266,7 +266,7 @@ case "$command" in
    2.79  
    2.80          claim_lock "block"
    2.81  
    2.82 -        if [ "$mode" == 'w' ] && ! stat "$file" -c %A | grep -q w
    2.83 +        if [ "$mode" = 'w' ] && ! stat "$file" -c %A | grep -q w
    2.84          then
    2.85            release_lock "block"
    2.86            ebusy \
    2.87 @@ -287,7 +287,7 @@ mount it read-write in a guest domain."
    2.88            if [ "$f" ]
    2.89            then
    2.90              # $dev is in use.  Check sharing.
    2.91 -            if [ "$mode" == '!' ]
    2.92 +            if [ "x$mode" = 'x!' ]
    2.93              then
    2.94                continue
    2.95              fi
    2.96 @@ -307,7 +307,7 @@ mount it read-write in a guest domain."
    2.97                  do
    2.98                    d=$(xenstore_read_default \
    2.99                          "$XENBUS_BASE_PATH/$dom/$domdev/node" "")
   2.100 -                  if [ "$d" == "$dev" ]
   2.101 +                  if [ "$d" = "$dev" ]
   2.102                    then
   2.103                      f=$(xenstore_read "$XENBUS_BASE_PATH/$dom/$domdev/params")
   2.104                      found=1
   2.105 @@ -347,7 +347,7 @@ mount it read-write in a guest domain."
   2.106              f=$(readlink -f "$f" || echo $(dirname "$file")/$(basename "$f"))
   2.107  
   2.108  
   2.109 -            if [ "$f" == "$file" ]
   2.110 +            if [ "$f" = "$file" ]
   2.111              then
   2.112                check_file_sharing "$file" "$dev" "$mode"
   2.113              fi
   2.114 @@ -355,14 +355,14 @@ mount it read-write in a guest domain."
   2.115              # $dev is not in use, so we'll remember it for use later; we want
   2.116              # to finish the sharing check first.
   2.117  
   2.118 -            if [ "$loopdev" == '' ]
   2.119 +            if [ "$loopdev" = '' ]
   2.120              then
   2.121                loopdev="$dev"
   2.122              fi
   2.123            fi
   2.124          done
   2.125  
   2.126 -        if [ "$loopdev" == '' ]
   2.127 +        if [ "$loopdev" = '' ]
   2.128          then
   2.129            fatal 'Failed to find an unused loop device'
   2.130          fi
     3.1 --- a/tools/examples/external-device-migrate	Wed Nov 08 12:56:45 2006 +0000
     3.2 +++ b/tools/examples/external-device-migrate	Wed Nov 08 13:22:08 2006 +0000
     3.3 @@ -55,41 +55,27 @@ function evaluate_params()
     3.4  {
     3.5  	local step host domname typ recover filename func stype
     3.6  	stype=""
     3.7 -	while [ 1 ]; do
     3.8 -		if [ "$1" == "-step" ]; then
     3.9 -			shift
    3.10 -			step=$1
    3.11 -		elif [ "$1" == "-host" ]; then
    3.12 -			shift
    3.13 -			host=$1
    3.14 -		elif [ "$1" == "-domname" ]; then
    3.15 -			shift
    3.16 -			domname=$1
    3.17 -		elif [ "$1" == "-type" ]; then
    3.18 -			shift
    3.19 -			typ=$1
    3.20 -		elif [ "$1" == "-subtype" ]; then
    3.21 -			shift
    3.22 -			stype="_$1"
    3.23 -		elif [ "$1" == "-recover" ]; then
    3.24 -			recover=1
    3.25 -		elif [ "$1" == "-help" ]; then
    3.26 -			ext_dev_migrate_usage
    3.27 -			exit
    3.28 -		else
    3.29 -			break
    3.30 -		fi
    3.31 -		shift
    3.32 +	while [ $# -ge 1 ]; do
    3.33 +		case "$1" in
    3.34 +		-step)		step=$2; shift 2;;
    3.35 +		-host)		host=$2; shift 2;;
    3.36 +		-domname)	domname=$2; shift 2;;
    3.37 +		-type)		type=$2; shift 2;;
    3.38 +		-subtype)	subtype=$2; shift 2;;
    3.39 +		-recover)	recover=1; shift;;
    3.40 +		-help)		ext_dev_migrate_usage; exit 0;;
    3.41 +		*)		break;;
    3.42 +		esac
    3.43  	done
    3.44  
    3.45 -	if [ "$step"    == "" -o \
    3.46 -	     "$host"    == "" -o \
    3.47 -	     "$typ"     == "" -o \
    3.48 -	     "$domname" == "" ]; then
    3.49 -	 	echo "Error: Parameter(s) missing (-step/-host/-type/-domname)"
    3.50 -		echo ""
    3.51 -		echo "$0 -help for usage."
    3.52 -		exit
    3.53 +	if [ "$step"    = "" -o \
    3.54 +	     "$host"    = "" -o \
    3.55 +	     "$typ"     = "" -o \
    3.56 +	     "$domname" = "" ]; then
    3.57 +	 	echo "Error: Parameter(s) missing (-step/-host/-type/-domname)" 1>&2
    3.58 +		echo "" 1>&2
    3.59 +		echo "$0 -help for usage." 1>&2
    3.60 +		exit 1
    3.61  	fi
    3.62  
    3.63  	filename="$dir/$typ$stype-migration.sh"
    3.64 @@ -99,7 +85,7 @@ function evaluate_params()
    3.65  	fi
    3.66  	. "$filename"
    3.67  
    3.68 -	if [ "$recover" == "1" ]; then
    3.69 +	if [ "$recover" = "1" ]; then
    3.70  		func="$typ"_recover
    3.71  		eval $func $host $domname $step $*
    3.72  	else
    3.73 @@ -108,4 +94,4 @@ function evaluate_params()
    3.74  	fi
    3.75  }
    3.76  
    3.77 -evaluate_params $*
    3.78 +evaluate_params "$@"
     4.1 --- a/tools/examples/vif-bridge	Wed Nov 08 12:56:45 2006 +0000
     4.2 +++ b/tools/examples/vif-bridge	Wed Nov 08 13:22:08 2006 +0000
     4.3 @@ -61,7 +61,7 @@ esac
     4.4  handle_iptable
     4.5  
     4.6  log debug "Successful vif-bridge $command for $vif, bridge $bridge."
     4.7 -if [ "$command" == "online" ]
     4.8 +if [ "$command" = "online" ]
     4.9  then
    4.10    success
    4.11  fi
     5.1 --- a/tools/examples/vif-nat	Wed Nov 08 12:56:45 2006 +0000
     5.2 +++ b/tools/examples/vif-nat	Wed Nov 08 13:22:08 2006 +0000
     5.3 @@ -72,7 +72,7 @@ dotted_quad()
     5.4  }
     5.5  
     5.6  
     5.7 -if [ "$ip" == "" ]
     5.8 +if [ "$ip" = "" ]
     5.9  then
    5.10    ip=$(ip_from_dom)
    5.11  fi
    5.12 @@ -152,7 +152,7 @@ esac
    5.13  handle_iptable
    5.14  
    5.15  log debug "Successful vif-nat $command for $vif."
    5.16 -if [ "$command" == "online" ]
    5.17 +if [ "$command" = "online" ]
    5.18  then
    5.19    success
    5.20  fi
     6.1 --- a/tools/examples/vif-route	Wed Nov 08 12:56:45 2006 +0000
     6.2 +++ b/tools/examples/vif-route	Wed Nov 08 13:22:08 2006 +0000
     6.3 @@ -50,7 +50,7 @@ fi
     6.4  handle_iptable
     6.5  
     6.6  log debug "Successful vif-route $command for $vif."
     6.7 -if [ "$command" == "online" ]
     6.8 +if [ "$command" = "online" ]
     6.9  then
    6.10    success
    6.11  fi