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, 12 Sep 2019 11:26:39 +0000 (13:26 +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>
(cherry picked from commit 62dbe361a1b1ed1506bc0387bff55eddcb619e49)

12 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/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 07b568d9b4dba091e329da21ffa0a3577c05e9b1..c287efa0b3bd0acb7fcdd4827086125b1c67322b 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 c7eca2f060253154ec1b205273eb67bf31994da5..a86389c549229ecab6e525b54ef7ce5aa4c1cec8 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 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
 }