treewide: when copying a backup file always specify dest name
authorRafał Miłecki <rafal@milecki.pl>
Wed, 4 Sep 2019 14:57:40 +0000 (16:57 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Thu, 5 Sep 2019 12:33:20 +0000 (14:33 +0200)
$CONF_TAR shouldn't be assumed to always point to the sysupgrade.tgz.
This change makes code more generic and allows refactoring $CONF_TAR.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
13 files changed:
target/linux/apm821xx/base-files/lib/upgrade/wdbook.sh
target/linux/brcm2708/base-files/lib/upgrade/platform.sh
target/linux/imx6/base-files/lib/upgrade/platform.sh
target/linux/ipq806x/base-files/lib/upgrade/zyxel.sh
target/linux/mediatek/base-files/lib/upgrade/platform.sh
target/linux/mvebu/base-files/lib/upgrade/linksys.sh
target/linux/mvebu/base-files/lib/upgrade/sdcard.sh
target/linux/mvebu/base-files/lib/upgrade/uDPU.sh
target/linux/octeon/base-files/lib/upgrade/platform.sh
target/linux/omap/base-files/lib/upgrade/platform.sh
target/linux/sunxi/base-files/lib/upgrade/platform.sh
target/linux/tegra/base-files/lib/upgrade/platform.sh
target/linux/x86/base-files/lib/upgrade/platform.sh

index 01327d926a52586c0c8a21131be6877aae84cafa..e3de6ed0b57c0a2c9339cb019bd26822e08da5a5 100644 (file)
@@ -88,7 +88,7 @@ mbl_copy_config() {
 
        if export_partdevice partdev 1; then
                mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt
-               cp -af "$CONF_TAR" /mnt/
+               cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
                umount /mnt
        fi
 }
index 693cde777950d70f8c8f9588061db7e15b93b0d6..48994ebe074cfbc68e6002536e6c49282345cfea 100644 (file)
@@ -91,7 +91,7 @@ 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 "$CONF_TAR" /boot/
+               cp -af "$CONF_TAR" "/boot/$BACKUP_FILE"
                tar -C / -zxvf "$CONF_TAR" boot/config.txt
                sync
                unmount /boot
index 0ab2d984d3f7b867201979f976ac3850bfcba61e..28bdec9e9cd82ba41791ba9b656e5ce9872d000a 100755 (executable)
@@ -17,7 +17,7 @@ enable_image_metadata_check
 
 apalis_copy_config() {
        apalis_mount_boot
-       cp -af "$CONF_TAR" /boot/
+       cp -af "$CONF_TAR" "/boot/$BACKUP_FILE"
        sync
        umount /boot
 }
index 8888ec7d0465ef7ac10b40cc49e4ecaf3d102c99..e9fb0ad3886211ac346939c44e8309009620f724 100644 (file)
@@ -60,7 +60,7 @@ zyxel_do_flash() {
        mkdir /tmp/new_root
        mount -t ext4 $loopdev /tmp/new_root && {
                echo "Saving config to rootfs_data at position ${offset}."
-               cp -v "$CONF_TAR" /tmp/new_root/
+               cp -v "$CONF_TAR" "/tmp/new_root/$BACKUP_FILE"
                umount /tmp/new_root
        }
 
index d812a48720b83edbcf8e01f41462f3a749e9d44e..d1b9fdeb95563a0a35d48d7c90c7f23fcc1621fd 100755 (executable)
@@ -54,7 +54,7 @@ platform_check_image() {
 platform_copy_config_emmc() {
        mkdir -p /recovery
        mount -o rw,noatime /dev/mmcblk0p1 /recovery
-       cp -af "$CONF_TAR" /recovery/
+       cp -af "$CONF_TAR" "/recovery/$BACKUP_FILE"
        sync
        umount /recovery
 }
index 857c550c73defc0c4accad171a4521f4fd816b0b..5104db31f3ce3b7ef5e85146875fca2e21c7007f 100644 (file)
@@ -93,6 +93,6 @@ platform_do_upgrade_linksys() {
 }
 
 platform_copy_config_linksys() {
-       cp -f "$CONF_TAR" /tmp/syscfg/
+       cp -f "$CONF_TAR" "/tmp/syscfg/$BACKUP_FILE"
        sync
 }
index 3bfdce97e8d9bc531dcdee02852e48995dafcd53..03f63276572829d6f83fddabfdbd58e5942266b1 100644 (file)
@@ -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 "$CONF_TAR" /boot/
+               cp -af "$CONF_TAR" "/boot/$BACKUP_FILE"
                sync
                umount /boot
        fi
index f87ff4f9ca0550f0f25955b392ca0616ffa1d280..dbcff5836803f00309a54803c5d4dd0a9bd66a26 100644 (file)
@@ -150,7 +150,7 @@ 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 "$CONF_TAR" ]; then
-               cp -f "$CONF_TAR" /misc
+               cp -f "$CONF_TAR" "/misc/$BACKUP_FILE"
                sync
        fi
 }
index 0e4ca3762982368e5c53d5b8e1559cf154741a21..6233c337bc092988a1948bd06ec51b7f0d542389 100755 (executable)
@@ -25,7 +25,7 @@ platform_copy_config() {
        case "$(board_name)" in
        erlite)
                mount -t vfat /dev/sda1 /mnt
-               cp -af "$CONF_TAR" /mnt/
+               cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
                umount /mnt
                ;;
        esac
index c8b0175fd58c56fadac29db3462e0e04df37274c..a5108c4c02269dd38fc7f416f3766bc91c4025fc 100644 (file)
@@ -30,7 +30,7 @@ platform_copy_config() {
 
        if export_partdevice partdev 1; then
                mount -t vfat -o rw,noatime "/dev/$partdev" /mnt
-               cp -af "$CONF_TAR" /mnt/
+               cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
                umount /mnt
        fi
 }
index c8b0175fd58c56fadac29db3462e0e04df37274c..a5108c4c02269dd38fc7f416f3766bc91c4025fc 100644 (file)
@@ -30,7 +30,7 @@ platform_copy_config() {
 
        if export_partdevice partdev 1; then
                mount -t vfat -o rw,noatime "/dev/$partdev" /mnt
-               cp -af "$CONF_TAR" /mnt/
+               cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
                umount /mnt
        fi
 }
index 66e7d91e3cb13508043c8a493f6a51ea3bc85e1f..9a8acde9b68dd4e723cf2f6485ccb98d06b6cd50 100644 (file)
@@ -47,7 +47,7 @@ platform_copy_config() {
 
        if export_partdevice partdev 1; then
                mount -o rw,noatime "/dev/$partdev" /mnt
-               cp -af "$CONF_TAR" /mnt/
+               cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
                umount /mnt
        fi
 }
index 162dbaf3aaaa00539851856b67e8e6b1a5eb8b08..855752b5d704401fd5a73534e89ada0c79495aa8 100644 (file)
@@ -39,7 +39,7 @@ platform_copy_config() {
 
        if export_partdevice partdev 1; then
                mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt
-               cp -af "$CONF_TAR" /mnt/
+               cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
                umount /mnt
        fi
 }