aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2022-04-13 14:51:34 +0100
committerDaniel Golle <daniel@makrotopia.org>2022-04-13 19:50:45 +0100
commit0dbca1b2baf9c26514b517a1e5860f6a5b04d5ae (patch)
tree8bbbc5442990a199d18cec45b7b585a608ac4d21 /package
parent435d7a052bf1b6a3a01cb3ad6cda6ba4b25b1879 (diff)
downloadupstream-0dbca1b2baf9c26514b517a1e5860f6a5b04d5ae.tar.gz
upstream-0dbca1b2baf9c26514b517a1e5860f6a5b04d5ae.tar.bz2
upstream-0dbca1b2baf9c26514b517a1e5860f6a5b04d5ae.zip
base-files: more robust sysupgrade on NAND
Make sure sysupgrade on NAND also works in case of UBI volumes having index >9. While at it, also make sure UBI device is detected and abort in case it isn't. Use Shell built-in shorthand ':' instead of 'true'. Fixes #9708 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package')
-rw-r--r--package/base-files/files/lib/upgrade/nand.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index 19be9dd730..8720a78b4b 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -143,6 +143,7 @@ nand_upgrade_prepare_ubi() {
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
@@ -154,8 +155,13 @@ nand_upgrade_prepare_ubi() {
local data_ubivol="$( nand_find_volume $ubidev rootfs_data )"
local ubiblk ubiblkvol
- for ubiblk in /dev/ubiblock*_? ; do
+ for ubiblk in /dev/ubiblock${ubidev:3}_* ; do
[ -e "$ubiblk" ] || continue
+ case "$ubiblk" in
+ /dev/ubiblock*_*p*)
+ continue
+ ;;
+ esac
echo "removing ubiblock${ubiblk:13}"
ubiblkvol=ubi${ubiblk:13}
if ! ubiblock -r /dev/$ubiblkvol; then
@@ -165,9 +171,9 @@ nand_upgrade_prepare_ubi() {
done
# kill volumes
- [ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || true
- [ "$root_ubivol" -a "$root_ubivol" != "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true
- [ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true
+ [ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || :
+ [ "$root_ubivol" -a "$root_ubivol" != "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || :
+ [ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || :
# update kernel
if [ -n "$kernel_length" ]; then