treewide: when copying a backup file always specify dest name

$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>
master
Rafał Miłecki 5 years ago
parent bf39047872
commit 62dbe361a1

@ -88,7 +88,7 @@ mbl_copy_config() {
if export_partdevice partdev 1; then if export_partdevice partdev 1; then
mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt
cp -af "$CONF_TAR" /mnt/ cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
umount /mnt umount /mnt
fi fi
} }

@ -91,7 +91,7 @@ platform_copy_config() {
if export_partdevice partdev 1; then if export_partdevice partdev 1; then
mkdir -p /boot mkdir -p /boot
[ -f /boot/kernel.img ] || mount -t vfat -o rw,noatime "/dev/$partdev" /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 tar -C / -zxvf "$CONF_TAR" boot/config.txt
sync sync
unmount /boot unmount /boot

@ -17,7 +17,7 @@ enable_image_metadata_check
apalis_copy_config() { apalis_copy_config() {
apalis_mount_boot apalis_mount_boot
cp -af "$CONF_TAR" /boot/ cp -af "$CONF_TAR" "/boot/$BACKUP_FILE"
sync sync
umount /boot umount /boot
} }

@ -60,7 +60,7 @@ zyxel_do_flash() {
mkdir /tmp/new_root mkdir /tmp/new_root
mount -t ext4 $loopdev /tmp/new_root && { mount -t ext4 $loopdev /tmp/new_root && {
echo "Saving config to rootfs_data at position ${offset}." 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 umount /tmp/new_root
} }

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

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

@ -106,7 +106,7 @@ platform_copy_config_sdcard() {
if export_partdevice partdev 1; then if export_partdevice partdev 1; then
mkdir -p /boot mkdir -p /boot
[ -f /boot/kernel.img ] || mount -o rw,noatime /dev/$partdev /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 sync
umount /boot umount /boot
fi fi

@ -150,7 +150,7 @@ platform_do_upgrade_uDPU() {
platform_copy_config_uDPU() { platform_copy_config_uDPU() {
# Config is saved on the /misc partition and copied on the rootfs after the reboot # Config is saved on the /misc partition and copied on the rootfs after the reboot
if [ -f "$CONF_TAR" ]; then if [ -f "$CONF_TAR" ]; then
cp -f "$CONF_TAR" /misc cp -f "$CONF_TAR" "/misc/$BACKUP_FILE"
sync sync
fi fi
} }

@ -25,7 +25,7 @@ platform_copy_config() {
case "$(board_name)" in case "$(board_name)" in
erlite) erlite)
mount -t vfat /dev/sda1 /mnt mount -t vfat /dev/sda1 /mnt
cp -af "$CONF_TAR" /mnt/ cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
umount /mnt umount /mnt
;; ;;
esac esac

@ -30,7 +30,7 @@ platform_copy_config() {
if export_partdevice partdev 1; then if export_partdevice partdev 1; then
mount -t vfat -o rw,noatime "/dev/$partdev" /mnt mount -t vfat -o rw,noatime "/dev/$partdev" /mnt
cp -af "$CONF_TAR" /mnt/ cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
umount /mnt umount /mnt
fi fi
} }

@ -30,7 +30,7 @@ platform_copy_config() {
if export_partdevice partdev 1; then if export_partdevice partdev 1; then
mount -t vfat -o rw,noatime "/dev/$partdev" /mnt mount -t vfat -o rw,noatime "/dev/$partdev" /mnt
cp -af "$CONF_TAR" /mnt/ cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
umount /mnt umount /mnt
fi fi
} }

@ -47,7 +47,7 @@ platform_copy_config() {
if export_partdevice partdev 1; then if export_partdevice partdev 1; then
mount -o rw,noatime "/dev/$partdev" /mnt mount -o rw,noatime "/dev/$partdev" /mnt
cp -af "$CONF_TAR" /mnt/ cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
umount /mnt umount /mnt
fi fi
} }

@ -39,7 +39,7 @@ platform_copy_config() {
if export_partdevice partdev 1; then if export_partdevice partdev 1; then
mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt
cp -af "$CONF_TAR" /mnt/ cp -af "$CONF_TAR" "/mnt/$BACKUP_FILE"
umount /mnt umount /mnt
fi fi
} }

Loading…
Cancel
Save