b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | . /lib/functions.sh |
| 4 | |
| 5 | num=0 |
| 6 | path_prefix=/sdcard |
| 7 | |
| 8 | link_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 | |
| 29 | config_load fstab |
| 30 | |
| 31 | if [ $? -eq 0 ]; then |
| 32 | |
| 33 | # Create a soft link to mounted partitions |
| 34 | rm $path_prefix* &> /dev/null |
| 35 | config_foreach link_mount mount |
| 36 | else |
| 37 | echo "No SD Card detected" |
| 38 | fi |