aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
authorRodrigo Balerdi <lanchon@gmail.com>2022-04-15 00:44:26 -0300
committerDaniel Golle <daniel@makrotopia.org>2022-04-19 16:28:25 +0100
commitf5ed603d0ce795bb8beb55db90b566836eef6514 (patch)
treeb547c55ba551c38af5b7de8fb334697ea9fd8327 /package/base-files
parent3f2d0703b60357e3ff1865783335be9f51528eb8 (diff)
downloadupstream-f5ed603d0ce795bb8beb55db90b566836eef6514.tar.gz
upstream-f5ed603d0ce795bb8beb55db90b566836eef6514.tar.bz2
upstream-f5ed603d0ce795bb8beb55db90b566836eef6514.zip
base-files: emit diagnostics on sysupgrade abort
Emit diagnostics if nand sysupgrade is aborted because UBI partition cannot be attached. Also avoid redudndant checks. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
Diffstat (limited to 'package/base-files')
-rw-r--r--package/base-files/files/lib/upgrade/nand.sh27
1 files changed, 16 insertions, 11 deletions
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index 8720a78b4b..8f008d6a06 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -136,18 +136,23 @@ nand_upgrade_prepare_ubi() {
ubiattach -m "$mtdnum"
sync
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
- fi
- if [ ! "$ubidev" ]; then
- ubiformat /dev/mtd$mtdnum -y
- ubiattach -m "$mtdnum"
- sync
- ubidev="$( nand_find_ubi "$CI_UBIPART" )"
- [ ! "$ubidev" ] && return 1
- [ "$has_env" -gt 0 ] && {
- ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB
- ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB
- }
+ if [ ! "$ubidev" ]; then
+ ubiformat /dev/mtd$mtdnum -y
+ ubiattach -m "$mtdnum"
+ sync
+ ubidev="$( nand_find_ubi "$CI_UBIPART" )"
+
+ if [ ! "$ubidev" ]; then
+ echo "cannot attach ubi mtd partition $CI_UBIPART"
+ return 1
+ fi
+
+ if [ "$has_env" -gt 0 ]; then
+ ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB
+ ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB
+ fi
+ fi
fi
local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )"