treewide: don't hardcode "sysupgrade.tgz" file name
authorRafał Miłecki <rafal@milecki.pl>
Wed, 4 Sep 2019 14:57:39 +0000 (16:57 +0200)
committerRISCi_ATOM <bob@bobcall.me>
Fri, 13 Sep 2019 20:28:40 +0000 (16:28 -0400)
1) Add BACKUP_FILE and use it when copying an archive to be restored
   after sysupgrade (on the next preinit).
2) Use CONF_TAR for copying backup prepared by the /sbin/sysupgrade

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit bf390478727ac5f4f9d6fb684de48b8150bcec67)

package/base-files/files/lib/upgrade/common.sh
package/base-files/files/lib/upgrade/nand.sh
target/linux/sunxi/base-files/lib/preinit/79_move_config
target/linux/x86/base-files/lib/preinit/79_move_config

index efa301cd950e664965fab3887602777045c79e0f..279470fcd8c166e7b6e2894e98d2e26ed986b171 100644 (file)
@@ -2,6 +2,8 @@
 
 RAM_ROOT=/tmp/root
 
+export BACKUP_FILE=sysupgrade.tgz      # file extracted by preinit
+
 [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
 libs() { ldd $* 2>/dev/null | sed -r 's/(.* => )?(.*) .*/\2/'; }
 
index 9f258a82c55504d40e438eb2fe08171eb2abfdda..fead846eccdd070dabfb65c627ac88cc04084f5f 100644 (file)
@@ -109,7 +109,7 @@ nand_restore_config() {
                rmdir /tmp/new_root
                return 1
        fi
-       mv "$1" "/tmp/new_root/sysupgrade.tgz"
+       mv "$1" "/tmp/new_root/$BACKUP_FILE"
        umount /tmp/new_root
        sync
        rmdir /tmp/new_root
index 83171b3ba9dcc7edcf54139f9428b7ca880b3bd2..74caee8a8a71ff8021af6cd7496e0d191042afff 100644 (file)
@@ -8,8 +8,8 @@ move_config() {
 
        if export_bootdevice && export_partdevice partdev 1; then
                if mount -t vfat -o rw,noatime "/dev/$partdev" /mnt; then
-                       if [ -f /mnt/sysupgrade.tgz ]; then
-                               mv -f /mnt/sysupgrade.tgz /
+                       if [ -f "/mnt/$BACKUP_FILE" ]; then
+                               mv -f "/mnt/$BACKUP_FILE" /
                        fi
                        umount /mnt
                fi
index aff720a52c5afc6e4a1dee5a67d14b953f975eae..702da9e873d5a47cec80352fea5a719c2ffbcbc5 100644 (file)
@@ -9,8 +9,8 @@ move_config() {
        if export_bootdevice && export_partdevice partdev 1; then
                mkdir -p /boot
                mount -t ext4 -o rw,noatime "/dev/$partdev" /boot
-               if [ -f /boot/sysupgrade.tgz ]; then
-                       mv -f /boot/sysupgrade.tgz /
+               if [ -f "/boot/$BACKUP_FILE" ]; then
+                       mv -f "/boot/$BACKUP_FILE" /
                fi
                mount --bind /boot/boot /boot
        fi