158 Commits

Author SHA1 Message Date
Richard W.M. Jones
a3cce46557 fish: --rw option will be mandatory in 1.12 not 1.10. 2011-04-16 21:35:11 +01:00
Richard W.M. Jones
4c2bb8b301 fish: Fix typo in guestfish man page (--format option). 2011-04-16 21:26:15 +01:00
Richard W.M. Jones
11374abead fish: Allows win:... paths to work with drives mounted anywhere.
This allows you to mount disks on (eg) /c and /e and have the
guestfish win:... path mechanism map drive letters to the
right places.
2011-04-12 17:15:26 +01:00
Richard W.M. Jones
b8e1dee73a Add /etc/libguestfs-tools.conf configuration file.
This allows the default for --ro or --rw to be controlled for the
three tools guestfish, guestmount and virt-rescue.
2011-03-31 15:42:13 +01:00
Richard W.M. Jones
4e529e06a4 fish: fuse: Add -m dev:mnt:opts to allow mount options to be specified.
This lets you turn on ACLs and xattrs by doing:

  -m /dev/sda1:/:acl,user_xattr

The extra parameter is passed through to mount_options:

  libguestfs: trace: mount_options "acl,user_xattr" "/dev/sda1" "/"
2011-03-28 14:21:55 +01:00
Richard W.M. Jones
a20e5c00c3 fish: Add guestfish --live, guestmount --live options.
The other programs have the variable, but the flag is not enabled
either because it doesn't make sense or because the implications are
not well understood.
2011-02-03 18:50:45 +00:00
Richard W.M. Jones
78f1405de0 Use /var/tmp for the cached appliance (for FHS compliance).
The FHS advises large files not to be stored in the root
filesystem[1], and that /var/tmp is persistent across reboots[2]
(whereas /tmp is possibly not[3]).

Therefore we should store the large cached supermin appliance in
/var/tmp instead of /tmp.  /tmp is still used for all other temporary
files and directories.

In either case you can override this by setting $TMPDIR.

[1] http://www.pathname.com/fhs/pub/fhs-2.3.html#THEROOTFILESYSTEM
[2] http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE
[3] http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES
2011-01-19 21:47:23 +00:00
Richard W.M. Jones
c3887285ab fish: <! cmd executes a shell command and inlines the resulting commands.
The new guestfish construct "<! cmd" executes the shell command
"cmd", and then anything printed to stdout by "cmd" is parsed
and executed as a guestfish command.

This allows some very hairy shell scripting with guestfish.
2011-01-18 13:16:28 +00:00
Richard W.M. Jones
b8f9a20b03 New tools: virt-copy-in, virt-copy-out, virt-tar-in, virt-tar-out.
Relatively trivial wrappers around the equivalent guestfish
commands.  Change also includes new man pages.
2011-01-03 18:23:45 +00:00
Richard W.M. Jones
327442119f fish: --ro will be default in 1.10, not 1.8. 2010-12-20 22:33:45 +00:00
Richard W.M. Jones
e49aefd1f8 fish: Clarify documentation for --ro option. 2010-12-12 10:02:00 +00:00
Richard W.M. Jones
e6a3770b43 fish: Document equivalence of -a/add etc. in man page. 2010-12-12 10:01:30 +00:00
Richard W.M. Jones
f341624668 fish: Split ..|.. options into separate items in man page. 2010-12-12 09:48:59 +00:00
Richard W.M. Jones
d90bc32c74 fish: Link to virt-inspector from guestfish man page. 2010-11-23 10:29:26 +00:00
Richard W.M. Jones
fbc2555903 New tool: virt-filesystems
This tool replaces virt-list-filesystems and virt-list-partitions with
a new tool written in C with a more uniform command line structure
and output.

This existing Perl tools are deprecated but remain indefinitely.
2010-11-23 10:22:08 +00:00
Richard W.M. Jones
2c4a7ef92a fish: Add --rw option (does nothing yet).
This adds the guestfish --rw option, intended in future
to be required for writing to disk images.

