base-files: minimize critical time in sysupgrade

Attempt to minimize the time during which an interrupted nand sysupgrade
can lead to a non-functional device by flushing caches before starting
the upgrade procedure.

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
This commit is contained in:
Rodrigo Balerdi 2022-04-15 07:20:28 -03:00 committed by Daniel Golle
parent 9a2f08f6e7
commit 9ba28f978c

View file

@ -335,15 +335,16 @@ nand_upgrade_tar() {
# Recognize type of passed file and start the upgrade process # Recognize type of passed file and start the upgrade process
nand_do_upgrade() { nand_do_upgrade() {
local file_type=$(identify $1) local file_type=$(identify "$1")
[ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART=rootfs [ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART=rootfs
sync
case "$file_type" in case "$file_type" in
"fit") nand_upgrade_fit $1;; "fit") nand_upgrade_fit "$1";;
"ubi") nand_upgrade_ubinized $1;; "ubi") nand_upgrade_ubinized "$1";;
"ubifs") nand_upgrade_ubifs $1;; "ubifs") nand_upgrade_ubifs "$1";;
*) nand_upgrade_tar $1;; *) nand_upgrade_tar "$1";;
esac esac
} }