From 527a9e6b0a88d1b8effd189c5eace5e092a32790 Mon Sep 17 00:00:00 2001 From: oddlama Date: Mon, 6 Jan 2020 18:20:47 +0100 Subject: [PATCH] Use binary vanilla kernel --- README.md | 6 ++++-- scripts/config.sh | 7 +++++-- scripts/functions.sh | 3 ++- scripts/main.sh | 10 +++++++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 47a35f0..5d2a13b 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Recommendations: * Edit sshd_config, change port and create a sshusers group for users which may use ssh. * Use LUKS encryption on the disk * Use a properly configured kernel, at best restrict even USB! +* Adjust make.conf (default parallel emerge, cpu flags, binhost?) **TL;DR:** Installs gentoo on a new system, suited for both servers and desktops. @@ -22,7 +23,7 @@ See [Install](#Install) for usage instructions. --- -This script will install a minimal (no-bloat) EFI bootable gentoo system. +This script will install a minimal EFI bootable gentoo system, without additional bloat. It will stick closely to the [Gentoo AMD64 Handbook](https://wiki.gentoo.org/wiki/Handbook:AMD64) and [Sakaki's EFI Install Guide](https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide). @@ -77,7 +78,7 @@ this script is not suited for it. #### EFI It is assumed that your system can (and will) be booted via EFI. -This is not a strict requirement, but othewise you will be responsible +This is not a strict requirement, but otherwise you will be responsible to make the system bootable. This probably involves the following steps: @@ -85,6 +86,7 @@ This probably involves the following steps: * Change partition type of `efi` partition to `ef02` (BIOS boot partition) * Change partition name and filesystem name to `boot` * Install and configure syslinux +* Adjust make.conf Maybe there will be a convenience script for this at some point. No promises though. diff --git a/scripts/config.sh b/scripts/config.sh index f90eeb1..fd7dc07 100644 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -66,9 +66,12 @@ LOCALE="C.utf8" GENTOO_MIRROR="https://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo" #GENTOO_MIRROR="https://distfiles.gentoo.org" +# The architecture of the target system (only tested with amd64) +GENTOO_ARCH="amd64" + # The stage3 tarball to install -STAGE3_BASENAME="stage3-amd64-hardened+nomultilib" -#STAGE3_BASENAME="stage3-amd64-hardened-selinux+nomultilib" +STAGE3_BASENAME="stage3-$GENTOO_ARCH-hardened+nomultilib" +#STAGE3_BASENAME="stage3-$GENTOO_ARCH-hardened-selinux+nomultilib" ################################################ diff --git a/scripts/functions.sh b/scripts/functions.sh index 3116562..5505511 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -27,7 +27,8 @@ check_config() { || die "KEYMAP contains invalid characters" # Check hostname per RFC1123 - [[ "$HOSTNAME" ~= '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$' ]] \ + local hostname_regex='^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$' + [[ "$HOSTNAME" =~ $hostname_regex ]] \ || die "'$HOSTNAME' is not a valid hostname" if [[ "$INSTALL_ANSIBLE" == true ]]; then diff --git a/scripts/main.sh b/scripts/main.sh index 4c1b434..34bc12f 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -103,13 +103,17 @@ main_install_gentoo_in_chroot() { einfo "Selecting fastest portage mirrors" try mirrorselect -s 4 -b 10 -D + einfo "Adding ~$GENTOO_ARCH to ACCEPT_KEYWORDS" + echo "ACCEPT_KEYWORDS=\"~$GENTOO_ARCH\"" >> /etc/portage/make.conf \ + || die "Could not modify /etc/portage/make.conf" + # Install git (for git portage overlays) einfo "Installing git" try emerge --verbose dev-vcs/git # Install vanilla kernel and efibootmgr, to be able to boot the system. - einfo "Installing vanilla kernel" - try emerge --verbose sys-kernel/vanilla-kernel sys-boot/efibootmgr + einfo "Installing binary vanilla kernel" + try emerge --verbose sys-kernel/vanilla-kernel-bin sys-boot/efibootmgr # Copy kernel to EFI local kernel_version @@ -163,7 +167,7 @@ main_install_gentoo_in_chroot() { # Install and enable dhcpcd einfo "Installing dhcpcd" - try emerge --verbose net-misc/dhcpcd sys-apps/iproute2 + try emerge --verbose net-misc/dhcpcd rc-update add dhcpcd default \ || die "Could not add dhcpcd to default services"