base/init.sh: create static device nodes with kmod
[platform/upstream/dracut.git] / modules.d / 99base / init.sh
index 34be478..0e4cac5 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