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.
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:
+ ;
+ }
}