diff options
author | Richard Jones <rjones@centos5x32.home.annexia.org> | 2009-11-18 16:02:53 +0000 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-11-18 17:33:25 +0000 |
commit | 9c75b1554b5121a7d2b24b99badd1333769a9555 (patch) | |
tree | da621a2c49fb00c1df7d5fc99a3efce876b2ab13 | |
parent | 83eb2cf2fddbe3e06f50c18d5e651853f8d86813 (diff) | |
download | libguestfs-9c75b1554b5121a7d2b24b99badd1333769a9555.tar.gz libguestfs-9c75b1554b5121a7d2b24b99badd1333769a9555.tar.xz libguestfs-9c75b1554b5121a7d2b24b99badd1333769a9555.zip |
daemon/RHEL: Choose correct udev settle script.
On RHEL/CentOS 5.4, udevadm settle command does not work. This didn't
affect us before, but now that we're using parted for partitioning, we
*do* need to wait for udev to settle (because parted isn't waiting for
this, unlike sfdisk).
This commit chooses the correct program to run.
-rw-r--r-- | daemon/guestfsd.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index db0bff92..9375ede2 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -976,5 +976,25 @@ device_name_translation (char *device, const char *func) void udev_settle (void) { - command (NULL, NULL, "/sbin/udevadm", "settle", NULL); + static int which_prog = 0; + + if (which_prog == 0) { + if (access ("/sbin/udevsettle", X_OK) == 0) + which_prog = 2; + else if (access ("/sbin/udevadm", X_OK) == 0) + which_prog = 1; + else + which_prog = 3; + } + + switch (which_prog) { + case 1: + command (NULL, NULL, "/sbin/udevadm", "settle", NULL); + break; + case 2: + command (NULL, NULL, "/sbin/udevsettle", NULL); + break; + default: + ; + } } |