From 7b7853ecb8a2a6c5c4c6071db73cdf23b82250ed Mon Sep 17 00:00:00 2001 From: sean Date: Wed, 10 Jul 2019 15:04:14 -0700 Subject: [PATCH] tweaks --- setup.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/setup.sh b/setup.sh index c87a3e9..7feece3 100644 --- a/setup.sh +++ b/setup.sh @@ -301,7 +301,7 @@ echo "echo \"Done.\"" >> /mnt/setup-chroot.sh # you need sed to do this right! echo 'echo ""' >> /mnt/setup-chroot.sh echo 'echo "Modifying grub for ZFS root..."' >> /mnt/setup-chroot.sh -echo "errors=\$(sed -ir 's/GRUB_CMDLINE_LINUX=\".*\"/GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"' /etc/defaults/grub 2>&1 1>/dev/null)" >> /mnt/setup-chroot.sh +echo "errors=\$(sed -ir 's/GRUB_CMDLINE_LINUX=\".*\"/GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"/g' /etc/defaults/grub 2>&1 1>/dev/null)" >> /mnt/setup-chroot.sh echo "if ! [ \"\$?\" = \"0\" ]; then echo \"Failed to set grub ZFS root - \$errors\"; exit 104; fi" >> /mnt/setup-chroot.sh echo 'echo "Done."' >> /mnt/setup-chroot.sh @@ -314,9 +314,13 @@ echo " exit 1">> /mnt/setup-chroot.sh echo "fi">> /mnt/setup-chroot.sh echo "echo \"Done.\"" >> /mnt/setup-chroot.sh -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 'echo ""' >> /mnt/setup-chroot.sh +echo 'echo "Installing grub UEFI on plex1..."' >> /mnt/setup-chroot.sh +echo "errors=\$(grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --recheck --no-floppy && umount /boot/efi)" >> /mnt/setup-chroot.sh +echo "if ! [ \"\$?\" = \"0\" ]; then echo \"Failed to install grub UEFI on plex1 - \$errors\"; exit 104; fi" >> /mnt/setup-chroot.sh +echo "echo \"Done.\"" >> /mnt/setup-chroot.sh +# error check this as one big block 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 "zfs set mountpoint=legacy rpool/var/log">> /mnt/setup-chroot.sh @@ -330,19 +334,22 @@ echo "echo \"rpool/tmp /tmp zfs nodev,relatime 0 0\" >> /etc/fstab" >> /mnt/setu echo 'echo ""' >> /mnt/setup-chroot.sh echo 'echo "Enabling SSH..."'>> /mnt/setup-chroot.sh -echo "errors=\$(systemctl enable ssh 2>&1 1>/dev/null && ufw allow in port 22 proto tcp 2>&1 1>/dev/null)">> /mnt/setup-chroot.sh +echo "errors=\$(systemctl enable ssh 2>&1 1>/dev/null && ufw allow in on any from any to any port 22 proto tcp 2>&1 1>/dev/null)">> /mnt/setup-chroot.sh echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh echo ' echo "Failed to enable SSH - $errors"' >> /mnt/setup-chroot.sh echo " exit 101">> /mnt/setup-chroot.sh echo "fi">> /mnt/setup-chroot.sh echo 'echo "Done."'>> /mnt/setup-chroot.sh -# create parker user automated way +echo 'echo ""'>> /mnt/setup-chroot.sh +echo 'echo "Creating admin user..."'>> /mnt/setup-chroot.sh +# error check this 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 echo "usermod -a -G adm,cdrom,dip,plugdev,sudo $admin" >> /mnt/setup-chroot.sh echo "echo '${admin}:${rootpassword}' | chpasswd" >> /mnt/setup-chroot.sh +echo 'echo "Done."'>> /mnt/setup-chroot.sh #create swap space, too if necessary @@ -359,6 +366,7 @@ if ! [ "$?" = "0" ]; then exit $? fi +# commented out for debugging #echo "" #echo "Clearing chroot configuration script..." #rm /mnt/setup-chroot.sh @@ -378,7 +386,7 @@ fi #fi #echo "Done." -#echo "Please reboot - and set your boot device in the BIOS" +#echo "Congratulations! The install was successful. Please reboot and set your boot device using UEFI in the BIOS." exit 0 #sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "$file" \ No newline at end of file