mediatek: mt7622: bpi-r64: fix sysupgrade on empty disk
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
ded54ae196
commit
2151d89713
@ -16,6 +16,13 @@ get_rootdev() {
|
|||||||
local rootvol rootdev
|
local rootvol rootdev
|
||||||
rootvol=$(get_cmdline_var root)
|
rootvol=$(get_cmdline_var root)
|
||||||
rootvol=$(basename $rootvol)
|
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 ] || {
|
[ -e /sys/class/block/$rootvol/partition ] || {
|
||||||
echo $rootvol
|
echo $rootvol
|
||||||
return
|
return
|
||||||
@ -89,13 +96,13 @@ platform_check_image() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
platform_copy_config_mmc() {
|
platform_copy_config_mmc() {
|
||||||
|
[ -e "$UPGRADE_BACKUP" ] || return
|
||||||
local rootdev=$(cat /tmp/sysupgrade.rootdev)
|
local rootdev=$(cat /tmp/sysupgrade.rootdev)
|
||||||
blockdev --rereadpt /dev/$rootdev
|
blockdev --rereadpt /dev/$rootdev
|
||||||
local datadev=$(get_partition $rootdev rootfs_data)
|
local datadev=$(get_partition $rootdev rootfs_data)
|
||||||
[ "$datadev" ] || echo "no rootfs_data partition, cannot keep configuration." >&2
|
[ "$datadev" ] || echo "no rootfs_data partition, cannot keep configuration." >&2
|
||||||
dd if="$UPGRADE_BACKUP" of=/dev/$datadev
|
dd if="$UPGRADE_BACKUP" of=/dev/$datadev
|
||||||
sync
|
sync
|
||||||
sleep 4
|
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_copy_config() {
|
platform_copy_config() {
|
||||||
|
Loading…
Reference in New Issue
Block a user