Prefer udev to handle /dev if mdev is also available on the system
Some systems, usually those built around BusyBox, have mdev installed
but have an option to install udev.  In those cases the user likely
prefers to use udev over mdev and this patch addresses that.
@@ -374,20 +374,13 @@ int main(int argc, char* argv[])
/*
* Populate /dev and prepare for runtime events from kernel.
+ * Prefer udev if mdev is also available on the system.
*/
- path = which("mdev");
- if (path) {
- /* Embedded Linux systems usually have BusyBox mdev */
- if (log_is_debug())
- touch("/dev/mdev.log");
-
- snprintf(cmd, sizeof(cmd), "%s -s", path);
- } else {
- /* Desktop and server distros usually have a variant of udev */
path = which("udevd");
if (!path)
path = which("/lib/systemd/systemd-udevd");
if (path) {
+ /* Desktop and server distros usually have a variant of udev */
udev = 1;
/* Register udevd as a monitored service, started much later */
@@ -399,6 +392,14 @@ int main(int argc, char* argv[])
/* Start a temporary udevd instance to populate /dev */
snprintf(cmd, sizeof(cmd), "%s --daemon", path);
+ } else {
+ path = which("mdev");
+ if (path) {
+ /* Embedded Linux systems usually have BusyBox mdev */
+ if (log_is_debug())
+ touch("/dev/mdev.log");
+
+ snprintf(cmd, sizeof(cmd), "%s -s", path);
}
}
