mirror of https://github.com/OpenIPC/firmware.git
Add mdev support
parent
040c0b2255
commit
7d42d62423
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Start mdev....
|
||||
#
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting mdev..."
|
||||
# echo /sbin/mdev >/proc/sys/kernel/hotplug
|
||||
/sbin/mdev -s
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
restart|reload)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
|
@ -0,0 +1,22 @@
|
|||
# Provide user, group, and mode information for devices. If a regex matches
|
||||
# the device name provided by sysfs, use the appropriate user:group and mode
|
||||
# instead of the default 0:0 660.
|
||||
#
|
||||
# Syntax:
|
||||
# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
||||
# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
||||
# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
||||
#
|
||||
# [-]: do not stop on this match, continue reading mdev.conf
|
||||
# =: move, >: move and create a symlink
|
||||
# !: do not create device node
|
||||
# @|$|*: run@cmd if $ACTION=add, $cmd if $ACTION=remove, *cmd in all cases
|
||||
#
|
||||
#
|
||||
#
|
||||
mmcblk[0-9] root:disk 660
|
||||
mmcblk[0-9]p[0-9] root:disk 660 *(/lib/mdev/automount.sh)
|
||||
#
|
||||
sd[a-z] root:disk 660
|
||||
sd[a-z] [0-9] root:disk 660 *(/lib/mdev/automount.sh)
|
||||
#
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
destdir=/mnt
|
||||
|
||||
my_umount()
|
||||
{
|
||||
if grep -qs "^/dev/$1 " /proc/mounts ; then
|
||||
umount "${destdir}/$1";
|
||||
fi
|
||||
|
||||
[ -d "${destdir}/$1" ] && rmdir "${destdir}/$1"
|
||||
}
|
||||
|
||||
my_mount()
|
||||
{
|
||||
mkdir -p "${destdir}/$1" || exit 1
|
||||
|
||||
if ! mount -t auto -o sync "/dev/$1" "${destdir}/$1"; then
|
||||
# failed to mount, clean up mountpoint
|
||||
rmdir "${destdir}/$1"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "${ACTION}" in
|
||||
add|"")
|
||||
my_umount ${MDEV}
|
||||
my_mount ${MDEV}
|
||||
;;
|
||||
remove)
|
||||
my_umount ${MDEV}
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue