mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1 +1 @@
|
||||
400
|
||||
401
|
||||
|
||||
Reference in New Issue
Block a user