At the moment this does not change the default and so does
nothing.  This patch is intended for backporting to the
stable branches so that we can start to introduce scripts
which use 'guestfish --rw'.
2010-11-08 10:21:48 +00:00
Richard W.M. Jones
371e83c090 fish: Add --listen --csh to for csh, tcsh compatibility.
(Thanks Eric Blake).
2010-11-05 15:39:27 +00:00
Richard W.M. Jones
be728962ff fish: Suggest safer form of eval.
eval "$(guestfish --listen)"

instead of various other forms.

(Thanks Eric Blake).
2010-11-05 15:39:24 +00:00
Richard W.M. Jones
74f7c9e4b7 fish: Make the 'help' command more helpful. 2010-11-04 17:04:03 +00:00
Richard W.M. Jones
0c1d3c02a8 fish: Specify format of disks (RHBZ#642934,CVE-2010-3851).
For libvirt guests, the disk format is copied from libvirt (if
libvirt knows it).

For command line disk images, you can use --format to override
format auto-detection.
2010-10-22 17:45:06 +01:00
Richard W.M. Jones
14490c3e1a generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).
This large commit changes the generator so that optional arguments
can be supported for functions.

The model for arguments (known as the "style") is changed from
(ret, args) to (ret, args, optargs) where optargs is a more limited
list of arguments.

One function has been added which takes optional arguments, it is
"add-drive-opts", modelled as:

  (RErr, [String "filename"], #required
         [Bool "readonly"; String "format"; String "iface"]) #optional

Note that this function is processed in the library (does not go over
the RPC protocol to the daemon).  This has allowed us to simplify
the current implementation by omitting changes related to RPC or the
daemon, although we plan to add these at some point in the future.

From C this function can be called in 3 different ways as in these
examples:

  guestfs_add_drive_opts (g, filename,
                          GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,
			  GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
                          -1);

(the argument(s) between 'filename' and '-1' are the optional ones).

  guestfs_add_drive_opts_va (g, filename, args);

where 'args' is a va_list.  This works like the first version.

  struct guestfs_add_drive_opts_argv optargs = {
    .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK,
    .readonly = 1,
  }
  guestfs_add_drive_opts_argv (g, filename, &optargs);

This last form lets you construct lists of optional arguments, and
is used by guestfish and the language bindings.

In guestfish optional arguments are used like this:

  add-drive-opts filename readonly:true

In OCaml these are mapped naturally to OCaml optional arguments, eg:

  g#add_drive_opts ~readonly:true filename;

In Perl these are mapped to extra arguments, eg:

  $g->add_drive_opts ($filename, readonly => 1);

In Python these are mapped to optional arguments, eg:

  g.add_drive_opts ("file", readonly = 1, format = "qcow2")

In Ruby these are mapped to a final hash argument, eg:

  g.add_drive_opts("file", {})
  g.add_drive_opts("file", :readonly => 1)
  g.add_drive_opts("file", :readonly => 1, :iface => "virtio")

In PHP these are mapped to extra parameters.  This is not quite
accurate since you cannot omit arbitrary optional parameters, but
there's not much than can be done within the limitations of PHP
as a language.

Unimplemented in: Haskell, C#, Java.
2010-10-22 17:45:00 +01:00
Richard W.M. Jones
406dbf7565 fish: Refresh guestfish documentation. 2010-09-26 22:21:35 +01:00
Richard W.M. Jones
d72a617a26 Document accurately how supermin appliance uses /tmp as a cache. 2010-09-24 19:28:01 +01:00
Richard W.M. Jones
d75a2bff12 fish: Implement 'hexedit' command. 2010-09-21 19:51:22 +01:00
Richard W.M. Jones
ff4ae8633e fish: Add --echo-keys option to allow passphrases/keys to be echoed.
See also:
http://catless.ncl.ac.uk/Risks/26.17.html#subj13.3
2010-09-21 10:56:47 +01:00
Richard W.M. Jones
0003ea2c3d generator: Generate guestfish-only commands.
The guestfish-only commands such as 'alloc' and 'edit' are
now generated from one place in the generator instead of being
spread around ad-hoc in the C code.
2010-09-18 09:38:05 +01:00
Richard Jones
3578f170a1 fish: Fix typo in documentation of copy-out. 2010-09-10 00:02:56 +01:00
Richard Jones
2635a9c70e fish: Implement copy-in and copy-out commands. 2010-09-09 23:12:19 +01:00
Richard Jones
639ca1828b fish: Fix 'more' command to work with any file. 2010-09-09 14:11:32 +01:00
Richard Jones
b5c287bcd4 fish: Fix 'edit' command to work with any file. 2010-09-09 14:11:20 +01:00
Richard Jones
fa918b166a fish: Allow guestfish -N help for listing prepared disk image help. 2010-09-08 09:59:32 +01:00
Richard Jones
54837f6d7b fish: Implement progress bars in guestfish.
The progress bar is updated 3 times per second, and is not displayed
at all for operations which take less than two seconds.

