source: trunk/package/base-files/files/lib/preinit/20_device_fs_mount @ 22379

Last change on this file since 22379 was 22379, checked in by acoul, 6 years ago

package/base-files: add support for devtmpfs (thank you rauchwolke at gmx.net)

File size: 768 bytes
Line 
1#!/bin/sh
2# Copyright (C) 2006 OpenWrt.org
3# Copyright (C) 2010 Vertical Communications
4
5do_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
15do_mount_devfs() {
16    mount devfs /dev -t devfs
17}
18
19do_mount_hotplug() {
20    mount -t tmpfs tmpfs /dev -o size=512K
21}
22
23do_mount_udev() {
24    mount -n -t tmpfs -o mode=0755 udev /dev
25}
26
27choose_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
39boot_hook_add preinit_essential choose_device_fs
40
Note: See TracBrowser for help on using the repository browser.