All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [vTPM] Script fixes for bash under FC5
@ 2006-04-17 19:54 Stefan Berger
  2006-04-17 20:20 ` Ryan Harper
  2006-04-19 21:55 ` Ewan Mellor
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Berger @ 2006-04-17 19:54 UTC (permalink / raw)
  To: xen-devel; +Cc: ewan

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

Under FC5 multi-line commands in bash script language have to be wrapped
in $(...) instead of '`...`', otherwise the parser seems to get
confused.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>



[-- Attachment #2: vtpm-script-fix.diff --]
[-- Type: text/x-patch, Size: 2872 bytes --]

Index: xen/xen-unstable.hg/tools/examples/vtpm-common.sh
===================================================================
--- xen.orig/xen-unstable.hg/tools/examples/vtpm-common.sh
+++ xen/xen-unstable.hg/tools/examples/vtpm-common.sh
@@ -60,7 +60,7 @@ fi
 function vtpmdb_find_instance () {
 	local vmname=$1
 	local ret=0
-	instance=`cat $VTPMDB |                    \
+	instance=$(cat $VTPMDB |                   \
 	          awk -vvmname=$vmname             \
 	          '{                               \
 	             if ( 1 != index($1,"#")) {    \
@@ -69,7 +69,7 @@ function vtpmdb_find_instance () {
 	                 exit;                     \
 	               }                           \
 	             }                             \
-	           }'`
+	           }')
 	if [ "$instance" != "" ]; then
 		ret=$instance
 	fi
@@ -86,13 +86,13 @@ function vtpmdb_is_free_instancenum () {
 	if [ $instance -eq 0 -o $instance -gt 255 ]; then
 		avail=0
 	else
-		instances=`cat $VTPMDB |                 \
+		instances=$(cat $VTPMDB |                \
 		           gawk                          \
 		           '{                            \
 		               if (1 != index($1,"#")) { \
 		                 printf("%s ",$2);       \
 		               }                         \
-		            }'`
+		            }')
 		for i in $instances; do
 			if [ $i -eq $instance ]; then
 				avail=0
@@ -110,13 +110,13 @@ function vtpmdb_get_free_instancenum () 
 	local ctr
 	local instances
 	local don
-	instances=`cat $VTPMDB |                 \
+	instances=$(cat $VTPMDB |                \
 	           gawk                          \
 	           '{                            \
 	               if (1 != index($1,"#")) { \
 	                 printf("%s ",$2);       \
 	               }                         \
-	            }'`
+	            }')
 	ctr=1
 	don=0
 	while [ $don -eq 0 ]; do
@@ -163,7 +163,7 @@ function vtpmdb_validate_entry () {
 	local vmname=$1
 	local inst=$2
 
-	res=`cat $VTPMDB |             \
+	res=$(cat $VTPMDB |            \
 	     gawk -vvmname=$vmname     \
 	          -vinst=$inst         \
 	     '{                        \
@@ -179,7 +179,7 @@ function vtpmdb_validate_entry () {
 	            printf("2");       \
 	            exit;              \
 	         }                     \
-	     }'`
+	     }')
 
 	if [ "$res" == "1" ]; then
 		let rc=1
@@ -196,13 +196,13 @@ function vtpmdb_remove_entry () {
 	local vmname=$1
 	local instance=$2
 	local VTPMDB_TMP="$VTPMDB".tmp
-	`cat $VTPMDB |             \
+	$(cat $VTPMDB |            \
 	 gawk -vvmname=$vmname     \
 	 '{                        \
 	    if ( $1 != vmname ) {  \
 	      print $0;            \
 	    }                      \
-	 '} > $VTPMDB_TMP`
+	 '} > $VTPMDB_TMP)
 	if [ -e $VTPMDB_TMP ]; then
 		mv -f $VTPMDB_TMP $VTPMDB
 		vtpm_delete $instance

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [vTPM] Script fixes for bash under FC5
  2006-04-17 19:54 [PATCH] [vTPM] Script fixes for bash under FC5 Stefan Berger
@ 2006-04-17 20:20 ` Ryan Harper
  2006-04-19 21:55 ` Ewan Mellor
  1 sibling, 0 replies; 3+ messages in thread
From: Ryan Harper @ 2006-04-17 20:20 UTC (permalink / raw)
  To: Stefan Berger; +Cc: xen-devel, ewan

* Stefan Berger <stefanb@us.ibm.com> [2006-04-17 14:56]:
> +	instance=$(cat $VTPMDB |                   \
>  	          awk -vvmname=$vmname             \

Any reason you use awk here

> +		instances=$(cat $VTPMDB |                \
>  		           gawk                          \

and gawk just about everywhere else?

> -	instances=`cat $VTPMDB |                 \
> +	instances=$(cat $VTPMDB |                \

> +	res=$(cat $VTPMDB |            \
>  	     gawk -vvmname=$vmname     \

> +	$(cat $VTPMDB |            \
>  	 gawk -vvmname=$vmname     \


# grep -n awk /etc/xen/scripts/vtpm-common.sh
64:               awk -vvmname=$vmname             \
90:                        gawk                          \
114:               gawk                          \
167:         gawk -vvmname=$vmname     \
200:     gawk -vvmname=$vmname     \


-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@us.ibm.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [vTPM] Script fixes for bash under FC5
  2006-04-17 19:54 [PATCH] [vTPM] Script fixes for bash under FC5 Stefan Berger
  2006-04-17 20:20 ` Ryan Harper
@ 2006-04-19 21:55 ` Ewan Mellor
  1 sibling, 0 replies; 3+ messages in thread
From: Ewan Mellor @ 2006-04-19 21:55 UTC (permalink / raw)
  To: Stefan Berger; +Cc: xen-devel

On Mon, Apr 17, 2006 at 03:54:44PM -0400, Stefan Berger wrote:

> Under FC5 multi-line commands in bash script language have to be wrapped
> in $(...) instead of '`...`', otherwise the parser seems to get
> confused.
> 
> Signed-off-by: Stefan Berger <stefanb@us.ibm.com>

Applied, thanks.

Ewan.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-04-19 21:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-17 19:54 [PATCH] [vTPM] Script fixes for bash under FC5 Stefan Berger
2006-04-17 20:20 ` Ryan Harper
2006-04-19 21:55 ` Ewan Mellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.