You can disable progress bars by using the flag --no-progress-bars,
and you can enable progress bars in non-interactive sessions with
the flag --progress-bars.

A good way to test this is to use the following command:

guestfish --progress-bars \
          -N disk:10G \
          zero-device /dev/sda

(adjust "10G" to get different lengths of time).
2010-09-01 14:20:02 +01:00
Richard Jones
4440e22f4f fish: Reimplement -i option using new C-based inspection.
Don't shell out to virt-inspector.  Instead, use the new C-based
inspection APIs.

This is much faster.

The new syntax is slightly different:

  guestfish -a disk.img -i
  guestfish -d guest -i

However, the old syntax still works.
2010-08-17 14:09:25 +01:00
Richard Jones
1a9aa565b3 fish: Add -c/--connect and -d/--domain options.
The -d option lets you specify libvirt domains.  The disks from
these domains are found and added, as if you'd named them with -a.

The -c option lets you specify a libvirt URI, which is needed
when we consult libvirt to implement the above.
2010-08-17 14:09:25 +01:00
Richard Jones
637f8df837 New APIs: Support for opening LUKS-encrypted disks.
This adds support for opening LUKS-encrypted disks, via
three new APIs:

  luks_open:    Create a mapping for an encrypted disk.
  luks_open_ro: Same, but read-only mapping.
  luks_close:   Close a mapping.

A typical guestfish session using this functionality looks
like this:

  $ guestfish --ro -a encrypted.img
  ><fs> run
  ><fs> list-devices
  /dev/vda
  ><fs> list-partitions
  /dev/vda1
  /dev/vda2
  ><fs> vfs-type /dev/vda2
  crypto_LUKS
  ><fs> luks-open /dev/vda2 luksdev
  Enter key or passphrase ("key"):
  ><fs> vgscan
  ><fs> vg-activate-all true
  ><fs> pvs
  /dev/dm-0
  ><fs> vgs
  vg_f13x64encrypted
  ><fs> lvs
  /dev/vg_f13x64encrypted/lv_root
  /dev/vg_f13x64encrypted/lv_swap
  ><fs> mount /dev/vg_f13x64encrypted/lv_root /
  ><fs> ll /
  total 132
  dr-xr-xr-x.  24 root root  4096 Jul 21 12:01 .
  dr-xr-xr-x   20 root root     0 Jul 21 20:06 ..
  drwx------.   3 root root  4096 Jul 21 11:59 .dbus
  drwx------.   2 root root  4096 Jul 21 12:00 .pulse
  -rw-------.   1 root root   256 Jul 21 12:00 .pulse-cookie
  dr-xr-xr-x.   2 root root  4096 May 13 03:03 bin

NOT included in this patch:

 - An easier way to use this from guestfish.
 - Ability to create LUKS devices.
 - Ability to change LUKS keys on existing devices.
 - Direct access to the /dev/mapper device (eg. if it contains
   anything apart from VGs).
2010-07-21 20:48:40 +01:00
Richard Jones
581a7965fa generator: Add 'Key' parameter type.
Add a 'Key' parameter type, used for passing sensitive key material
into libguestfs.

