unmount sdcard, check for autoupdate files.

pull/411/head
Paul Philippov 2022-08-25 12:09:35 -04:00
parent 5111f09276
commit 3a27a3fcba
1 changed files with 15 additions and 5 deletions

View File

@ -130,11 +130,21 @@ self_update() {
}
check_sdcard() {
if mount | grep /mnt/mmc >/dev/null; then
echo_c 31 "\nCannot upgrade! There is a mounted SD card in the slot!"
echo_c 37 "Please remove the card from the slot and restart sysupgrade."
exit 1
fi
echo_c 33 "\nUnmounting SD card"
stoplist="autoupdate-kernel.img autoupdate-rootfs.img autoupdate-uboot.img"
while [ -n "$(mount | grep /mnt/mmc)" ]; do
_d=$(mount | grep /mnt/mmc | tail -1 | awk '{print $1}')
echo_c 34 "$_d"
for _f in $stoplist; do
echo "- checking for ${_d}/${_f}"
if [ -f "${_d}/${_f}" ]; then
echo_c 31 "\nCannot upgrade! Recovery file ${_d}/${_f} found on the mounted SD card!"
echo_c 37 "Please remove the card from the slot and restart sysupgrade."
exit 1
fi
done; unset _f
umount $_d
done; unset _d
}
create_lock() {