blob: fee319f987d0b390bd6cb165b68574162b3002e6 [file] [log] [blame]
#!/bin/sh
. /lib/functions.sh
num=0
path_prefix=/sdcard
link_mount() {
local config="$1"
local target
local path=$path_prefix
config_get target "$config" target
echo $target | grep "mnt" && {
grep -qs "$target" /proc/mounts
if [ $? -eq 0 ]; then
[ $num -gt 0 ] && path=$path$num
mkdir -p $path
/bin/mount -o noatime,move $target $path
echo $target mounted, soft link created:$path
num=$((num+1))
else
echo $target NOT mounted, removing $target
rmdir $target &> /dev/null
fi
}
}
config_load fstab
if [ $? -eq 0 ]; then
# Create a soft link to mounted partitions
rm $path_prefix* &> /dev/null
config_foreach link_mount mount
else
echo "No SD Card detected"
fi