search for: guestfs_is_dir

Displaying 20 results from an estimated 58 matches for "guestfs_is_dir".

2015 Jun 02
1
[PATCH 2/3] inspection: Add support for CoreOS
...s.c index a2913d6..0fbd26c 100644 --- a/src/inspect-fs.c +++ b/src/inspect-fs.c @@ -232,6 +232,17 @@ check_filesystem (guestfs_h *g, const char *mountable, if (guestfs_int_check_linux_root (g, fs) == -1) return -1; } + /* CoreOS root? */ + else if (is_dir_etc && + guestfs_is_dir (g, "/root") > 0 && + guestfs_is_dir (g, "/home") > 0 && + guestfs_is_dir (g, "/usr") > 0 && + guestfs_is_file (g, "/etc/coreos/update.conf") > 0) { + fs->is_root = 1; + fs->format...
2015 May 29
2
[PATCH 2/3] inspection: Add support for CoreOS
...s.c index 5f55f1d..64f904f 100644 --- a/src/inspect-fs.c +++ b/src/inspect-fs.c @@ -232,6 +232,17 @@ check_filesystem (guestfs_h *g, const char *mountable, if (guestfs_int_check_linux_root (g, fs) == -1) return -1; } + /* CoreOS root? */ + else if (is_dir_etc && + guestfs_is_dir (g, "/root") > 0 && + guestfs_is_dir (g, "/home") > 0 && + guestfs_is_dir (g, "/usr") > 0 && + guestfs_is_file (g, "/etc/coreos/update.conf") > 0) { + fs->is_root = 1; + fs->format...
2010 Aug 02
5
[PATCH v3 0/5] Inspection code in C
The first three patches were posted previously: https://www.redhat.com/archives/libguestfs/2010-July/msg00082.html The last two patches in this series change guestfish -i to use this new code. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to
2010 Jul 29
4
[PATCH 0/3] Inspection code in C
These three patches (two were previously posted) can do simple operating system inspection in C. Example of use: ><fs> add-ro rhel55.img ><fs> run ><fs> inspect-os /dev/VolGroup00/LogVol00 ><fs> inspect-get-type /dev/VolGroup00/LogVol00 linux ><fs> inspect-get-distro /dev/VolGroup00/LogVol00 rhel ><fs> inspect-get-arch
2010 Aug 17
8
[PATCH v4 0/8] Inspection code in C
Previously discussed here: https://www.redhat.com/archives/libguestfs/2010-August/msg00002.html -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
2015 Sep 29
2
Re: [PATCH 2/2] copy-in: error out early if the localpath does not exist (RHBZ#1267032)
...> CLEANUP_FREE char *tar_buf = NULL; > + struct stat statbuf; > + > + if (stat (localpath, &statbuf) == -1) { > + error (g, _("source '%s' does not exist (or cannot be read)"), localpath); > + return -1; > + } > > int remote_is_dir = guestfs_is_dir (g, remotedir); > if (remote_is_dir == -1) NACK. See the patch series I just posted. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. S...
2016 Feb 24
2
[PATCH] inspect: check also /etc/hosts for detecting Linux root (RHBZ#1203898)
...rc/inspect-fs.c b/src/inspect-fs.c index 02fdb2a..ad175f8 100644 --- a/src/inspect-fs.c +++ b/src/inspect-fs.c @@ -217,7 +217,8 @@ check_filesystem (guestfs_h *g, const char *mountable, (is_dir_bin || (guestfs_is_symlink (g, "/bin") > 0 && guestfs_is_dir (g, "/usr/bin") > 0)) && - guestfs_is_file (g, "/etc/fstab") > 0) { + (guestfs_is_file (g, "/etc/fstab") > 0 || + guestfs_is_file (g, "/etc/hosts") > 0)) { fs->is_root = 1; fs->format = OS_FOR...
2015 Sep 29
2
[PATCH 1/2] copy-in: print tar stderr when it fails
...) { CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); - int fd; + int fd, err_fd; int r; char fdbuf[64]; size_t buf_len = strlen (localpath) + 1; char buf[buf_len]; const char *dirname, *basename; + CLEANUP_FREE char *tar_buf = NULL; int remote_is_dir = guestfs_is_dir (g, remotedir); if (remote_is_dir == -1) @@ -67,7 +69,7 @@ guestfs_impl_copy_in (guestfs_h *g, const char *localpath, const char *remotedir guestfs_int_cmd_add_arg (cmd, "-"); guestfs_int_cmd_add_arg (cmd, basename); - r = guestfs_int_cmd_run_async (cmd, NULL, NULL, &fd, N...
2015 Feb 02
1
Re: [PATCH 5/6] New APIs: copy-in and copy-out
...th, const char *remotedir) > +{ > + CLEANUP_CMD_CLOSE struct command *cmd = guestfs___new_command (g); > + int fd; > + int r; > + char fdbuf[64]; > + size_t buf_len = strlen (localpath) + 1; > + char buf[buf_len]; > + const char *dirname, *basename; > + > + if (guestfs_is_dir (g, remotedir) == -1) > + return -1; I suppose this is here to check that remotedir is a directory, but that's not what the code here does. The original guestfish code is: int remote_is_dir = guestfs_is_dir (g, remote); if (remote_is_dir == -1) return -1; if (!remote_is_dir)...
2016 Mar 17
2
[PATCH] inspect: improve UsrMove detection (RHBZ#1186935)
...stem. If it does, add * another entry in g->fses. @@ -215,8 +216,7 @@ check_filesystem (guestfs_h *g, const char *mountable, /* Linux root? */ else if (is_dir_etc && (is_dir_bin || - (guestfs_is_symlink (g, "/bin") > 0 && - guestfs_is_dir (g, "/usr/bin") > 0)) && + is_symlink_to (g, "/bin", "usr/bin") > 0) && guestfs_is_file (g, "/etc/fstab") > 0) { fs->is_root = 1; fs->format = OS_FORMAT_INSTALLED; @@ -366,6 +366,22 @@ get_partit...
2015 Sep 30
1
[PATCH v2] copy-in: error out early if the localpath does not exist
...= strlen (localpath) + 1; char buf[buf_len]; const char *dirname, *basename; + struct stat statbuf; + + if (stat (localpath, &statbuf) == -1) { + error (g, _("source '%s' does not exist (or cannot be read)"), localpath); + return -1; + } int remote_is_dir = guestfs_is_dir (g, remotedir); if (remote_is_dir == -1) -- 2.1.0
2011 Mar 22
1
[PATCH] inspect: Don't fail for Windows guests with multiple disks (RHBZ#674130).
...ENT_WINDOWS_VOLUME, FS_CONTENT_LINUX_BOOT, FS_CONTENT_LINUX_USR, FS_CONTENT_LINUX_USR_LOCAL, diff --git a/src/inspect.c b/src/inspect.c index 20e8806..716d592 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -366,9 +366,13 @@ check_filesystem (guestfs_h *g, const char *device, guestfs_is_dir (g, "/run") > 0 && guestfs_is_dir (g, "/spool") > 0) fs->content = FS_CONTENT_LINUX_VAR; - /* Windows root? */ + /* Windows root? + * Note that if a Windows guest has multiple disks and applications + * are installed on those other disks,...
2015 Jan 26
6
[PATCH 1/6] cmd: add a way to run (and wait) asynchronously commands
--- src/command.c | 64 +++++++++++++++++++++++++++++++++++++++++++------- src/guestfs-internal.h | 3 +++ 2 files changed, 58 insertions(+), 9 deletions(-) diff --git a/src/command.c b/src/command.c index 4bb469b..e26573d 100644 --- a/src/command.c +++ b/src/command.c @@ -360,7 +360,7 @@ debug_command (struct command *cmd) } static int -run_command (struct command *cmd)
2015 Jan 26
0
[PATCH 5/6] New APIs: copy-in and copy-out
...uestfs__copy_in (guestfs_h *g, const char *localpath, const char *remotedir) +{ + CLEANUP_CMD_CLOSE struct command *cmd = guestfs___new_command (g); + int fd; + int r; + char fdbuf[64]; + size_t buf_len = strlen (localpath) + 1; + char buf[buf_len]; + const char *dirname, *basename; + + if (guestfs_is_dir (g, remotedir) == -1) + return -1; + + if (split_path (buf, buf_len, localpath, &dirname, &basename) == -1) + return -1; + + guestfs___cmd_add_arg (cmd, "tar"); + if (dirname) { + guestfs___cmd_add_arg (cmd, "-C"); + guestfs___cmd_add_arg (cmd, dirname); +...
2017 Feb 15
1
[PATCH v2] copy-out: new optional arguments
...const struct guestfs_copy_out_opts_argv *optargs) { struct stat statbuf; int r; @@ -170,6 +171,7 @@ guestfs_impl_copy_out (guestfs_h *g, struct copy_out_child_data data; char fdbuf[64]; int fd; + struct guestfs_tar_out_opts_argv tar_optargs = { .bitmask = 0 }; r = guestfs_is_dir (g, remotepath); if (r == -1) @@ -210,7 +212,28 @@ guestfs_impl_copy_out (guestfs_h *g, snprintf (fdbuf, sizeof fdbuf, "/dev/fd/%d", fd); - r = guestfs_tar_out (g, remotepath, fdbuf); + if (optargs->bitmask & GUESTFS_COPY_OUT_OPTS_NUMERICOWNER_BITMASK) { +...
2015 Sep 29
0
[PATCH 2/2] copy-in: error out early if the localpath does not exist (RHBZ#1267032)
...buf_len]; const char *dirname, *basename; CLEANUP_FREE char *tar_buf = NULL; + struct stat statbuf; + + if (stat (localpath, &statbuf) == -1) { + error (g, _("source '%s' does not exist (or cannot be read)"), localpath); + return -1; + } int remote_is_dir = guestfs_is_dir (g, remotedir); if (remote_is_dir == -1) -- 2.1.0
2015 Sep 29
0
Re: [PATCH 2/2] copy-in: error out early if the localpath does not exist (RHBZ#1267032)
...L; > > + struct stat statbuf; > > + > > + if (stat (localpath, &statbuf) == -1) { > > + error (g, _("source '%s' does not exist (or cannot be read)"), localpath); > > + return -1; > > + } > > > > int remote_is_dir = guestfs_is_dir (g, remotedir); > > if (remote_is_dir == -1) > > NACK. See the patch series I just posted. Would patch #2 be acceptable anyway, as simple starting check? -- Pino Toscano
2016 Feb 24
0
Re: [PATCH] inspect: check also /etc/hosts for detecting Linux root (RHBZ#1203898)
...> index 02fdb2a..ad175f8 100644 > --- a/src/inspect-fs.c > +++ b/src/inspect-fs.c > @@ -217,7 +217,8 @@ check_filesystem (guestfs_h *g, const char *mountable, > (is_dir_bin || > (guestfs_is_symlink (g, "/bin") > 0 && > guestfs_is_dir (g, "/usr/bin") > 0)) && > - guestfs_is_file (g, "/etc/fstab") > 0) { > + (guestfs_is_file (g, "/etc/fstab") > 0 || > + guestfs_is_file (g, "/etc/hosts") > 0)) { /etc/hosts could be present on any U...
2016 Mar 17
0
Re: [PATCH] inspect: improve UsrMove detection (RHBZ#1186935)
...ther entry in g->fses. > @@ -215,8 +216,7 @@ check_filesystem (guestfs_h *g, const char *mountable, > /* Linux root? */ > else if (is_dir_etc && > (is_dir_bin || > - (guestfs_is_symlink (g, "/bin") > 0 && > - guestfs_is_dir (g, "/usr/bin") > 0)) && > + is_symlink_to (g, "/bin", "usr/bin") > 0) && > guestfs_is_file (g, "/etc/fstab") > 0) { > fs->is_root = 1; > fs->format = OS_FORMAT_INSTALLED; > @@ -36...
2017 Feb 14
0
[PATCH 06/10] copy-out: new 'excludes' optional argument
...const struct guestfs_copy_out_opts_argv *optargs) { struct stat statbuf; int r; @@ -170,6 +171,7 @@ guestfs_impl_copy_out (guestfs_h *g, struct copy_out_child_data data; char fdbuf[64]; int fd; + struct guestfs_tar_out_opts_argv tar_optargs = { .bitmask = 0 }; r = guestfs_is_dir (g, remotepath); if (r == -1) @@ -210,7 +212,12 @@ guestfs_impl_copy_out (guestfs_h *g, snprintf (fdbuf, sizeof fdbuf, "/dev/fd/%d", fd); - r = guestfs_tar_out (g, remotepath, fdbuf); + if (optargs->bitmask & GUESTFS_COPY_OUT_OPTS_EXCLUDES_BITMASK) { + tar_...