New API: cp-r

This runs 'cp -rP' and is useful for copying when the target
doesn't support file owners or permissions (ie. FAT).
This commit is contained in:
Richard W.M. Jones
2013-05-09 15:35:08 +01:00
parent e7e8a1bfef
commit d661456225
3 changed files with 29 additions and 1 deletions

View File

@@ -42,6 +42,12 @@ do_cp_a (const char *src, const char *dest)
return cpmv_cmd (str_cp, "-a", src, dest);
}
int
do_cp_r (const char *src, const char *dest)
{
return cpmv_cmd (str_cp, "-rP", src, dest);
}
int
do_mv (const char *src, const char *dest)
{

View File

@@ -11146,6 +11146,28 @@ about the contents of this file, see L<extlinux(1)>.
See also C<guestfs_syslinux>." };
{ defaults with
name = "cp_r";
style = RErr, [Pathname "src"; Pathname "dest"], [];
proc_nr = Some 401;
tests = [
InitScratchFS, Always, TestResultString (
[["mkdir"; "/cp_r1"];
["mkdir"; "/cp_r2"];
["write"; "/cp_r1/file"; "file content"];
["cp_r"; "/cp_r1"; "/cp_r2"];
["cat"; "/cp_r2/cp_r1/file"]], "file content")
];
shortdesc = "copy a file or directory recursively";
longdesc = "\
This copies a file or directory from C<src> to C<dest>
recursively using the C<cp -rP> command.
Most users should use C<guestfs_cp_a> instead. This command
is useful when you don't want to preserve permissions, because
the target filesystem does not support it (primarily when
writing to DOS FAT filesystems)." };
]
(* Non-API meta-commands available only in guestfish.

View File

@@ -1 +1 @@
400
401