fix error, fix msgs
This commit is contained in:
parent
b571133f3f
commit
55514aca5b
25
restore.sh
25
restore.sh
@ -101,19 +101,18 @@ echo w
|
|||||||
|
|
||||||
##mkfs's
|
##mkfs's
|
||||||
echo "==> Making filesystems..."
|
echo "==> Making filesystems..."
|
||||||
echo "mkswap"
|
echo "=> swap"
|
||||||
mkswap $targetDrive"1"
|
mkswap $targetDrive"1"
|
||||||
echo "mkfs.vfat"
|
echo "=> /boot"
|
||||||
mkfs.vfat $targetDrive"2"
|
mkfs.vfat $targetDrive"2"
|
||||||
|
|
||||||
echo "mkfs.ext4"
|
echo "=> rootfs"
|
||||||
if $encryptedDevice
|
if $encryptedDevice then
|
||||||
then
|
|
||||||
cryptsetup luksFormat -v $targetDrive"3"
|
cryptsetup luksFormat -v $targetDrive"3"
|
||||||
cryptsetup open $targetDrive"3" targetLuks
|
cryptsetup open $targetDrive"3" targetLuks
|
||||||
mkfs.ext4 /dev/mapper/targetLuks
|
mkfs.ext4 -q /dev/mapper/targetLuks
|
||||||
else
|
else
|
||||||
mkfs.ext4 $targetDrive"3"
|
mkfs.ext4 -q $targetDrive"3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 15
|
sleep 15
|
||||||
@ -121,16 +120,14 @@ sleep 15
|
|||||||
##get disk's uuid
|
##get disk's uuid
|
||||||
echo "==> Got UUIDs!"
|
echo "==> Got UUIDs!"
|
||||||
UUIDS=($(blkid $targetDrive"1" $targetDrive"2" $targetDrive"3" -o value -s UUID))
|
UUIDS=($(blkid $targetDrive"1" $targetDrive"2" $targetDrive"3" -o value -s UUID))
|
||||||
if $encryptedDevice
|
if $encryptedDevice then
|
||||||
then
|
|
||||||
UUIDS[3]=UUIDS[2]
|
UUIDS[3]=UUIDS[2]
|
||||||
UUIDS[2]=`blkid /dev/mapper/targetLuks -o value -s UUID`
|
UUIDS[2]=`blkid /dev/mapper/targetLuks -o value -s UUID`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##mount disks
|
##mount disks
|
||||||
echo "==> Mounting..."
|
echo "==> Mounting..."
|
||||||
if $encryptedDevice
|
if $encryptedDevice then
|
||||||
then
|
|
||||||
mount /dev/mapper/targetLuks /mnt
|
mount /dev/mapper/targetLuks /mnt
|
||||||
else
|
else
|
||||||
mount $targetDrive"3" /mnt
|
mount $targetDrive"3" /mnt
|
||||||
@ -159,10 +156,10 @@ rm /mnt/etc/fstab.orig #TODO OFC we need to check mountpoint, not only type of F
|
|||||||
echo "==> Result:"
|
echo "==> Result:"
|
||||||
cat /mnt/etc/fstab
|
cat /mnt/etc/fstab
|
||||||
##update grub linux options
|
##update grub linux options
|
||||||
if $encryptedDevice
|
if $encryptedDevice then
|
||||||
cat /mnt/etc/default/grub | sed 's/cryptdevice=UUID=[A-Fa-f0-9-]*:cryptroot /cryptdevice=UUID='${UUIDS[3]}':cryptroot/' > /mnt/etc/default/grub
|
cat /mnt/etc/default/grub | sed 's/cryptdevice=UUID=[A-Fa-f0-9-]*:cryptroot /cryptdevice=UUID='${UUIDS[3]}':cryptroot/' > /mnt/etc/default/grub
|
||||||
else
|
else
|
||||||
cat /mnt/etc/default/grub | sed 's/cryptdevice=UUID=[A-Fa-f0-9-]*:cryptroot //' > /mnt/etc/default/grub
|
cat /mnt/etc/default/grub | sed 's/cryptdevice=UUID=[A-Fa-f0-9-]*:cryptroot //' > /mnt/etc/default/grub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat /mnt/etc/default/grub | sed 's/resume=UUID=[A-Fa-f0-9-]*/resume=UUID='${UUIDS[0]}'/' > /mnt/etc/default/grub
|
cat /mnt/etc/default/grub | sed 's/resume=UUID=[A-Fa-f0-9-]*/resume=UUID='${UUIDS[0]}'/' > /mnt/etc/default/grub
|
||||||
|
Loading…
Reference in New Issue
Block a user