diff options
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Guestfs.xs | 59 | ||||
-rw-r--r-- | perl/lib/Sys/Guestfs.pm | 36 |
2 files changed, 95 insertions, 0 deletions
diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs index 954d7e2e..d5f1da6b 100644 --- a/perl/Guestfs.xs +++ b/perl/Guestfs.xs @@ -642,3 +642,62 @@ PREINIT: } free (matches); +void +rm (g, path) + guestfs_h *g; + char *path; + PPCODE: + if (guestfs_rm (g, path) == -1) + croak ("rm: %s", last_error); + +void +rmdir (g, path) + guestfs_h *g; + char *path; + PPCODE: + if (guestfs_rmdir (g, path) == -1) + croak ("rmdir: %s", last_error); + +void +rm_rf (g, path) + guestfs_h *g; + char *path; + PPCODE: + if (guestfs_rm_rf (g, path) == -1) + croak ("rm_rf: %s", last_error); + +void +mkdir (g, path) + guestfs_h *g; + char *path; + PPCODE: + if (guestfs_mkdir (g, path) == -1) + croak ("mkdir: %s", last_error); + +void +mkdir_p (g, path) + guestfs_h *g; + char *path; + PPCODE: + if (guestfs_mkdir_p (g, path) == -1) + croak ("mkdir_p: %s", last_error); + +void +chmod (g, mode, path) + guestfs_h *g; + int mode; + char *path; + PPCODE: + if (guestfs_chmod (g, mode, path) == -1) + croak ("chmod: %s", last_error); + +void +chown (g, owner, group, path) + guestfs_h *g; + int owner; + int group; + char *path; + PPCODE: + if (guestfs_chown (g, owner, group, path) == -1) + croak ("chown: %s", last_error); + diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm index d3027f35..50f5d750 100644 --- a/perl/lib/Sys/Guestfs.pm +++ b/perl/lib/Sys/Guestfs.pm @@ -258,6 +258,19 @@ Because of the message protocol, there is a transfer limit of somewhere between 2MB and 4MB. To transfer large files you should use FTP. +=item $h->chmod (mode, path); + +Change the mode (permissions) of C<path> to C<mode>. Only +numeric modes are supported. + +=item $h->chown (owner, group, path); + +Change the file owner to C<owner> and group to C<group>. + +Only numeric uid and gid are supported. If you want to use +names, you will need to locate and parse the password file +yourself (Augeas support makes this relatively easy). + =item $h->config (qemuparam, qemuvalue); This can be used to add arbitrary qemu command line parameters @@ -343,6 +356,15 @@ See also C<$h-E<gt>lvs_full>. List all the logical volumes detected. This is the equivalent of the L<lvs(8)> command. The "full" version includes all fields. +=item $h->mkdir (path); + +Create a directory named C<path>. + +=item $h->mkdir_p (path); + +Create a directory named C<path>, creating any parent directories +as necessary. This is like the C<mkdir -p> shell command. + =item $h->mount (device, mountpoint); Mount a guest disk at a position in the filesystem. Block devices @@ -389,6 +411,20 @@ Note that this function cannot correctly handle binary files as end of line). For those you need to use the C<$h-E<gt>read_file> function which has a more complex interface. +=item $h->rm (path); + +Remove the single file C<path>. + +=item $h->rm_rf (path); + +Remove the file or directory C<path>, recursively removing the +contents if its a directory. This is like the C<rm -rf> shell +command. + +=item $h->rmdir (path); + +Remove the single directory C<path>. + =item $h->set_autosync (autosync); If C<autosync> is true, this enables autosync. Libguestfs will make a |