do not perform upgrade if SD card is in the slot.

pull/404/head
Paul Philippov 2022-08-24 19:05:31 -04:00
parent c8d70fa382
commit 38ad51e8dc
1 changed files with 11 additions and 0 deletions

View File

@ -133,6 +133,14 @@ self_update() {
fi
}
check_sdcard() {
if mount | grep /mnt/mmc; then
echo_c 31 "Cannot upgrade! There is a mounted SD card!"
echo "Please remove the card from the slot and restart sysupgrade."
exit 1
fi
}
create_lock() {
[ -f /tmp/sysupgrade.lock ] && echo -e "\e[1;31m\nAnother sysupgrade process is already running!\e[0m\n" && exit 1
touch /tmp/sysupgrade.lock
@ -277,6 +285,9 @@ echo_c 37 "\nTry '$(basename "$0") --help' for options." && \
exit 0
self_update
check_sdcard
create_lock
free_resources