From: Rafał Miłecki Date: Wed, 4 Sep 2019 14:57:39 +0000 (+0200) Subject: treewide: don't hardcode "sysupgrade.tgz" file name X-Git-Tag: v1.5.0-rc2~35 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fd56f34c1ee53f8768aa062a46c6f06464596e4d;p=librecmc%2Flibrecmc.git 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 (cherry picked from commit bf390478727ac5f4f9d6fb684de48b8150bcec67) --- diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index efa301cd95..279470fcd8 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -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/'; } diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh index 9f258a82c5..fead846ecc 100644 --- a/package/base-files/files/lib/upgrade/nand.sh +++ b/package/base-files/files/lib/upgrade/nand.sh @@ -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 diff --git a/target/linux/sunxi/base-files/lib/preinit/79_move_config b/target/linux/sunxi/base-files/lib/preinit/79_move_config index 83171b3ba9..74caee8a8a 100644 --- a/target/linux/sunxi/base-files/lib/preinit/79_move_config +++ b/target/linux/sunxi/base-files/lib/preinit/79_move_config @@ -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 diff --git a/target/linux/x86/base-files/lib/preinit/79_move_config b/target/linux/x86/base-files/lib/preinit/79_move_config index aff720a52c..702da9e873 100644 --- a/target/linux/x86/base-files/lib/preinit/79_move_config +++ b/target/linux/x86/base-files/lib/preinit/79_move_config @@ -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