Hi. I'm try to use guestfish inside golang (extract some files from image and create squashfs from root). Now i can't understand how can i work with mount-local/mount-local-run. Where i can specify what partition i'm export to local? Does i need firstly mount /dev/sda1 to / for example and after that run mount-local /tmp/xxx ? Second - i'm work with guestfish via writing to stdin and getting result from stdout. In case of mount-local-run does i need fully fork new binary or i can only dup stdin descriptor and work with it? -- Vasiliy Tolstov, e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru
Hi, On Tuesday 15 July 2014 15:33:12 Vasiliy Tolstov wrote:> Hi. I'm try to use guestfish inside golang (extract some files from > image and create squashfs from root). > Now i can't understand how can i work with > mount-local/mount-local-run. Where i can specify what partition i'm > export to local? Does i need firstly mount /dev/sda1 to / for example > and after that run > mount-local /tmp/xxx ?Yes, you need at least something mounted to / (so /dev/sda1 in your example) before calling mount-local. mount-local needs a root filesystem mounted and it will always fail without it (in libguestfs 1.26 the error message is clear in such cases).> Second - i'm work with guestfish via writing to stdin and getting > result from stdout. In case of mount-local-run does i need fully fork > new binary or i can only dup stdin descriptor and work with it?I'm afraid I don't understand what you mean here -- can you please provide an actual case of what you want to do? -- Pino Toscano
On Tue, Jul 15, 2014 at 03:33:12PM +0400, Vasiliy Tolstov wrote:> Hi. I'm try to use guestfish inside golang (extract some files from > image and create squashfs from root). > Now i can't understand how can i work with mount-local/mount-local-run. > Where i can specify what partition i'm export to local? Does i need > firstly mount /dev/sda1 to / for example and after that run > mount-local /tmp/xxx ?Have a look at this example: https://github.com/libguestfs/libguestfs/blob/master/examples/mount-local.c As Pino says, it exports the root directory from the "libguestfs API space".> Second - i'm work with guestfish via writing to stdin and getting > result from stdout. In case of mount-local-run does i need fully fork > new binary or i can only dup stdin descriptor and work with it?Not sure I understand the question, but the guestfish mount-local-run command will block guestfish until another process runs 'fusermount -u /mntpoint' (or better, 'guestunmount /mntpoint'). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
2014-07-15 20:59 GMT+04:00 Richard W.M. Jones <rjones@redhat.com>:> Not sure I understand the question, but the guestfish mount-local-run > command will block guestfish until another process runs > 'fusermount -u /mntpoint' (or better, 'guestunmount /mntpoint').I understand that guestfish process will be locked. But in case of go that uses lightweight goroutines, is that possible to replace fork with goroutine ? -- Vasiliy Tolstov, e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru