package/base-files: add support for devtmpfs (thank you rauchwolke at gmx.net)
[openwrt.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_move_devtmpfs() {
6 foo="`grep devtmpfs /proc/mounts`"
7 x=${foo#* }
8 x=${x%% *}
9
10 if [ "$x" != "/dev" ] ; then
11 mount -o move "$x" /dev
12 fi
13 }
14
15 do_mount_devfs() {
16 mount devfs /dev -t devfs
17 }
18
19 do_mount_hotplug() {
20 mount -t tmpfs tmpfs /dev -o size=512K
21 }
22
23 do_mount_udev() {
24 mount -n -t tmpfs -o mode=0755 udev /dev
25 }
26
27 choose_device_fs() {
28 if grep -q devtmpfs /proc/mounts; then
29 do_move_devtmpfs
30 elif grep -q devfs /proc/filesystems; then
31 do_mount_devfs
32 elif [ -x /sbin/hotplug2 ]; then
33 do_mount_hotplug
34 elif [ -x /sbin/udevd ]; then
35 do_mount_udev
36 fi
37 }
38
39 boot_hook_add preinit_essential choose_device_fs
40
This page took 0.041664 seconds and 5 git commands to generate.