[base-files] make basefiles aware of procd
[openwrt/svn-archive/archive.git] / package / base-files / files.old / 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 local mnt="$(grep devtmpfs /proc/mounts)"
7 mnt="${mnt#* }"; mnt="${mnt%% *}"
8
9 [ "$mnt" = "/dev" ] || mount -o noatime,move "$mnt" /dev
10 }
11
12 do_mount_devfs() {
13 mount -o noatime -t devfs devfs /dev
14 }
15
16 do_mount_hotplug() {
17 mount -t tmpfs -o noatime,mode=0755,size=512K tmpfs /dev
18 }
19
20 do_mount_udev() {
21 mount -n -t tmpfs -o noatime,mode=0755 udev /dev
22 }
23
24 choose_device_fs() {
25 if grep -q devtmpfs /proc/mounts; then
26 do_move_devtmpfs
27 elif grep -q devfs /proc/filesystems; then
28 do_mount_devfs
29 elif [ -x /sbin/hotplug2 ]; then
30 do_mount_hotplug
31 elif [ -x /sbin/udevd ]; then
32 do_mount_udev
33 fi
34 }
35
36 boot_hook_add preinit_essential choose_device_fs
37