#!/bin/bash #DANGER: if /mnt/.sys3restoresystem exists, this script WILL format your rootfs! #do we need to restore something? if [ -r /mnt/.syn3restoresystem ]; then splashinfo "Finishing restore... DO NOT REBOOT!" #first unmount the currently mounted /boot (/dev/md0): umount /mnt || error_shell #format /boot and / echo "Formatting filesystems..." mkfs.ext3 -F -O '^64bit' /dev/md0 || error_shell mkfs.xfs -f /dev/syn3/root || error_shell #mount the new rootfs mount -o inode32 /dev/syn3/root /mnt || error_shell #mount the new /boot mkdir /mnt/boot mount /dev/md0 /mnt/boot || error_shell #mount the restored /home mkdir /mnt/home mount -o inode32 /dev/syn3/home /mnt/home || error_shell #restore all files echo "Restoring system data..." cp -v -a /mnt/home/.syn3systembackup/. /mnt || error_shell #this shouldnt exist anymore, but just to be sure we delete it anyway. (to prevent a loop in such case) rm /mnt/boot/.syn3restoresystem 2>/dev/null #cleanup and remount boot under /mnt, like it was before umount /mnt/home || error_shell umount /mnt/boot || error_shell umount /mnt || error_shell mount -o ro,norecovery /dev/md0 /mnt || error_shell echo "Restore finshed, the system should continue to boot like before now." fi