On Mon, Jan 20, 2014 at 04:39:42PM +0100, Olaf Hering wrote:
Is "luks-format" supposed to work with guestfish? Like guestfish <<EOF luks-format /dev/sda4 0 EOF
Appearently it lacks an option to give the passphrase programmatically. Was this option skipped on purpose?
The underlying API takes a passphrase parameter, ie: guestfs_luks_format (guestfs_h *g, const char *device, const char *key, <<-- this one int keyslot); However the mapping between the API and guestfish intentionally omits these key/passphrase parameters. Instead guestfish is supposed to prompt for a passphrase. It does this using /dev/tty so you have to have a human type the passphrase. If you want to do this programmatically [apart from using a pty, tools like 'expect', or another API eg. C, Perl or whatever], you can use the guestfish option '--keys-from-stdin'. You still have to work out a way to supply the passphrase to stdin. For example: $ echo 123456 | guestfish -x --keys-from-stdin -N part luks-format /dev/sda1 0 libguestfs: trace: add_drive "test1.img" "format:raw" libguestfs: trace: add_drive = 0 libguestfs: trace: is_config libguestfs: trace: is_config = 1 libguestfs: trace: launch libguestfs: trace: get_tmpdir libguestfs: trace: get_tmpdir = "/tmp" libguestfs: trace: get_cachedir libguestfs: trace: get_cachedir = "/var/tmp" libguestfs: trace: get_cachedir libguestfs: trace: get_cachedir = "/var/tmp" libguestfs: trace: launch = 0 libguestfs: trace: part_disk "/dev/sda" "mbr" libguestfs: trace: part_disk = 0 libguestfs: trace: luks_format "/dev/sda1" "***" 0 libguestfs: trace: luks_format = 0 libguestfs: trace: shutdown libguestfs: trace: internal_autosync libguestfs: trace: internal_autosync = 0 libguestfs: trace: shutdown = 0 libguestfs: trace: close Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#)