[backfire] merge r23908
[openwrt-10.03/.git] / package / base-files / files / lib / preinit / 20_device_fs_mount
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
4
5 do_mount_devfs() {
6     mount devfs /dev -t devfs
7 }
8
9 do_mount_hotplug() {
10     mount -t tmpfs tmpfs /dev -o mode=0755,size=512K
11 }
12
13 do_mount_udev() {
14     mount -n -t tmpfs -o mode=0755 udev /dev
15 }
16
17 choose_device_fs() {
18     if grep -q devfs /proc/filesystems; then
19         do_mount_devfs
20     elif [ -x /sbin/hotplug2 ]; then
21         do_mount_hotplug
22     elif [ -x /sbin/udevd ]; then
23         do_mount_udev
24     fi
25 }
26
27 boot_hook_add preinit_essential choose_device_fs
28