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>
(cherry picked from commit
bf390478727ac5f4f9d6fb684de48b8150bcec67)
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/'; }
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
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
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