mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-11-09 19:10:30 +00:00
38 lines
852 B
Bash
Executable File
38 lines
852 B
Bash
Executable File
#!/system/bin/sh
|
|
|
|
echo "external_sd init script"
|
|
|
|
# wait until boot completed
|
|
until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done
|
|
|
|
media_rw=$(grep "^/dev/block.*/mnt/media_rw" /proc/mounts \
|
|
| cut -d " " -f 2 \
|
|
| cut -d "/" -f 4)
|
|
storage="/storage/${media_rw}"
|
|
|
|
if [[ -d ${storage} ]]; then
|
|
echo ">> SD Card found"
|
|
echo ">> storage: \"${storage}\""
|
|
|
|
if [[ -e /external_sd ]]; then
|
|
link=$(ls -l /external_sd | sed -e 's/.*-> //g')
|
|
if [[ "${link}" != "${storage}" ]]; then
|
|
echo ">> removing old link: \"${link}\""
|
|
mount -orw,remount /
|
|
rm -f /external_sd
|
|
mount -oro,remount /
|
|
fi
|
|
fi
|
|
|
|
if [[ -e /external_sd ]]; then
|
|
echo ">> /external_sd link up to date"
|
|
else
|
|
echo ">> /external_sd link created"
|
|
mount -orw,remount /
|
|
ln -sf ${storage} /external_sd
|
|
mount -oro,remount /
|
|
fi
|
|
else
|
|
echo ">> no SD Card found"
|
|
fi
|