Hopefully this all just works

This commit is contained in:
Salt 2020-12-02 21:00:00 -06:00
parent 3ea3744d3e
commit 2f8588f299
1 changed files with 48 additions and 2 deletions

View File

@ -132,13 +132,15 @@ build-gentoo() {
CXXFLAGS="\${COMMON_FLAGS}"
FEATURES="-network-sandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
GRUB_PLATFORMS="efi-64"
MAKEOPTS="-j$(nproc)"
USE="systemd -elogind -test"
USE="networkmanager systemd -elogind -test"
EOF
# This is required on >=17.1 to unroll some circular dependencies
cat <<-EOF > "$_optdest/etc/portage/package.use/gentoostrap"
# These solve circular dependency issues
dev-lang/python -bluetooth -sqlite
net-misc/networkmanager dhclient
sys-libs/ncurses -gpm
EOF
# Configure default ebuild repositories
@ -150,6 +152,10 @@ build-gentoo() {
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
# Hostname
echo "$(hostname -s)" > "$_optdest/etc/conf.d/hostname"
# hosts
echo "127.0.0.1 $(hostname -s)" > "$_optdest/etc/hosts"
# Timezone
cp /etc/timezone "$_optdest/etc/timezone"
# Locale
@ -157,6 +163,14 @@ build-gentoo() {
en_US ISO-8859-1
en_US.UTF-8 UTF-8
EOF
# fstab
[ -f "$_optdest/etc/fstab" ] || cat <<-EOF > "$_optdest/etc/fstab"
# fstab - Filesystem table
# See fstab(5) for syntax and configuration information
# Example:
#LABEL=gentoo / ext4 defaults,noatime,errors=remount-ro 0 1
EOF
"${EDITOR:-vim}" "$_optdest/etc/fstab"
# Now we need to pivot into a chroot and finish configuration natively
# Buuuut... since we're using systemd, we get to just spawn a systemd-nspawn container
@ -194,7 +208,39 @@ build-gentoo-chroot() {
env-update
. /etc/profile
# Build a kernel
# Extra packages
emerge --jobs --quiet-build y \
sys-fs/{e2fs,xfs}progs \
sys-process/cronie
# Unnghhh... COLONEL...
# 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/gentoo-kernel
# Rebuilding modules shouldn't be necessary since the kernel was our last step
#emerge --jobs --quiet-build y @module-rebuild
# Install the bootloader
emerge --jobs --quiet-build y sys-boot/grub:2
mkdir -p /boot/efi
chmod 0700 /boot/efi
# We've made it this far and now the user has to do just a liiiiiitle bit of configuration
clear
cat <<-EOF
Initial system configuration is complete. There are now just a few tasks left:
* Mount the ESP under /boot/efi
* Install and configure grub
* Set a root password
* Create a normal user
* Reboot and pray
Other things you may want to do:
* Change the system hostname
Dumping to a shell now. Have fun!
EOF
exec bash
}
# Main