[package] base-files: preinit: get rid of /dev/null redirections and use grep -q...
[openwrt/svn-archive/archive.git] / package / base-files / files / lib / preinit / 30_device_fs_daemons
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
4
5 init_devfs() {
6 HOTPLUG=/sbin/hotplug-call
7 }
8
9 init_hotplug2() {
10 [ -c /dev/console ] || mknod /dev/console c 5 1
11 /sbin/hotplug2 --set-worker /lib/hotplug2/worker_fork.so --set-rules-file /etc/hotplug2-init.rules --no-persistent --set-coldplug-cmd /sbin/udevtrigger
12 /sbin/hotplug2 --set-worker /lib/hotplug2/worker_fork.so --set-rules-file /etc/hotplug2-init.rules --persistent &
13 }
14
15 init_udev() {
16 [ -d /lib/udev/devices ] && cp -af /lib/udev/devices/* /dev/
17 [ -c /dev/console ] || mknod -m 0600 /dev/console c 5 1
18 [ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
19 /sbin/udevd --daemon --resolve-names=never
20 /sbin/udevadm trigger
21 /sbin/udevadm settle
22 }
23
24 init_device_fs() {
25 HOTPLUG=
26 if grep -q devfs /proc/filesystems; then
27 init_devfs
28 elif [ -x /sbin/hotplug2 ]; then
29 init_hotplug2
30 elif [ -x /sbin/udevd ]; then
31 init_udev
32 fi
33 }
34
35 boot_hook_add preinit_essential init_device_fs
36