treewide: revert use new procd sysupgrade variable (#4139)

This commit is contained in:
AmadeusGhost 2020-04-02 13:29:45 +08:00 committed by GitHub
parent e56bd418c1
commit 9a65c3ef74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 25 additions and 24 deletions

View File

@ -14,7 +14,7 @@ redboot_fis_do_upgrade() {
if [ "$magic" = "4349" ]; then
local kern_length=0x$(dd if="$sysup_file" bs=2 skip=1 count=4 2>/dev/null)
[ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP"
[ -f "$CONF_TAR" ] && append="-j $CONF_TAR"
dd if="$sysup_file" bs=64k skip=1 2>/dev/null | \
mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs
@ -22,7 +22,7 @@ redboot_fis_do_upgrade() {
local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$')
local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c)
[ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP"
[ -f "$CONF_TAR" ] && append="-j $CONF_TAR"
tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \
mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs

View File

@ -45,7 +45,7 @@ platform_do_upgrade() {
sync
if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
if [ "$SAVE_PARTITIONS" = "1" ]; then
get_partitions "/dev/$diskdev" bootdisk
#extract the boot sector from the image
@ -91,8 +91,8 @@ platform_copy_config() {
if export_partdevice partdev 1; then
mkdir -p /boot
[ -f /boot/kernel.img ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot
cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE"
tar -C / -zxvf "$UPGRADE_BACKUP" boot/config.txt
cp -af "$CONF_TAR" /boot/
tar -C / -zxvf "$CONF_TAR" boot/config.txt
sync
unmount /boot
fi

View File

@ -54,7 +54,7 @@ platform_check_image() {
platform_copy_config_emmc() {
mkdir -p /recovery
mount -o rw,noatime /dev/mmcblk0p1 /recovery
cp -af "$UPGRADE_BACKUP" "/recovery/$BACKUP_FILE"
cp -af "$CONF_TAR" "/recovery/$CONF_TAR"
sync
umount /recovery
}

View File

@ -18,7 +18,7 @@ move_config() {
esac
mkdir -p /boot
mount -o rw,noatime "/dev/$partdev" /boot
[ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
[ -f /boot/sysupgrade.tgz ] && mv -f /boot/sysupgrade.tgz /
umount /boot
fi
}

View File

@ -22,12 +22,12 @@ preinit_mount_syscfg() {
fi
mkdir /tmp/syscfg
mount -t ubifs ubi1:syscfg /tmp/syscfg
[ -f "/tmp/syscfg/$BACKUP_FILE" ] && {
[ -f /tmp/syscfg/sysupgrade.tgz ] && {
echo "- config restore -"
cd /
mv "/tmp/syscfg/$BACKUP_FILE" /tmp
tar xzf "/tmp/$BACKUP_FILE"
rm -f "/tmp/$BACKUP_FILE"
mv /tmp/syscfg/sysupgrade.tgz /tmp
tar xzf /tmp/sysupgrade.tgz
rm -f /tmp/sysupgrade.tgz
sync
}
;;

View File

@ -15,10 +15,10 @@ preinit_mount_udpu() {
if [ -b "${mmcdev}p4" ]; then
mkdir /misc
mount -t f2fs ${mmcdev}p4 /misc
[ -f "/misc/$BACKUP_FILE" ] && {
[ -f /misc/sysupgrade.tgz ] && {
echo "- Restoring configuration files -"
tar xzf "/misc/$BACKUP_FILE" -C /
rm -f "/misc/$BACKUP_FILE"
tar xzf /misc/sysupgrade.tgz -C /
rm -f /misc/sysupgrade.tgz
sync
}
[ -f "/misc/firmware/recovery.itb" ] && {

View File

@ -93,6 +93,6 @@ platform_do_upgrade_linksys() {
}
platform_copy_config_linksys() {
cp -f "$UPGRADE_BACKUP" "/tmp/syscfg/$BACKUP_FILE"
cp -f /tmp/sysupgrade.tgz /tmp/syscfg/sysupgrade.tgz
sync
}

View File

@ -11,7 +11,7 @@ platform_check_image() {
case "$(board_name)" in
cznic,turris-omnia|globalscale,espressobin|globalscale,espressobin-emmc|globalscale,espressobin-v7|globalscale,espressobin-v7-emmc|\
marvell,armada8040-mcbin|solidrun,clearfog-base-a1|solidrun,clearfog-pro-a1)
platform_check_image_sdcard "$1"
platform_check_image_sdcard "$ARGV"
;;
*)
return 0
@ -22,20 +22,21 @@ platform_check_image() {
platform_do_upgrade() {
case "$(board_name)" in
linksys,caiman|linksys,cobra|linksys,mamba|linksys,rango|linksys,shelby|linksys,venom)
platform_do_upgrade_linksys "$1"
platform_do_upgrade_linksys "$ARGV"
;;
cznic,turris-omnia|globalscale,espressobin|globalscale,espressobin-emmc|globalscale,espressobin-v7|globalscale,espressobin-v7-emmc|\
marvell,armada8040-mcbin|solidrun,clearfog-base-a1|solidrun,clearfog-pro-a1)
platform_do_upgrade_sdcard "$1"
platform_do_upgrade_sdcard "$ARGV"
;;
methode,udpu)
platform_do_upgrade_uDPU "$1"
platform_do_upgrade_uDPU "$ARGV"
;;
*)
default_do_upgrade "$1"
default_do_upgrade "$ARGV"
;;
esac
}
platform_copy_config() {
case "$(board_name)" in
linksys,caiman|linksys,cobra|linksys,mamba|linksys,rango|linksys,shelby|linksys,venom)

View File

@ -49,7 +49,7 @@ platform_do_upgrade_sdcard() {
sync
if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
if [ "$SAVE_PARTITIONS" = "1" ]; then
get_partitions "/dev/$diskdev" bootdisk
#extract the boot sector from the image
@ -106,7 +106,7 @@ platform_copy_config_sdcard() {
if export_partdevice partdev 1; then
mkdir -p /boot
[ -f /boot/kernel.img ] || mount -o rw,noatime /dev/$partdev /boot
cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE"
cp -af "$CONF_TAR" /boot/
sync
umount /boot
fi

View File

@ -149,8 +149,8 @@ platform_do_upgrade_uDPU() {
platform_copy_config_uDPU() {
# Config is saved on the /misc partition and copied on the rootfs after the reboot
if [ -f "$UPGRADE_BACKUP" ]; then
cp -f "$UPGRADE_BACKUP" "/misc/$BACKUP_FILE"
if [ -f /tmp/sysupgrade.tgz ]; then
cp -f /tmp/sysupgrade.tgz /misc/
sync
fi
}