Automate more things, begin work on post-chroot tasks

Such as another chroot
This commit is contained in:
Salt 2020-12-04 01:45:01 -06:00
parent 4a658c2669
commit 26baf4a1fa

View File

@ -183,6 +183,9 @@ build-gentoo() {
popd popd
cp "$0" "$_optdest/gentoostrap.sh" cp "$0" "$_optdest/gentoostrap.sh"
sudo systemd-nspawn --directory="$_optdest" /gentoostrap.sh -c sudo systemd-nspawn --directory="$_optdest" /gentoostrap.sh -c
# The nspawn container sadly cannot manipulate the environment entirely, so we need to now do an ACTUAL chroot to install GRUB
} }
build-gentoo-chroot() { build-gentoo-chroot() {
# Build Gentoo, but from within the chroot environment # Build Gentoo, but from within the chroot environment
@ -216,9 +219,17 @@ build-gentoo-chroot() {
# Extra packages # Extra packages
emerge --jobs --quiet-build y \ emerge --jobs --quiet-build y \
app-admin/sudo \
app-editors/vim \
sys-fs/{e2fs,xfs}progs \ sys-fs/{e2fs,xfs}progs \
sys-process/cronie sys-process/cronie
# Configure sudoers
cat <<-EOF >> "/etc/sudoers"
%wheel ALL=(ALL) ALL
ansible ALL=(ALL) NOPASSWD:ALL
EOF
# Unnghhh... COLONEL... # Unnghhh... COLONEL...
# Dude distribution kernels are awesome # Dude distribution kernels are awesome
emerge --jobs --quiet-build y sys-kernel/installkernel-gentoo sys-kernel/linux-firmware emerge --jobs --quiet-build y sys-kernel/installkernel-gentoo sys-kernel/linux-firmware
@ -231,14 +242,16 @@ build-gentoo-chroot() {
mkdir -p /boot/efi mkdir -p /boot/efi
chmod 0700 /boot/efi chmod 0700 /boot/efi
# Configure a new user, add him to sudoers
useradd salt -m -G wheel -s /bin/bash -u 1000 -U
passwd salt
# We've made it this far and now the user has to do just a liiiiiitle bit of configuration # We've made it this far and now the user has to do just a liiiiiitle bit of configuration
clear clear
cat <<-EOF cat <<-EOF
Initial system configuration is complete. There are now just a few tasks left: Initial system configuration is complete. There are now just a few tasks left:
* Mount the ESP under /boot/efi * Mount the ESP under /boot/efi
* Install and configure grub * Install and configure grub
* Set a root password
* Create a normal user
* Reboot and pray * Reboot and pray
Other things you may want to do: Other things you may want to do: