diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2019-09-04 16:57:39 +0200 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2019-09-05 14:33:19 +0200 |
commit | bf390478727ac5f4f9d6fb684de48b8150bcec67 (patch) | |
tree | cd19a4cb1b41476edf17cca11807c92541c8eb19 /target/linux/mvebu/base-files | |
parent | 1078de96e315f3cc2675b2c5935009e8c6159ad4 (diff) | |
download | upstream-bf390478727ac5f4f9d6fb684de48b8150bcec67.tar.gz upstream-bf390478727ac5f4f9d6fb684de48b8150bcec67.tar.bz2 upstream-bf390478727ac5f4f9d6fb684de48b8150bcec67.zip |
treewide: don't hardcode "sysupgrade.tgz" file name
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>
Diffstat (limited to 'target/linux/mvebu/base-files')
5 files changed, 13 insertions, 13 deletions
diff --git a/target/linux/mvebu/base-files/lib/preinit/79_move_config b/target/linux/mvebu/base-files/lib/preinit/79_move_config index 640fb5cdad..195be0e137 100644 --- a/target/linux/mvebu/base-files/lib/preinit/79_move_config +++ b/target/linux/mvebu/base-files/lib/preinit/79_move_config @@ -18,7 +18,7 @@ move_config() { esac mkdir -p /boot mount -o rw,noatime "/dev/$partdev" /boot - [ -f /boot/sysupgrade.tgz ] && mv -f /boot/sysupgrade.tgz / + [ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" / umount /boot fi } diff --git a/target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg b/target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg index b107eacb11..83448e5ace 100644 --- a/target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg +++ b/target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg @@ -4,8 +4,8 @@ # preinit_mount_syscfg() { - . /lib/functions.sh + . /lib/upgrade/common.sh case $(board_name) in linksys,caiman|linksys,cobra|linksys,mamba|linksys,rango|linksys,shelby|linksys,venom) @@ -22,12 +22,12 @@ preinit_mount_syscfg() { fi mkdir /tmp/syscfg mount -t ubifs ubi1:syscfg /tmp/syscfg - [ -f /tmp/syscfg/sysupgrade.tgz ] && { + [ -f "/tmp/syscfg/$BACKUP_FILE" ] && { echo "- config restore -" cd / - mv /tmp/syscfg/sysupgrade.tgz /tmp - tar xzf /tmp/sysupgrade.tgz - rm -f /tmp/sysupgrade.tgz + mv "/tmp/syscfg/$BACKUP_FILE" /tmp + tar xzf "/tmp/$BACKUP_FILE" + rm -f "/tmp/$BACKUP_FILE" sync } ;; diff --git a/target/linux/mvebu/base-files/lib/preinit/82_uDPU b/target/linux/mvebu/base-files/lib/preinit/82_uDPU index 937a0a5f21..12bbfc3725 100644 --- a/target/linux/mvebu/base-files/lib/preinit/82_uDPU +++ b/target/linux/mvebu/base-files/lib/preinit/82_uDPU @@ -4,8 +4,8 @@ # preinit_mount_udpu() { - . /lib/functions.sh + . /lib/upgrade/common.sh case $(board_name) in methode,udpu) @@ -15,10 +15,10 @@ preinit_mount_udpu() { if [ -b "${mmcdev}p4" ]; then mkdir /misc mount -t f2fs ${mmcdev}p4 /misc - [ -f "/misc/sysupgrade.tgz" ] && { + [ -f "/misc/$BACKUP_FILE" ] && { echo "- Restoring configuration files -" - tar xzf /misc/sysupgrade.tgz -C / - rm -f /misc/sysupgrade.tgz + tar xzf "/misc/$BACKUP_FILE" -C / + rm -f "/misc/$BACKUP_FILE" sync } [ -f "/misc/firmware/recovery.itb" ] && { diff --git a/target/linux/mvebu/base-files/lib/upgrade/linksys.sh b/target/linux/mvebu/base-files/lib/upgrade/linksys.sh index 3f45d6cac5..857c550c73 100644 --- a/target/linux/mvebu/base-files/lib/upgrade/linksys.sh +++ b/target/linux/mvebu/base-files/lib/upgrade/linksys.sh @@ -93,6 +93,6 @@ platform_do_upgrade_linksys() { } platform_copy_config_linksys() { - cp -f /tmp/sysupgrade.tgz /tmp/syscfg/sysupgrade.tgz + cp -f "$CONF_TAR" /tmp/syscfg/ sync } diff --git a/target/linux/mvebu/base-files/lib/upgrade/uDPU.sh b/target/linux/mvebu/base-files/lib/upgrade/uDPU.sh index 48c3209a99..f87ff4f9ca 100644 --- a/target/linux/mvebu/base-files/lib/upgrade/uDPU.sh +++ b/target/linux/mvebu/base-files/lib/upgrade/uDPU.sh @@ -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 "/tmp/sysupgrade.tgz" ]; then - cp -f /tmp/sysupgrade.tgz /misc + if [ -f "$CONF_TAR" ]; then + cp -f "$CONF_TAR" /misc sync fi } |