source: npl/kernel/initrd_scripts/root/etc/restore.boot

Last change on this file was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#!/bin/bash
2
3#DANGER: if /mnt/.sys3restoresystem exists, this script WILL format your rootfs!
4
5#do we need to restore something?
6if [ -r /mnt/.syn3restoresystem ]; then
7
8    splashinfo "Finishing restore... DO NOT REBOOT!"
9
10    #first unmount the currently mounted /boot (/dev/md0):
11    umount /mnt || error_shell
12
13    #format /boot and /
14    echo "Formatting filesystems..."
15    mkfs.ext3 -F -O '^64bit' /dev/md0 || error_shell
16    mkfs.xfs -f /dev/syn3/root || error_shell
17   
18    #mount the new rootfs
19    mount -o inode32 /dev/syn3/root /mnt || error_shell
20   
21    #mount the new /boot
22    mkdir /mnt/boot
23    mount /dev/md0 /mnt/boot || error_shell
24
25    #mount the restored /home
26    mkdir /mnt/home
27    mount -o inode32 /dev/syn3/home /mnt/home || error_shell
28   
29    #restore all files
30    echo "Restoring system data..."
31    cp -v -a /mnt/home/.syn3systembackup/. /mnt || error_shell
32
33    #this shouldnt exist anymore, but just to be sure we delete it anyway. (to prevent a loop in such case)
34    rm /mnt/boot/.syn3restoresystem 2>/dev/null
35   
36    #cleanup and remount boot under /mnt, like it was before
37    umount /mnt/home || error_shell
38    umount /mnt/boot || error_shell
39    umount /mnt || error_shell
40    mount -o ro,norecovery /dev/md0 /mnt || error_shell
41   
42    echo "Restore finshed, the system should continue to boot like before now."
43fi
Note: See TracBrowser for help on using the repository browser.