|
|
|
|
@ -162,6 +162,15 @@ echo "[Install]" >> /mnt/etc/systemd/system/zfs-import-bpool.service
|
|
|
|
|
echo " WantedBy=zfs-import.target " >> /mnt/etc/systemd/system/zfs-import-bpool.service
|
|
|
|
|
echo "Done."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Creating home directory..."
|
|
|
|
|
errors=`zfs create rpool/home/${admin} 2>&1 1>/dev/null`
|
|
|
|
|
if ! [ "$?" = "0" ]; then
|
|
|
|
|
echo "Unable to create home directory - $errors"
|
|
|
|
|
exit 9
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Mounting chroot mounts..."
|
|
|
|
|
mount --rbind /dev /mnt/dev
|
|
|
|
|
@ -177,30 +186,28 @@ echo "ln -s /proc/self/mounts /etc/mtab" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"Updating apt repositories inside chroot...\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "apt update" >> /mnt/setup-chroot.sh
|
|
|
|
|
#echo "errors=`apt update 2>&1 1>/dev/null`" >> /mnt/setup-chroot.sh
|
|
|
|
|
#echo "apt update" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "errors=`apt update 2\>\&1 1\>/dev/null`" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh
|
|
|
|
|
echo " echo \"Failed to update apt repositories inside chroot - \$errors\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
#echo " exit 1">> /mnt/setup-chroot.sh
|
|
|
|
|
echo " exit 1">> /mnt/setup-chroot.sh
|
|
|
|
|
echo "fi">> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"Done.\"">> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"\"">> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"Setting locale...\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "locale-gen en_US.UTF-8" >> /mnt/setup-chroot.sh
|
|
|
|
|
#echo "echo 'LANG=\"en_US.UTF-8\"' > /etc/default/locale" >> /mnt/setup-chroot.sh
|
|
|
|
|
#echo "echo 'LANGUAGE=\"en_US:en\"' >> /etc/default/locale">> /mnt/setup-chroot.sh
|
|
|
|
|
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
|
|
|
|
|
echo "i=\"0\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "for disk in \"\$disks\"; do" >> /mnt/setup-chroot.sh
|
|
|
|
|
i="0"
|
|
|
|
|
for disk in `echo "$disks"`; do
|
|
|
|
|
echo " echo \"mkdosfs -F 32 -s 1 -n EFI /dev/disk/by-id/${disk}-part2\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo " echo \"mkdir /boot/efi\${i}\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo " 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 \"mount /boot/efi\${i}\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo " i=$((i + 1))" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "done" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo " echo \"mkdir /boot/efi${i}\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo " 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 \"mount /boot/efi${i}\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
i=$((i + 1))
|
|
|
|
|
done
|
|
|
|
|
echo "apt install -y grub-efi-amd64-signed shim-signed" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo 'root:${rootpassword}' | chpasswd" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
@ -227,7 +234,7 @@ echo "update-initramfs -u -k all" >> /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${i} --botloader-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\${i}" >> /mnt/setup-chroot.sh
|
|
|
|
|
i=$((i + 1))
|
|
|
|
|
done
|
|
|
|
|
@ -247,7 +254,6 @@ echo "systemctl enable ssh">> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# create parker user automated way
|
|
|
|
|
echo "zfs create rpool/home/$admin" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "useradd $admin" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "cp -a /etc/skel/.[!.]* /home/$admin" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "chown -R ${admin}:${admin} /home/$admin" >> /mnt/setup-chroot.sh
|
|
|
|
|
|