initramfs: restore configuration if available
The error case of the backup not properly restoring has not been tested. Fixes: SYS#525
This commit is contained in:
parent
a3a743ecb2
commit
7a09426da5
|
@ -200,7 +200,28 @@ umount /tgt_root
|
|||
echo "Resizing partition"
|
||||
e2fsck -f $rootfs || true
|
||||
resize2fs $rootfs
|
||||
sync
|
||||
|
||||
echo "Re-mounting the root and trying to apply backup."
|
||||
mount $rootfs /tgt_root
|
||||
|
||||
echo "Finding backupfiles"
|
||||
backupfile=`find /media/$dev_name/ -name "sysmocom-backup*.tar" | head -n1`
|
||||
if [ -n "$backupfile" ]; then
|
||||
if [ ! -r "$backupfile" ]; then
|
||||
echo "configurations-file $backupfile it is not readable"
|
||||
else
|
||||
echo "restoring $backupfile"
|
||||
backupfile_basename=`basename $backupfile`
|
||||
cp $backupfile /tgt_root
|
||||
chroot /tgt_root /usr/sbin/sysmocom-restore $backupfile_basename
|
||||
rm /tgt_root/$backupfile_basename
|
||||
fi
|
||||
else
|
||||
echo "No configurations-file found"
|
||||
fi
|
||||
|
||||
umount /tgt_root
|
||||
sync
|
||||
|
||||
echo "Remove your installation media, and press ENTER"
|
||||
|
|
Loading…
Reference in New Issue