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

Last change on this file since 23908 was 23908, checked in by jow, 6 years ago

[package] base-files: change /dev permissions to 0755 when hotplug2 is used (#6039)

File size: 786 bytes
Line 
1#!/bin/sh
2# Copyright (C) 2006 OpenWrt.org
3# Copyright (C) 2010 Vertical Communications
4
5do_move_devtmpfs() {
6    local mnt="$(grep devtmpfs /proc/mounts)"
7          mnt="${mnt#* }"; mnt="${mnt%% *}"
8
9    [ "$mnt" = "/dev" ] || mount -o move "$mnt" /dev
10}
11
12do_mount_devfs() {
13    mount devfs /dev -t devfs
14}
15
16do_mount_hotplug() {
17    mount -t tmpfs tmpfs /dev -o mode=0755,size=512K
18}
19
20do_mount_udev() {
21    mount -n -t tmpfs -o mode=0755 udev /dev
22}
23
24choose_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
36boot_hook_add preinit_essential choose_device_fs
37
Note: See TracBrowser for help on using the repository browser.