Skip to contentSkip to conversation

initramfs-live-boot: handle multiple udev locations

PATCH New Ross Burton 1 participant 1 message Jan 17, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initramfs-live-boot: handle multiple udev locations

udevd isn't on $PATH and is in different places depending on what version of udev is being used. Copy the code from initramfs-framework to search for the right udevd at boot time instead of hard-coding a location.

---
 meta/recipes-core/initrdscripts/files/init-live.sh |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
meta/recipes-core/initrdscripts/files/init-live.sh +19 -1
index 0ae359d..f0d4f22 100644
@@ -9,6 +9,23 @@ UMOUNT="/bin/umount"
 ISOLINUX=""
 UNIONFS="no"
 
+# Copied from initramfs-framework. The core of this script probably should be
+# turned into initramfs-framework modules to reduce duplication.
+udev_daemon() {
+	OPTIONS="/sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd"
+
+	for o in $OPTIONS; do
+		if [ -x "$o" ]; then
+			echo $o
+			return 0
+		fi
+	done
+
+	return 1
+}
+
+_UDEV_DAEMON=`udev_daemon`
+
 early_setup() {
     mkdir -p /proc
     mkdir -p /sys
@@ -21,7 +38,8 @@ early_setup() {
 
     mkdir -p /run
     mkdir -p /var/run
-    /lib/udev/udevd --daemon
+
+    $_UDEV_DAEMON --daemon
     udevadm trigger --action=add
 }
 
Signature · 1 line
1.7.10.4