new booting tweaks

test
sean 7 years ago
parent c089338005
commit 9f9168ae6b

@ -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,6 +108,8 @@ for disk in `echo "$alldisks"`; do
echo "Done."
done
if [ "$efi" = "1" ]; then
for disk in `echo "$boots"`; do
echo ""
echo "Creating boot partitions for device $disk..."
@ -117,6 +121,32 @@ for disk in `echo "$boots"`; do
echo "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 ""
echo "Creating main storage for device $disk..."
@ -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"
@ -400,6 +433,7 @@ if ! [ "$boots" = "" ]; then
echo 'echo "Done."' >> /mnt/setup-chroot.sh
fi
fi
# error check this as one big block
echo "zfs set mountpoint=legacy bpool/BOOT/ubuntu" >> /mnt/setup-chroot.sh

Loading…
Cancel
Save