base/init.sh: create static device nodes with kmod
authorHarald Hoyer <harald@redhat.com>
Tue, 30 Jul 2013 14:19:03 +0000 (16:19 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 30 Jul 2013 14:20:05 +0000 (16:20 +0200)
modules.d/99base/init.sh
modules.d/99base/module-setup.sh

index 34be478fbd20c37414c66bca98c40fb27740707f..0e4cac5598dd21b5c83d93efe3f7f4de8947d72b 100755 (executable)
@@ -81,6 +81,20 @@ if ! ismounted /run; then
     rm -fr -- /newrun
 fi
 
+if command -v kmod >/dev/null 2>/dev/null; then
+    kmod static-nodes --format=tmpfiles 2>/dev/null | \
+        while read type file mode a a a majmin; do
+        case $type in
+            d)
+                mkdir -m $mode -p $file
+                ;;
+            c)
+                mknod -m $mode $file $type ${majmin%:*} ${majmin#*:}
+                ;;
+        esac
+    done
+fi
+
 trap "action_on_fail Signal caught!" 0
 
 [ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
index 0b7c1fedf03ef8b3f9a349e272e7332524e6f933..e7466df851b9b939337f167264b846ae148bc7e8 100755 (executable)
@@ -14,11 +14,12 @@ depends() {
 
 install() {
     local _d
+
     dracut_install mount mknod mkdir sleep chroot \
         sed ls flock cp mv dmesg rm ln rmmod mkfifo umount readlink setsid
     inst $(command -v modprobe) /sbin/modprobe
 
-    dracut_install -o findmnt less
+    dracut_install -o findmnt less kmod
 
     if [ ! -e "${initdir}/bin/sh" ]; then
         dracut_install bash