Revert 'treewide: adjust sysupgrade script'

This commit is contained in:
AmadeusGhost 2020-08-19 12:10:43 +08:00
parent cecb64364e
commit ee6b2fee3a
4 changed files with 10 additions and 25 deletions

View File

@ -11,7 +11,7 @@ REQUIRE_IMAGE_METADATA=1
platform_check_image_sdboot() {
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev -2 || {
export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device"
return 1
}
@ -38,7 +38,7 @@ platform_check_image_sdboot() {
platform_do_upgrade_sdboot() {
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev -2 || {
export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device"
return 1
}
@ -77,10 +77,6 @@ platform_do_upgrade_sdboot() {
# iterate over each partition from the image and write it to the boot disk
while read part start size; do
# root is /dev/sd[a|b]2 and not /dev/sd[a|b] this causes some problem
# one of which is this offset, I'm not sure what's the best fix, so
# here's a WA.
let part=$((part - 2))
if export_partdevice partdev $part; then
echo "Writing image to /dev/$partdev..."
dd if="$1" of="/dev/$partdev" bs=512 skip="$start" count="$size" > /dev/null 2>&1
@ -111,8 +107,7 @@ platform_do_upgrade_traverse_nandubi() {
platform_copy_config() {
local partdev parttype=ext4
# Same as above /dev/sd[a|b]2 is root, so /boot is -1
if export_partdevice partdev -1; then
if export_partdevice partdev 1; then
mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt
cp -af "$CONF_TAR" "/mnt/$CONF_TAR"
umount /mnt

View File

@ -14,7 +14,7 @@ platform_check_image_sdcard() {
return 1
}
export_bootdevice && export_partdevice diskdev -2 || {
export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device"
return 1
}
@ -42,7 +42,7 @@ platform_do_upgrade_sdcard() {
local board=$(board_name)
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev -2 || {
export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device"
return 1
}
@ -75,10 +75,6 @@ platform_do_upgrade_sdcard() {
get_image "$@" | dd of="$diskdev" bs=512 skip=1 seek=1 count=2048 conv=fsync
#iterate over each partition from the image and write it to the boot disk
while read part start size; do
# root is /dev/sd[a|b]2 and not /dev/sd[a|b] this causes some problem
# one of which is this offset, I'm not sure what's the best fix, so
# here's a WA.
let part=$((part - 2))
if export_partdevice partdev $part; then
echo "Writing image to /dev/$partdev..."
get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
@ -107,8 +103,7 @@ platform_do_upgrade_sdcard() {
platform_copy_config_sdcard() {
local partdev
# Same as above /dev/sd[a|b]2 is root, so /boot is -1
if export_partdevice partdev -1; then
if export_partdevice partdev 1; then
mkdir -p /boot
[ -f /boot/kernel.img ] || mount -o rw,noatime /dev/$partdev /boot
cp -af "$CONF_TAR" /boot/

View File

@ -3,7 +3,7 @@ move_config() {
. /lib/upgrade/common.sh
if export_bootdevice && export_partdevice partdev -1; then
if export_bootdevice && export_partdevice partdev 1; then
if mount -o rw,noatime "/dev/$partdev" /mnt; then
if [ -f "/mnt/$CONF_TAR" ]; then
mv -f "/mnt/$CONF_TAR" /

View File

@ -1,7 +1,7 @@
platform_check_image() {
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev -2 || {
export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device"
return 1
}
@ -28,8 +28,7 @@ platform_check_image() {
platform_copy_config() {
local partdev
# Same as above /dev/sd[a|b]2 is root, so /boot is -1
if export_partdevice partdev -1; then
if export_partdevice partdev 1; then
mount -o rw,noatime "/dev/$partdev" /mnt
cp -af "$CONF_TAR" "/mnt/$CONF_TAR"
umount /mnt
@ -39,7 +38,7 @@ platform_copy_config() {
platform_do_upgrade() {
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev -2 || {
export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device"
return 1
}
@ -73,10 +72,6 @@ platform_do_upgrade() {
#iterate over each partition from the image and write it to the boot disk
while read part start size; do
# root is /dev/sd[a|b]2 and not /dev/sd[a|b] this causes some problem
# one of which is this offset, I'm not sure what's the best fix, so
# here's a WA.
let part=$((part - 2))
if export_partdevice partdev $part; then
echo "Writing image to /dev/$partdev..."
get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync