summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-05-01 11:00:34 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-05-01 11:00:34 +0100
commit3cb794463a62239e36d730bc5d2d3eb4c7a66096 (patch)
treedca98ab21d35f7078879ec7fac98bd10b4f432bf /src
parentaf5087450063fe013ac2df4db39451d7da6152a3 (diff)
downloadlibguestfs-3cb794463a62239e36d730bc5d2d3eb4c7a66096.tar.gz
libguestfs-3cb794463a62239e36d730bc5d2d3eb4c7a66096.tar.xz
libguestfs-3cb794463a62239e36d730bc5d2d3eb4c7a66096.zip
Add cp, cp-a and mv commands.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/generator.ml45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/generator.ml b/src/generator.ml
index ba97debe..bb550f1d 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -1692,6 +1692,51 @@ any partition tables, filesystem superblocks and so on.");
This command installs GRUB (the Grand Unified Bootloader) on
C<device>, with the root directory being C<root>.");
+ ("cp", (RErr, [String "src"; String "dest"]), 87, [],
+ [InitBasicFS, TestOutput (
+ [["write_file"; "/old"; "file content"; "0"];
+ ["cp"; "/old"; "/new"];
+ ["cat"; "/new"]], "file content");
+ InitBasicFS, TestOutputTrue (
+ [["write_file"; "/old"; "file content"; "0"];
+ ["cp"; "/old"; "/new"];
+ ["is_file"; "/old"]]);
+ InitBasicFS, TestOutput (
+ [["write_file"; "/old"; "file content"; "0"];
+ ["mkdir"; "/dir"];
+ ["cp"; "/old"; "/dir/new"];
+ ["cat"; "/dir/new"]], "file content")],
+ "copy a file",
+ "\
+This copies a file from C<src> to C<dest> where C<dest> is
+either a destination filename or destination directory.");
+
+ ("cp_a", (RErr, [String "src"; String "dest"]), 88, [],
+ [InitBasicFS, TestOutput (
+ [["mkdir"; "/olddir"];
+ ["mkdir"; "/newdir"];
+ ["write_file"; "/olddir/file"; "file content"; "0"];
+ ["cp_a"; "/olddir"; "/newdir"];
+ ["cat"; "/newdir/olddir/file"]], "file content")],
+ "copy a file or directory recursively",
+ "\
+This copies a file or directory from C<src> to C<dest>
+recursively using the C<cp -a> command.");
+
+ ("mv", (RErr, [String "src"; String "dest"]), 89, [],
+ [InitBasicFS, TestOutput (
+ [["write_file"; "/old"; "file content"; "0"];
+ ["mv"; "/old"; "/new"];
+ ["cat"; "/new"]], "file content");
+ InitBasicFS, TestOutputFalse (
+ [["write_file"; "/old"; "file content"; "0"];
+ ["mv"; "/old"; "/new"];
+ ["is_file"; "/old"]])],
+ "move a file",
+ "\
+This moves a file from C<src> to C<dest> where C<dest> is
+either a destination filename or destination directory.");
+
]