test
sean 7 years ago
parent c3c45019bc
commit 7b7853ecb8

@ -301,7 +301,7 @@ echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
# you need sed to do this right! # you need sed to do this right!
echo 'echo ""' >> /mnt/setup-chroot.sh echo 'echo ""' >> /mnt/setup-chroot.sh
echo 'echo "Modifying grub for ZFS root..."' >> /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 "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 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 "fi">> /mnt/setup-chroot.sh
echo "echo \"Done.\"" >> /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 'echo ""' >> /mnt/setup-chroot.sh
echo "umount /boot/efi" >> /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 "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
echo "zfs set mountpoint=legacy rpool/var/log">> /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 ""' >> /mnt/setup-chroot.sh
echo 'echo "Enabling SSH..."'>> /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 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh
echo ' echo "Failed to enable SSH - $errors"' >> /mnt/setup-chroot.sh echo ' echo "Failed to enable SSH - $errors"' >> /mnt/setup-chroot.sh
echo " exit 101">> /mnt/setup-chroot.sh echo " exit 101">> /mnt/setup-chroot.sh
echo "fi">> /mnt/setup-chroot.sh echo "fi">> /mnt/setup-chroot.sh
echo 'echo "Done."'>> /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 "useradd $admin" >> /mnt/setup-chroot.sh
echo "cp -a /etc/skel/.[!.]* /home/$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 "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 "usermod -a -G adm,cdrom,dip,plugdev,sudo $admin" >> /mnt/setup-chroot.sh
echo "echo '${admin}:${rootpassword}' | chpasswd" >> /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 #create swap space, too if necessary
@ -359,6 +366,7 @@ if ! [ "$?" = "0" ]; then
exit $? exit $?
fi fi
# commented out for debugging
#echo "" #echo ""
#echo "Clearing chroot configuration script..." #echo "Clearing chroot configuration script..."
#rm /mnt/setup-chroot.sh #rm /mnt/setup-chroot.sh
@ -378,7 +386,7 @@ fi
#fi #fi
#echo "Done." #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 exit 0
#sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "$file" #sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "$file"
Loading…
Cancel
Save