|
|
|
@ -90,8 +90,8 @@ echo "Done."
|
|
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "Starting debian bootstrap - this can take some time..."
|
|
|
|
echo "Starting debian bootstrap - this can take some time..."
|
|
|
|
debootstrap bionic /mnt
|
|
|
|
#debootstrap bionic /mnt
|
|
|
|
#errors=`debootstrap bionic /mnt 2>&1 1>/dev/null`
|
|
|
|
errors=`debootstrap bionic /mnt 2>&1 1/dev/null`
|
|
|
|
if ! [ "$?" = "0" ]; then
|
|
|
|
if ! [ "$?" = "0" ]; then
|
|
|
|
echo "Failed to bootstrap root - $errors"
|
|
|
|
echo "Failed to bootstrap root - $errors"
|
|
|
|
exit 6
|
|
|
|
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 "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 --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
|
|
|
|
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
|
|
|
|
firstdisk=`echo "$disks" | top -n1`
|
|
|
|
echo "mkdosfs -F 32 -s 1 -n EFI /dev/disk/by-id/${disk}-part2" >> /mnt/setup-chroot.sh
|
|
|
|
echo "mkdosfs -F 32 -s 1 -n EFI /dev/disk/by-id/${firstdisk}-part2" >> /mnt/setup-chroot.sh
|
|
|
|
echo "mkdir /boot/efi${i}" >> /mnt/setup-chroot.sh
|
|
|
|
echo "mkdir /boot/efi" >> /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 "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${i}" >> /mnt/setup-chroot.sh
|
|
|
|
echo "mount /boot/efi" >> /mnt/setup-chroot.sh
|
|
|
|
i=$((i + 1))
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "apt install -y grub-efi-amd64-signed shim-signed" >> /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/
|
|
|
|
#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
|
|
|
|
# GRUB_CMDLINE_LINUX="root=ZFS=rpool/ROOT/ubuntu" <--- replace this
|
|
|
|
|
|
|
|
|
|
|
|
echo "update-grub">> /mnt/setup-chroot.sh
|
|
|
|
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 --bootloader-id=ubuntu --recheck --no-floppy" >> /mnt/setup-chroot.sh
|
|
|
|
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" >> /mnt/setup-chroot.sh
|
|
|
|
echo "umount /boot/efi${i}" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
i=$((i + 1))
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "zfs set mountpoint=legacy bpool/BOOT/ubuntu" >> /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
|
|
|
|
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 "Done."
|
|
|
|
|
|
|
|
|
|
|
|
#echo "Please reboot - and set your boot device in the BIOS"
|
|
|
|
#echo "Please reboot - and set your boot device in the BIOS"
|
|
|
|
exit 0
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "$file"
|