[openwrt/openwrt] mediatek: mt7622: bpi-r64: fix sysupgrade on empty disk
LEDE Commits
lede-commits at lists.infradead.org
Mon Mar 1 19:37:47 GMT 2021
dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/2151d897135501b9515ac0674e36ec79ae949ab8
commit 2151d897135501b9515ac0674e36ec79ae949ab8
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Mon Mar 1 19:31:51 2021 +0000
mediatek: mt7622: bpi-r64: fix sysupgrade on empty disk
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
index 07efe13363..4e45c026ab 100755
--- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
@@ -16,6 +16,13 @@ get_rootdev() {
local rootvol rootdev
rootvol=$(get_cmdline_var root)
rootvol=$(basename $rootvol)
+ [ -e /sys/class/block/$rootvol ] || {
+ rootvol=${rootvol%%[0-9]}
+ [ -e /sys/class/block/$rootvol ] && echo $rootvol
+ rootvol=${rootvol%%p}
+ [ -e /sys/class/block/$rootvol ] && echo $rootvol
+ return
+ }
[ -e /sys/class/block/$rootvol/partition ] || {
echo $rootvol
return
@@ -89,13 +96,13 @@ platform_check_image() {
}
platform_copy_config_mmc() {
+ [ -e "$UPGRADE_BACKUP" ] || return
local rootdev=$(cat /tmp/sysupgrade.rootdev)
blockdev --rereadpt /dev/$rootdev
local datadev=$(get_partition $rootdev rootfs_data)
[ "$datadev" ] || echo "no rootfs_data partition, cannot keep configuration." >&2
dd if="$UPGRADE_BACKUP" of=/dev/$datadev
sync
- sleep 4
}
platform_copy_config() {
More information about the lede-commits
mailing list