Eventually the plan is to mlock() key material into memory.  However
this is very difficult to achieve because the encoded XDR strings
end up in many places.  Therefore users should note that key material
passed to libguestfs might end up in swap.

The only difference between 'Key' and 'String' currently is that
guestfish requests the key from /dev/tty with echoing turned off.
2010-07-21 19:49:22 +01:00
Richard Jones
21bd2db7cf fish: Don't eat words when completing case-insensitive paths (RHBZ#582993). 2010-05-25 13:59:44 +01:00
Richard Jones
06d8064ff8 fish: Document test1.img, test2.img etc used by -N option in FILES section. 2010-05-25 13:52:17 +01:00
Richard Jones
7fd6e4bfb1 fish: Create a separate FILES section in the manpage. 2010-05-25 13:51:58 +01:00
Richard Jones
34a306ab2a fish: Move 'EXIT CODE' section to a more logical place in the documentation. 2010-05-25 13:41:39 +01:00
Richard Jones
57cc217335 fish: Make the read/write warning more prominent.
Follow the example on other manual pages by making the warning
more prominent.
2010-05-25 11:44:43 +01:00
Richard Jones
c9f1a45334 fish: New command: 'supported'
This checks all available optional groups and prints out which
ones are supported by the daemon.  Note you must launch the appliance
first.

Example:

><fs> supported
      augeas yes
     inotify yes
 linuxfsuuid yes
linuxmodules yes
 linuxxattrs yes
        lvm2 yes
       mknod yes
      ntfs3g yes
   ntfsprogs yes
    realpath yes
       scrub yes
     selinux yes
          xz yes
    zerofree yes
2010-05-25 11:31:11 +01:00
Richard Jones
5e1aff7856 fish: Allow suffixes on number parameters (eg. 1M)
This small change uses the gnulib xstrtoll functionality to
enable suffixes on integer parameters in guestfish.  For example:

 truncate-size /file 1G

(previously you would have had to given the full number).

This also applies to the 'alloc' and 'sparse' commands (and
indirectly to the -N option).  The specification for these commands
has changed slightly, in that 'alloc foo 1MB' would now use SI
units, allocating 1000000 bytes instead of a true megabyte.  All
existing uses would use 'alloc foo 1M' which still allocates true
megabytes.
2010-05-21 14:51:53 +01:00
Richard Jones
3920ad95f6 New API: write for creating files with fixed content (RHBZ#501889).
The guestfs_write call can be used to create small files with
arbitrary 8 bit content, including \0 bytes.

This replaces and deprecates write-file, which cannot be modified
to use BufferIn because of an unfortunate choice in the ABI: the
size parameter to write-file, if zero, means that the daemon tries
to calculate the length of the buffer using strlen.  However this
fails if we pass a zero-length buffer using BufferIn because then
the daemon tries to do strlen on a (really) zero length buffer, not
even containing a terminating \0 character, thus segfaulting.
2010-05-20 10:30:12 +01:00
Richard Jones
846238a031 fish -N option unconditionally overwrites test*.img files.
This is more convenient and makes it consistent with the
'alloc' and 'sparse' commands.
2010-05-08 09:09:24 +01:00
Richard Jones
78d2523ec8 fish: Add 'man' command which opens the manual. 2010-04-24 09:11:37 +01:00
Richard Jones
ce95be8b18 docs: Routine refresh of the documentation for guestfs(3) and guestfish(1). 2010-04-24 08:50:40 +01:00
Richard Jones
4a9b979a31 fish: Add -N option for making prepared disk images.
Previously you might have typed:

$ guestfish
><fs> alloc test1.img 100M
><fs> run
><fs> part-disk /dev/sda mbr
><fs> mkfs ext4 /dev/sda1

now you can do the same with:

$ guestfish -N fs:ext4

Some tests have also been updated to use this new
functionality.
2010-04-22 18:07:11 +01:00
Richard Jones
89486c50ea fish docs: Be consistent about using I<-..> for options. 2010-04-22 17:16:13 +01:00
Richard Jones
e3e67f63b0 fish docs: Use L</...> for internal links in the man page. 2010-04-22 17:16:13 +01:00