2 # Copyright (C) 2009-2012 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 .
/lib
/functions
/block.sh
10 blkdev
=`dirname $DEVPATH`
11 if [ `basename $blkdev` != "block" ]; then
13 device
=`basename $DEVPATH`
14 mountpoint
=`sed -ne "s|^[^ ]*/$device ||; T; s/ .*//p" /proc/self/mounts`
23 local mds_mount_target
24 local mds_mount_device
25 local mds_mount_fstype
31 local autoswap_from_fstab
32 local automount_from_fstab
34 mount_dev_section_cb
() {
38 mds_mount_enabled
="$6"
41 swap_dev_section_cb
() {
47 automount_from_fstab
="$from_fstab"
48 [ "$automount_from_fstab" -eq 1 ] && {
49 config_get_mount_section_by_device
"/dev/$device"
50 use_device
="$mds_mount_device"
51 [ "$mds_mount_enabled" -eq 1 ] && {
52 if [ -n "$mds_mount_target" ]; then
53 grep -q "/dev/$device" /proc
/swaps ||
grep -q "/dev/$device" /proc
/mounts ||
{
54 ( mkdir
-p "$mds_mount_target" && mount
"$mds_mount_target" ) 2>&1 |
tee /proc
/self
/fd
/2 | logger
-t 'fstab'
57 logger
-t 'fstab' "Mount enabled for $mds_mount_device but it doesn't have a defined mountpoint (target)"
62 [ -z "$use_device" ] && {
64 autoswap_from_fstab
="$from_fstab"
66 [ "$autoswap_from_fstab" -eq 1 ] && {
67 config_get_swap_section_by_device
"/dev/$device"
68 use_device
="$sds_swap_device"
72 grep -q "/dev/$device" /proc
/swaps ||
grep -q "/dev/$device" /proc
/mounts ||
{
73 [ "$anon_mount" -eq 1 -a -z "$use_device" ] && {
77 ( mkdir
-p /mnt
/$device && mount
/dev
/$device /mnt
/$device ) 2>&1 |
tee /proc
/self
/fd
/2 | logger
-t 'fstab'