blob: fee319f987d0b390bd6cb165b68574162b3002e6 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#!/bin/sh
2
3. /lib/functions.sh
4
5num=0
6path_prefix=/sdcard
7
8link_mount() {
9 local config="$1"
10 local target
11 local path=$path_prefix
12
13 config_get target "$config" target
14 echo $target | grep "mnt" && {
15 grep -qs "$target" /proc/mounts
16 if [ $? -eq 0 ]; then
17 [ $num -gt 0 ] && path=$path$num
18 mkdir -p $path
19 /bin/mount -o noatime,move $target $path
20 echo $target mounted, soft link created:$path
21 num=$((num+1))
22 else
23 echo $target NOT mounted, removing $target
24 rmdir $target &> /dev/null
25 fi
26 }
27}
28
29config_load fstab
30
31if [ $? -eq 0 ]; then
32
33 # Create a soft link to mounted partitions
34 rm $path_prefix* &> /dev/null
35 config_foreach link_mount mount
36else
37 echo "No SD Card detected"
38fi