From 71c1d92ed9bee36bb8a8564bbb1cf15ef2dd5e1f Mon Sep 17 00:00:00 2001 From: sean Date: Wed, 10 Jul 2019 01:19:21 -0700 Subject: [PATCH] tweaks --- setup.sh | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/setup.sh b/setup.sh index 050d48c..75c8809 100644 --- a/setup.sh +++ b/setup.sh @@ -90,8 +90,8 @@ echo "Done." echo "" echo "Starting debian bootstrap - this can take some time..." -debootstrap bionic /mnt -#errors=`debootstrap bionic /mnt 2>&1 1>/dev/null` +#debootstrap bionic /mnt +errors=`debootstrap bionic /mnt 2>&1 1/dev/null` if ! [ "$?" = "0" ]; then echo "Failed to bootstrap root - $errors" exit 6 @@ -201,20 +201,24 @@ echo "echo \"Done.\"" >> /mnt/setup-chroot.sh echo "cp /usr/share/zoneinfo/$timezone /etc/localtime" >> /mnt/setup-chroot.sh echo "apt install -y --no-install-recommends linux-image-generic" >> /mnt/setup-chroot.sh echo "apt install -y vim bash screen tmux zfs-initramfs dosfstools openssh-server">> /mnt/setup-chroot.sh -i="0" -for disk in `echo "$disks"`; do - echo "mkdosfs -F 32 -s 1 -n EFI /dev/disk/by-id/${disk}-part2" >> /mnt/setup-chroot.sh - echo "mkdir /boot/efi${i}" >> /mnt/setup-chroot.sh - echo "echo PARTUUID=$(blkid -s PARTUUID -o value /dev/disk/by-id/${disk}-part2) /boot/efi${i} vfat nofail,x-systemd.device-timeout=0 0 1 >> /etc/fstab" >> /mnt/setup-chroot.sh - echo "mount /boot/efi${i}" >> /mnt/setup-chroot.sh - i=$((i + 1)) -done + +firstdisk=`echo "$disks" | top -n1` +echo "mkdosfs -F 32 -s 1 -n EFI /dev/disk/by-id/${firstdisk}-part2" >> /mnt/setup-chroot.sh +echo "mkdir /boot/efi" >> /mnt/setup-chroot.sh +echo "echo PARTUUID=$(blkid -s PARTUUID -o value /dev/disk/by-id/${firstdisk}-part2) /boot/efi vfat nofail,x-systemd.device-timeout=0 0 1 >> /etc/fstab" >> /mnt/setup-chroot.sh +echo "mount /boot/efi" >> /mnt/setup-chroot.sh echo "apt install -y grub-efi-amd64-signed shim-signed" >> /mnt/setup-chroot.sh -echo "echo 'root:${rootpassword}' | chpasswd" >> /mnt/setup-chroot.sh -echo "systemctl enable zfs-import-bpool.service" >> /mnt/setup-chroot.sh +i="2" +for disk in `echo "$disks" | -tail -n2`; do + echo "dd if=/dev/disk/by-id/${firstdisk}-part2 of=/dev/disk/by-id/${disk}-part2" >> /mnt/setup-chroot.sh + echo "efibootmgr -c -g -d /dev/disk/by-id/${disk} -p 3 -L "ubuntu-$i" -l '\EFI\ubuntu\grubx64.efi'" >> /mnt/setup-chroot.sh + i=$((i + 1)) +done +echo "echo 'root:${rootpassword}' | chpasswd" >> /mnt/setup-chroot.sh +echo "systemctl enable zfs-import-bpool.service" >> /mnt/setup-chroot.sh #cp /usr/sharesystemd/tmp.mount /etc/systemd/system/ @@ -233,12 +237,9 @@ echo "update-initramfs -u -k all" >> /mnt/setup-chroot.sh # GRUB_CMDLINE_LINUX="root=ZFS=rpool/ROOT/ubuntu" <--- replace this echo "update-grub">> /mnt/setup-chroot.sh -i="0" -for f in `echo "$disks"`; do - echo "grub-install --target=x86_64-efi --efi-directory=/boot/efi${i} --bootloader-id=ubuntu --recheck --no-floppy" >> /mnt/setup-chroot.sh - echo "umount /boot/efi${i}" >> /mnt/setup-chroot.sh - i=$((i + 1)) -done + +echo "grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --recheck --no-floppy" >> /mnt/setup-chroot.sh +echo "umount /boot/efi" >> /mnt/setup-chroot.sh echo "zfs set mountpoint=legacy bpool/BOOT/ubuntu" >> /mnt/setup-chroot.sh echo "echo \"bpool/BOOT/ubuntu /boot zfs nodev,relatime,x-systemd.requires=zfs-import-bpool.service 0 0\" >> /etc/fstab" >> /mnt/setup-chroot.sh @@ -301,4 +302,6 @@ chroot /mnt /setup-chroot.sh #echo "Done." #echo "Please reboot - and set your boot device in the BIOS" -exit 0 \ No newline at end of file +exit 0 + +#sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "$file" \ No newline at end of file