[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [fedora-virt] Running shell script fragments via guestfish "command"



On Thu, May 28, 2009 at 05:41:44PM -0500, Charles Duffy wrote:
> What's the Right Way to do the below?
>
> ><fs> command "bash -c 'for D in avahi-daemon avahi-dnsconfd haldaemon;  
> do /sbin/chkconfig $D off; done; true'"
> libguestfs: error: D: -c: line 0: unexpected EOF while looking for  
> matching `''
> D: -c: line 1: syntax error: unexpected end of file

The problem is that guestfish's list splitting code sucks, so
the above turns into the equivalent of this API call:

guestfs_command (g, "bash", "-c", "'for", "D", "in",
		"avahi-daemon", "avahi-dnsconfd", "haldaemon;",
		"do", "/sbin/chkconfig", "$D", "off;", "done;", "true'");

Please file a bug about this.

In the meantime you can write what you really wanted to write using a
language binding such as Perl.  Or if you need to use guestfish then
write a small shell script to do the operations you need and use the
'upload' and 'chmod' commands to upload it, chmod it and run it inside
the guest.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]