new booting tweaks
This commit is contained in:
@@ -25,6 +25,8 @@ width=`tput cols`
|
||||
height=`tput lines`
|
||||
window=$((height - 5))
|
||||
|
||||
if [ -e "/sys/firmware/efi/efivars" ]; then efi="1" else efi="0"; fi
|
||||
|
||||
# gather input at the start
|
||||
devices=""; for device in $(ls /dev/disk/by-id | grep -v part); do devices="$devices $device off"; done
|
||||
disks=`dialog --separate-output --no-cancel --no-items --title "Root devices" --checklist "Select root OS disks:" $height $width ${window}$devices 2>&1 1>/dev/tty`
|
||||
@@ -106,7 +108,9 @@ for disk in `echo "$alldisks"`; do
|
||||
echo "Done."
|
||||
done
|
||||
|
||||
for disk in `echo "$boots"`; do
|
||||
if [ "$efi" = "1" ]; then
|
||||
|
||||
for disk in `echo "$boots"`; do
|
||||
echo ""
|
||||
echo "Creating boot partitions for device $disk..."
|
||||
errors=`sgdisk -n2:1M:+512M -t2:EF00 /dev/disk/by-id/$disk 2>&1 1>/dev/null && sgdisk -n3:0:+512M -t3:BF01 /dev/disk/by-id/$disk 2>&1 1>/dev/null`
|
||||
@@ -115,7 +119,33 @@ for disk in `echo "$boots"`; do
|
||||
exit 3
|
||||
fi
|
||||
echo "Done."
|
||||
done
|
||||
done
|
||||
|
||||
for disk in `echo "$disks"`; do
|
||||
echo ""
|
||||
echo "Creating boot partitions for device $disk..."
|
||||
errors=`sgdisk -n3:0:+512M -t3:BF01 /dev/disk/by-id/$disk 2>&1 1>/dev/null`
|
||||
if ! [ "$?" = "0" ]; then
|
||||
echo "Failed to create boot partition for device $disk - $errors"
|
||||
exit 3
|
||||
fi
|
||||
echo "Done."
|
||||
done
|
||||
|
||||
else
|
||||
|
||||
for disk in `echo "$boots"`; do
|
||||
echo ""
|
||||
echo "Creating boot partitions for device $disk..."
|
||||
errors=`sgdisk -a1 -n1:24K:+1000K -t1:EF02 /dev/disk/by-id/$disk 2>&1 1>/dev/null`
|
||||
if ! [ "$?" = "0" ]; then
|
||||
echo "Failed to create boot partition for device $disk - $errors"
|
||||
exit 3
|
||||
fi
|
||||
echo "Done."
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
for disk in `echo "$disks"`; do
|
||||
echo ""
|
||||
@@ -135,9 +165,10 @@ bootmirror=""; rootraidz=""; for disk in `echo "$disks"`; do bootmirror="$bootmi
|
||||
partprobe 2>/dev/null 1>/dev/null
|
||||
|
||||
# wait for the partitions to show up
|
||||
for disk in `echo "$boots"`; do
|
||||
|
||||
for disk in `echo "$disk"`; do
|
||||
pending="0"
|
||||
while ! [ -e "/dev/disk/by-id/${disk}-part3" ]; do
|
||||
while ! [ -e "/dev/disk/by-id/${disk}-part1" ]; do
|
||||
partprobe 2>/dev/null 1>/dev/null
|
||||
if [ "$pending" = "0" ]; then echo "" && echo "Waiting for ${disk} boot partition to update..."; pending="1"; fi
|
||||
sleep 3
|
||||
@@ -389,6 +420,8 @@ echo "if ! [ \"\$?\" = \"0\" ]; then echo \"Failed to install grub UEFI on plex1
|
||||
echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
|
||||
|
||||
if ! [ "$boots" = "" ]; then
|
||||
if [ "$efi" = "1" ]; then
|
||||
|
||||
echo 'echo ""' >> /mnt/setup-chroot.sh
|
||||
echo 'echo "Cloning EFI boot partition to all boot devices..."' >> /mnt/setup-chroot.sh
|
||||
i="2"
|
||||
@@ -399,6 +432,7 @@ if ! [ "$boots" = "" ]; then
|
||||
done
|
||||
|
||||
echo 'echo "Done."' >> /mnt/setup-chroot.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
# error check this as one big block
|
||||
|
||||
Reference in New Issue
Block a user