Compare commits

..

No commits in common. "main" and "v1.3.0" have entirely different histories.
main ... v1.3.0

9 changed files with 108 additions and 424 deletions

View File

@ -22,7 +22,7 @@ This installer might appeal to you if
- you want to try gentoo without initially investing a lot of time, or fully committing to it yet. - you want to try gentoo without initially investing a lot of time, or fully committing to it yet.
- you already are a gentoo expert but want an automatic and repeatable best-practices installation. - you already are a gentoo expert but want an automatic and repeatable best-practices installation.
Of course, we do encourage everyone to install gentoo manually. You will learn a lot if you Of course we do encourage everyone to install gentoo manually. You will learn a lot if you
haven't done so already. haven't done so already.
## Usage ## Usage
@ -43,15 +43,11 @@ Every option is explained in detail in `gentoo.conf.example` and in the help men
When installing, you will be asked to review the partitioning before anything critical is done. When installing, you will be asked to review the partitioning before anything critical is done.
The installer should be able to run without any user supervision after partitioning, but depending The installer should be able to run without any user supervision after partitioning, but depending
on the current state of the gentoo repository, you might need to intervene in case a package fails on the current state of the gentoo repository you might need to intervene in case a package fails
to emerge. The critical commands will ask you what to do in case of a failure. If you encounter a to emerge. The critical commands will ask you what to do in case of a failure. If you encounter a
problem you cannot solve, you might want to consider getting in contact with some experienced people problem you cannot solve, you might want to consider getting in contact with some experienced people
on [IRC](https://www.gentoo.org/get-involved/irc-channels/) or [Discord](https://discord.com/invite/gentoolinux). on [IRC](https://www.gentoo.org/get-involved/irc-channels/) or [Discord](https://discord.com/invite/gentoolinux).
If you need to enter an installed system in a chroot to fix something (e.g. after rebooting your live system),
you can always clone the installer, mount your main drive under `/mnt` and use `./install --chroot /mnt` to
just chroot into your system.
## Overview ## Overview
The installer performs the following main steps (in roughly this order), The installer performs the following main steps (in roughly this order),
@ -75,7 +71,7 @@ Here are some things that you might want to consider doing after the system inst
1. Read the news with `eselect news read`. 1. Read the news with `eselect news read`.
2. Compile a custom kernel and remove `gentoo-kernel-bin` 2. Compile a custom kernel and remove `gentoo-kernel-bin`
3. Adjust `/etc/portage/make.conf` 3. Adjust `/etc/portage/make.conf`
- Set `CFLAGS` to `<march_native_flags> -O2 -pipe` for native builds by using the `resolve-march-native` tool - Set `CFLAGS` to `-O2 -pipe <march_native_flags>` for native builds by useing the `resolve-march-native` tool
- Set `CPU_FLAGS_X86` using the `cpuid2cpuflags` tool - Set `CPU_FLAGS_X86` using the `cpuid2cpuflags` tool
4. Use a safe umask like `umask 077` 4. Use a safe umask like `umask 077`
@ -100,7 +96,7 @@ this to a minimum, because of the quite "interactive" nature of gentoo package m
By default, the installed system uses gentoo's binary kernel distribution (`sys-kernel/gentoo-kernel-bin`) By default, the installed system uses gentoo's binary kernel distribution (`sys-kernel/gentoo-kernel-bin`)
together with an initramfs generated by dracut. This ensures that the installed system works on all common hardware configurations. together with an initramfs generated by dracut. This ensures that the installed system works on all common hardware configurations.
Feel free to replace this with a custom-built kernel (and possibly remove/adjust the initramfs) when the system is booted. Feel free to replace this with a custom built kernel (and possibly remove/adjust the initramfs) when the system is booted.
The installer will provide the convenience script `generate_initramfs.sh` in `/boot/efi/` The installer will provide the convenience script `generate_initramfs.sh` in `/boot/efi/`
or `/boot/bios` which may be used to generate a new initramfs for the given kernel version. or `/boot/bios` which may be used to generate a new initramfs for the given kernel version.
@ -121,7 +117,7 @@ In both cases, the update procedure is as follows:
2. `eselect kernel set <kver>` 2. `eselect kernel set <kver>`
3. Backup old kernel and initramfs (`mv "$kernel"{,.bak}`, `mv "$initrd"{,.bak}`) 3. Backup old kernel and initramfs (`mv "$kernel"{,.bak}`, `mv "$initrd"{,.bak}`)
4. Generate new initramfs for this kernel `generate_initramfs.sh <kver> "$initrd"` 4. Generate new initramfs for this kernel `generate_initramfs.sh <kver> "$initrd"`
5. Copy new kernel `cp /boot/kernel-<kver> "$kernel"` (for systemd) or `cp /boot/vmlinuz-<kver> "$kernel"` (for openrc) 5. Copy new kernel `cp /boot/vmlinuz-<kver> "$kernel"`
## Recommendations ## Recommendations
@ -142,18 +138,16 @@ Only certain VPS hosters may require you to use BIOS still (time to write to the
Don't install a bootloader when this script is done, except you absolutely need one. Don't install a bootloader when this script is done, except you absolutely need one.
The kernel can directly be booted by EFI without need for a bootloader. The kernel can directly be booted by EFI without need for a bootloader.
By default, this script will use efibootmgr to add a bootentry directly to your "mainboard's bootselect" (typically F12). By default, this script will use efibootmgr to add a bootentry directly to your "mainboard's bootselect" (typically F12).
Nowadays, there's just no reason to use GRUB, syslinux, or similar bootloaders by default. Nowadays, there's just no reason use GRUB, syslinux, or similar bootloaders by default.
They only add additional time to your boot, and even dualbooting Windows works just fine without one. They only add additional time to your boot, and even dualbooting Windows works just fine without one.
Only if you require frequent editing of kernel parameters, or want kernel autodiscovery from attached media Only if you require frequent editing of kernel parameters, or want kernel autodiscovery from attached media
you might want to consider using one of these. For the average (advanced) user this isn't necessary. you might want to consider using one of these. For the average (advanced) user this isn't necessary.
If you want to add more boot options or want to learn about efibootmgr, refer to [this page on the gentoo wiki](https://wiki.gentoo.org/wiki/Efibootmgr).
#### Modern file systems #### Modern file systems
I recommend using a modern file system like ZFS, both on desktops and servers. I recommend using a modern file system like ZFS, both on desktops and servers.
It provides transparent block-level compression, instant snapshots and full-disk encryption. It provides transparent block-level compression, instant snapshots and full-disk encryption.
Generally, encrypting your root fs doesn't cost you anything and protects your data in case you lose your device. Generally encrypting your root fs doesn't cost you anything and protects your data in case you lose your device.
#### Systemd vs OpenRC #### Systemd vs OpenRC
@ -171,7 +165,7 @@ Make of this what you will, both have their own quirks. Choose your poison.
#### Miscellaneous #### Miscellaneous
- Use the newer iwd for WiFi instead of wpa_supplicant - Use the newer iwd for WIFI instead of wpa_supplicant
- (If systemd) Use timers instead of cron jobs - (If systemd) Use timers instead of cron jobs
## Troubleshooting and FAQ ## Troubleshooting and FAQ
@ -193,11 +187,11 @@ you can use the installer to chroot into an existing system. Run `./install --he
#### Q: ZFS cannot be installed in the chroot due to an unsupported kernel version #### Q: ZFS cannot be installed in the chroot due to an unsupported kernel version
**A:** The newest stable ZFS module may require a kernel version that is newer than what is provided on gentoo stable. **A:** The newest stable ZFS module may requires a kernel version that is newer than what is provided on gentoo stable.
If you encounter this problem, you might be able to fix the problem by switching to testing by dropping to a shell temporarily: If you encounter this problem, you might be able to fix the problem by switching to testing by dropping to a shell temporarily:
``` ```
# Press S<Enter> when asked about what to do next. # Press S<Enter> when ased about what to do next.
# This opens an emergency shell in the chroot. # This opens an emergency shell in the chroot.
echo 'ACCEPT_KEYWORDS="~amd64"' >> /etc/portage/make.conf # Enable testing for your architecture. echo 'ACCEPT_KEYWORDS="~amd64"' >> /etc/portage/make.conf # Enable testing for your architecture.
emerge -v gentoo-kernel-bin # Update kernel to newest version emerge -v gentoo-kernel-bin # Update kernel to newest version

99
configure vendored
View File

@ -43,7 +43,7 @@ while [[ $# -gt 0 ]]; do
shift shift
done done
check_wanted_programs dialog libncurses-dev=ncursesw6-config check_wanted_programs dialog ncurses=ncursesw6-config
# Determine whether EFI is available # Determine whether EFI is available
HAS_EFI_SUPPORT=$([[ -d /sys/firmware/efi ]] && echo -n "true" || echo -n "false") HAS_EFI_SUPPORT=$([[ -d /sys/firmware/efi ]] && echo -n "true" || echo -n "false")
@ -67,7 +67,7 @@ function get_timezone() {
timezone=${file#*zoneinfo/} timezone=${file#*zoneinfo/}
if [[ $timezone == "$file" ]]; then if [[ $timezone == "$file" ]]; then
# not pointing to expected location or not Region/City # not pointing to expected location or not Region/City
echo "Atlantic/Azores" echo "Europe/London"
else else
echo "$timezone" echo "$timezone"
fi fi
@ -108,6 +108,14 @@ function get_all_timezones() {
readarray -t ALL_TIMEZONES < <(find /usr/share/zoneinfo -type f -printf "%P\n" | sort -u) readarray -t ALL_TIMEZONES < <(find /usr/share/zoneinfo -type f -printf "%P\n" | sort -u)
} }
function get_supported_locales() {
if [[ -e /usr/share/i18n/SUPPORTED ]]; then
echo /usr/share/i18n/SUPPORTED
else
echo "$GENTOO_INSTALL_REPO_DIR/contrib/i18n_supported"
fi
}
function recalculate_locales() { function recalculate_locales() {
LOCALES="" LOCALES=""
N_LOCALES=0 N_LOCALES=0
@ -168,8 +176,7 @@ function define_disk_layout() {
define_disk_configuration_function "create_existing_partitions_layout boot=${PARTITIONING_BOOT_DEVICE@Q} swap=${swapdev@Q} type=${PARTITIONING_BOOT_TYPE@Q}" "${PARTITIONING_DEVICE@Q}" ;; define_disk_configuration_function "create_existing_partitions_layout boot=${PARTITIONING_BOOT_DEVICE@Q} swap=${swapdev@Q} type=${PARTITIONING_BOOT_TYPE@Q}" "${PARTITIONING_DEVICE@Q}" ;;
"zfs_centric") define_disk_configuration_function "create_zfs_centric_layout swap=$(define_swap) type=${PARTITIONING_BOOT_TYPE@Q} encrypt=${PARTITIONING_ZFS_USE_ENCRYPTION@Q} compress=$(define_zfs_compression) pool_type=${PARTITIONING_ZFS_POOL_TYPE@Q}" "${PARTITIONING_DEVICES[@]@Q}" ;; "zfs_centric") define_disk_configuration_function "create_zfs_centric_layout swap=$(define_swap) type=${PARTITIONING_BOOT_TYPE@Q} encrypt=${PARTITIONING_ZFS_USE_ENCRYPTION@Q} compress=$(define_zfs_compression) pool_type=${PARTITIONING_ZFS_POOL_TYPE@Q}" "${PARTITIONING_DEVICES[@]@Q}" ;;
"btrfs_centric") define_disk_configuration_function "create_btrfs_centric_layout swap=$(define_swap) type=${PARTITIONING_BOOT_TYPE@Q} raid_type=${PARTITIONING_BTRFS_RAID_TYPE@Q} luks=${PARTITIONING_USE_LUKS@Q}" "${PARTITIONING_DEVICES[@]@Q}" ;; "btrfs_centric") define_disk_configuration_function "create_btrfs_centric_layout swap=$(define_swap) type=${PARTITIONING_BOOT_TYPE@Q} raid_type=${PARTITIONING_BTRFS_RAID_TYPE@Q} luks=${PARTITIONING_USE_LUKS@Q}" "${PARTITIONING_DEVICES[@]@Q}" ;;
"raid0_luks") define_disk_configuration_function "create_raid0_luks_layout swap=$(define_swap) type=${PARTITIONING_BOOT_TYPE@Q} luks=${PARTITIONING_USE_LUKS@Q} root_fs=${PARTITIONING_ROOT_FS@Q}" "${PARTITIONING_DEVICES[@]@Q}" ;; "raid0_luks") define_disk_configuration_function "create_raid0_luks_layout swap=$(define_swap) type=${PARTITIONING_BOOT_TYPE@Q} root_fs=${PARTITIONING_ROOT_FS@Q}" "${PARTITIONING_DEVICES[@]@Q}" ;;
"raid1_luks") define_disk_configuration_function "create_raid1_luks_layout swap=$(define_swap) type=${PARTITIONING_BOOT_TYPE@Q} luks=${PARTITIONING_USE_LUKS@Q} root_fs=${PARTITIONING_ROOT_FS@Q}" "${PARTITIONING_DEVICES[@]@Q}" ;;
"custom") "custom")
# Show current function declaration, trim trailing whitespace # Show current function declaration, trim trailing whitespace
declare -f disk_configuration \ declare -f disk_configuration \
@ -180,27 +187,16 @@ function define_disk_layout() {
ALL_GENTOO_ARCHS=("x86" "amd64" "arm" "arm64") ALL_GENTOO_ARCHS=("x86" "amd64" "arm" "arm64")
ALL_STAGE3_VARIANTS=( ALL_STAGE3_VARIANTS=(
"openrc" "openrc | Minimal OpenRC base (recommended)"
"desktop-openrc" "openrc-desktop | OpenRC, desktop profile, might have blockers"
"systemd" "systemd | Minimal systemd base (recommended)" "systemd" "systemd | Minimal systemd base (recommended)"
"systemd-mergedusr" "systemd-mergedusr | Minimal systemd base with merged filesystem layout" "openrc" "openrc | Minimal OpenRC base (recommended)"
"desktop-systemd" "systemd-desktop | systemd, desktop profile, might have blockers" "desktop-systemd" "desktop-systemd | systemd, desktop profile, might have blockers"
"nomultilib-openrc" "nomultilib-openrc | Minimal OpenRC base without 32bits support (Experimental)" "desktop-openrc" "desktop-openrc | OpenRC, desktop profile, might have blockers"
"nomultilib-systemd" "nomultilib-systemd | Minimal systemd base without 32bits support (Experimental)" "nomultilib-systemd" "nomultilib-systemd | Untested. Might work, but not explicitly tested"
"nomultilib-systemd-mergedusr" "nomultilib-systemd-mergedusr | Minimal systemd base with merged filesystem layout and without 32bits support (Experimental)" "nomultilib-openrc" "nomultilib-openrc | Untested. Might work, but not explicitly tested"
"x32-openrc" "x32-openrc | Minimal OpenRC base without 64bits support (Experimental)" "hardened-nomultilib-openrc" "hardened-nomultilib-openrc | Untested. Might work, but not explicitly tested"
"x32-systemd" "x32-systemd | Minimal systemd base without 64bits support (Experimental)" "hardened-nomultilib-selinux-openrc" "hardened-nomultilib-selinux-openrc | Untested. Might work, but not explicitly tested"
"x32-systemd-mergedusr" "x32-systemd-mergedusr | Minimal systemd base with merged filesystem layout and without 64bits support (Experimental)" "hardened-openrc" "hardened-openrc | Untested. Might work, but not explicitly tested"
"llvm-openrc" "llvm-openrc | Minimal OpenRC base compiled with LLVM (Experimental)" "hardened-selinux-openrc" "hardened-selinux-openrc | Untested. Might work, but not explicitly tested"
"llvm-systemd" "llvm-systemd | Minimal systemd base compiled with LLVM (Experimental)"
"llvm-systemd-mergedusr" "llvm-systemd-mergedusr | Minimal systemd base with merged filesystem layout compiled with LLVM (Experimental)"
"hardened-openrc" "hardened-openrc | Hardened OpenRC base (Experimental)"
"hardened-nomultilib-openrc" "hardened-nomultilib-openrc | Hardened OpenRC base without 32bits support (Experimental)"
"hardened-selinux-openrc" "hardened-selinux-openrc | Hardened OpenRC base with SELinux (Experimental)"
"hardened-nomultilib-selinux-openrc" "hardened-nomultilib-selinux-openrc | Hardened OpenRC base with SELinux and without 32bits support (Experimental)"
"musl" "musl-openrc | Minimal OpenRC base using musl (Experimental)"
"musl-llvm" "musl-llvm-openrc | Minimal OpenRC base using musl compiled with LLVM (Experimental)"
"musl-hardened" "musl-hardened-openrc | Hardened OpenRC base using musl (Experimental)"
) )
ALL_PARTITIONING_SCHEMES=( ALL_PARTITIONING_SCHEMES=(
@ -209,7 +205,6 @@ ALL_PARTITIONING_SCHEMES=(
"zfs_centric" "ZFS centric (optional ZFS compression and encryption)" "zfs_centric" "ZFS centric (optional ZFS compression and encryption)"
"btrfs_centric" "Btrfs centric (optional raid0/1 via btrfs)" "btrfs_centric" "Btrfs centric (optional raid0/1 via btrfs)"
"raid0_luks" "Raid0 (N>=2 disks) and luks for root" "raid0_luks" "Raid0 (N>=2 disks) and luks for root"
"raid1_luks" "Raid1 (N>=2 disks) and luks for root"
"custom" "Custom (expert option; edit the config manually later)" "custom" "Custom (expert option; edit the config manually later)"
) )
@ -284,28 +279,13 @@ function create_existing_partitions_layout() {
function create_raid0_luks_layout() { function create_raid0_luks_layout() {
PARTITIONING_SCHEME="raid0_luks" PARTITIONING_SCHEME="raid0_luks"
local known_arguments=('+swap' '?type' '?luks' '?root_fs') local known_arguments=('+swap' '?type' '?root_fs')
local extra_arguments=() local extra_arguments=()
declare -A arguments; parse_arguments "$@" declare -A arguments; parse_arguments "$@"
PARTITIONING_DEVICES=("${extra_arguments[@]}") PARTITIONING_DEVICES=("${extra_arguments[@]}")
parse_swap "${arguments[swap]}" parse_swap "${arguments[swap]}"
PARTITIONING_BOOT_TYPE="${arguments[type]}" PARTITIONING_BOOT_TYPE="${arguments[type]}"
PARTITIONING_USE_LUKS="${arguments[luks]:-true}"
PARTITIONING_ROOT_FS="${arguments[root_fs]:-ext4}"
}
function create_raid1_luks_layout() {
PARTITIONING_SCHEME="raid1_luks"
local known_arguments=('+swap' '?type' '?luks' '?root_fs')
local extra_arguments=()
declare -A arguments; parse_arguments "$@"
PARTITIONING_DEVICES=("${extra_arguments[@]}")
parse_swap "${arguments[swap]}"
PARTITIONING_BOOT_TYPE="${arguments[type]}"
PARTITIONING_USE_LUKS="${arguments[luks]:-true}"
PARTITIONING_ROOT_FS="${arguments[root_fs]:-ext4}" PARTITIONING_ROOT_FS="${arguments[root_fs]:-ext4}"
} }
@ -349,7 +329,7 @@ function create_btrfs_centric_layout() {
get_all_keymaps get_all_keymaps
get_all_timezones get_all_timezones
readarray -t SUPPORTED_LOCALES < "$GENTOO_INSTALL_REPO_DIR/contrib/i18n_supported" readarray -t SUPPORTED_LOCALES < "$(get_supported_locales)"
readarray -t LOCALE_A < <(locale -a) readarray -t LOCALE_A < <(locale -a)
@ -399,7 +379,7 @@ function load_config() {
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$1" || die "Could not load given configuration." source "$1" || die "Could not load given configuration."
# After loading a config, no unsaved changes exist. # After loading a config no unsaved changes exist.
UNSAVED_CHANGES=false UNSAVED_CHANGES=false
} }
@ -409,7 +389,7 @@ function load_default_config() {
KEYMAP="$(get_default_keymap)" KEYMAP="$(get_default_keymap)"
KEYMAP_INITRAMFS="$KEYMAP" KEYMAP_INITRAMFS="$KEYMAP"
LOCALES="C.UTF-8 UTF-8" LOCALES="C.UTF-8 UTF-8"
LOCALE="C.UTF-8" LOCALE="C.utf8"
SYSTEMD_NETWORKD=true SYSTEMD_NETWORKD=true
SYSTEMD_NETWORKD_INTERFACE_NAME="en*" SYSTEMD_NETWORKD_INTERFACE_NAME="en*"
@ -437,9 +417,7 @@ function load_default_config() {
ADDITIONAL_PACKAGES=() ADDITIONAL_PACKAGES=()
ENABLE_SSHD=true ENABLE_SSHD=true
ENABLE_BINPKG=false
ROOT_SSH_AUTHORIZED_KEYS="" ROOT_SSH_AUTHORIZED_KEYS=""
# All settings are unsaved. # All settings are unsaved.
UNSAVED_CHANGES=true UNSAVED_CHANGES=true
@ -896,7 +874,6 @@ MENU_ITEMS=(
"SELECT_MIRRORS_LARGE_FILE" "SELECT_MIRRORS_LARGE_FILE"
"--------" "--------"
"ENABLE_SSHD" "ENABLE_SSHD"
"ENABLE_BINPKG"
"ROOT_SSH_AUTHORIZED_KEYS" "ROOT_SSH_AUTHORIZED_KEYS"
"ADDITIONAL_PACKAGES" "ADDITIONAL_PACKAGES"
) )
@ -924,8 +901,7 @@ function PARTITIONING_SCHEME_menu() {
"existing_partitions") create_existing_partitions_layout boot=/dev/sdA swap=false type="$DEFAULT_BOOT_TYPE" /dev/sdX ;; "existing_partitions") create_existing_partitions_layout boot=/dev/sdA swap=false type="$DEFAULT_BOOT_TYPE" /dev/sdX ;;
"zfs_centric") create_zfs_centric_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" encrypt=true compress=zstd pool_type=standard /dev/sdX ;; "zfs_centric") create_zfs_centric_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" encrypt=true compress=zstd pool_type=standard /dev/sdX ;;
"btrfs_centric") create_btrfs_centric_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" raid_type=raid0 luks=false /dev/sdX ;; "btrfs_centric") create_btrfs_centric_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" raid_type=raid0 luks=false /dev/sdX ;;
"raid0_luks") create_raid0_luks_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" luks=true root_fs=ext4 /dev/sdX /dev/sdY ;; "raid0_luks") create_raid0_luks_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" root_fs=ext4 /dev/sdX /dev/sdY ;;
"raid1_luks") create_raid1_luks_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" luks=true root_fs=ext4 /dev/sdX /dev/sdY ;;
"custom") PARTITIONING_SCHEME="$dialog_out" ;; "custom") PARTITIONING_SCHEME="$dialog_out" ;;
esac esac
UNSAVED_CHANGES=true UNSAVED_CHANGES=true
@ -942,7 +918,7 @@ function PARTITIONING_BOOT_TYPE_help() { echo "Select whether to use EFI or BIO
function PARTITIONING_BOOT_TYPE_menu() { function PARTITIONING_BOOT_TYPE_menu() {
if menu_radiolist_labeled \ if menu_radiolist_labeled \
"Select boot type" \ "Select boot type" \
"Select whether you want to use EFI or BIOS boot.$(on_off_str "$HAS_EFI_SUPPORT" "" " \Z1$EFI_UNSUPPORTED_MESSAGE\Zn")" \ "Select whether your want to use EFI or BIOS boot.$(on_off_str "$HAS_EFI_SUPPORT" "" " \Z1$EFI_UNSUPPORTED_MESSAGE\Zn")" \
"$PARTITIONING_BOOT_TYPE" \ "$PARTITIONING_BOOT_TYPE" \
"${PARTITIONING_BOOT_TYPES[@]}" "${PARTITIONING_BOOT_TYPES[@]}"
then then
@ -1033,7 +1009,7 @@ function PARTITIONING_SWAP_DEVICE_menu() {
function PARTITIONING_ROOT_FS_tag() { echo " ├ Root filesystem"; } function PARTITIONING_ROOT_FS_tag() { echo " ├ Root filesystem"; }
function PARTITIONING_ROOT_FS_label() { echo " ├ ($PARTITIONING_ROOT_FS)"; } function PARTITIONING_ROOT_FS_label() { echo " ├ ($PARTITIONING_ROOT_FS)"; }
function PARTITIONING_ROOT_FS_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "classic_single_disk" "raid0_luks" "raid1_luks"; } function PARTITIONING_ROOT_FS_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "classic_single_disk" "raid0_luks"; }
function PARTITIONING_ROOT_FS_help() { echo "Select the amount of swap to use."; } function PARTITIONING_ROOT_FS_help() { echo "Select the amount of swap to use."; }
function PARTITIONING_ROOT_FS_menu() { function PARTITIONING_ROOT_FS_menu() {
if menu_radiolist \ if menu_radiolist \
@ -1173,7 +1149,7 @@ function PARTITIONING_DEVICES_label() {
if [[ "$invalid" -gt 0 ]]; then if [[ "$invalid" -gt 0 ]]; then
echo " └ (${#PARTITIONING_DEVICES[@]} devices, \Z1$invalid invalid\Zn)" echo " └ (${#PARTITIONING_DEVICES[@]} devices, \Z1$invalid invalid\Zn)"
elif [[ "${#PARTITIONING_DEVICES[@]}" -eq 1 && ("$PARTITIONING_SCHEME" == "raid0_luks" || "$PARTITIONING_SCHEME" == "raid1_luks") ]]; then elif [[ "${#PARTITIONING_DEVICES[@]}" -eq 1 && "$PARTITIONING_SCHEME" == "raid0_luks" ]]; then
echo " └ (${#PARTITIONING_DEVICES[@]} devices, \Z1need at least 2\Zn)" echo " └ (${#PARTITIONING_DEVICES[@]} devices, \Z1need at least 2\Zn)"
elif [[ "${#PARTITIONING_DEVICES[@]}" -eq 0 ]]; then elif [[ "${#PARTITIONING_DEVICES[@]}" -eq 0 ]]; then
echo " └ (${#PARTITIONING_DEVICES[@]} devices, \Z1need at least 1\Zn)" echo " └ (${#PARTITIONING_DEVICES[@]} devices, \Z1need at least 1\Zn)"
@ -1181,7 +1157,7 @@ function PARTITIONING_DEVICES_label() {
echo " └ (${#PARTITIONING_DEVICES[@]} devices)" echo " └ (${#PARTITIONING_DEVICES[@]} devices)"
fi fi
} }
function PARTITIONING_DEVICES_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "raid0_luks" "raid1_luks" "zfs_centric" "btrfs_centric"; } function PARTITIONING_DEVICES_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "raid0_luks" "zfs_centric" "btrfs_centric"; }
function PARTITIONING_DEVICES_help() { echo "The block devices to which the layout will be applied."; } function PARTITIONING_DEVICES_help() { echo "The block devices to which the layout will be applied."; }
function PARTITIONING_DEVICES_menu() { function PARTITIONING_DEVICES_menu() {
local invalid=() local invalid=()
@ -1289,7 +1265,7 @@ function KEYMAP_INITRAMFS_menu() {
function LOCALES_tag() { echo "Locales"; } function LOCALES_tag() { echo "Locales"; }
function LOCALES_label() { echo "$N_LOCALES selected"; } function LOCALES_label() { echo "$N_LOCALES selected"; }
function LOCALES_show() { return 0; } function LOCALES_show() { return 0; }
function LOCALES_help() { echo "The locales to generate for the new system. Be careful that the syntax for locales is a different from the resulting name of the generated locales of locale-gen. For example, the locale 'en_US.utf8' is enabled via 'en_US.UTF-8 UTF-8')."; } function LOCALES_help() { echo "The locales to generate for the new system. Be careful that the syntax for locales is a different from the resulting name of the genereated locales of locale-gen. For example the locale 'en_US.utf8' is enabled via 'en_US.UTF-8 UTF-8')."; }
function LOCALES_menu() { function LOCALES_menu() {
if menu_splitlist "Select locales" "Select which locales to generate." "$SELECTED_LOCALES" "${SUPPORTED_LOCALES[@]}"; then if menu_splitlist "Select locales" "Select which locales to generate." "$SELECTED_LOCALES" "${SUPPORTED_LOCALES[@]}"; then
SELECTED_LOCALES="$dialog_out" SELECTED_LOCALES="$dialog_out"
@ -1393,11 +1369,11 @@ function SYSTEMD_NETWORKD_GATEWAY_menu() {
function STAGE3_VARIANT_tag() { echo "Stage3 variant & Init system"; } function STAGE3_VARIANT_tag() { echo "Stage3 variant & Init system"; }
function STAGE3_VARIANT_label() { echo "($STAGE3_VARIANT)"; } function STAGE3_VARIANT_label() { echo "($STAGE3_VARIANT)"; }
function STAGE3_VARIANT_show() { return 0; } function STAGE3_VARIANT_show() { return 0; }
function STAGE3_VARIANT_help() { echo "Select which stage3 tarball to use. Implicitly determines whether systemd or OpenRC is used. Not all stage3 variants have been tested with this installer. The basic installation process is always the same, but due to complex profiles, unexpected blockers may arise when emerge is called. Stick to the basic choices and change after bootstrapping, unless you know how to intervene while installing."; } function STAGE3_VARIANT_help() { echo "Select which stage3 tarball to use. Implicitly determines whether systemd or OpenRC is used. Not all stage3 variants have been tested with this installer. The basic installation process is always the same, but due to complex profiles, unexpected blockers may arise when emerge is called. Stick to the basic choices and change after bootstraping, unless you know how to invervene while installing."; }
function STAGE3_VARIANT_menu() { function STAGE3_VARIANT_menu() {
if menu_radiolist_labeled \ if menu_radiolist_labeled \
"Select stage3 variant" \ "Select stage3 variant" \
"Select the base stage3 tarball variant to use for bootstrapping the system. Implicitly determines whether systemd or OpenRC is used. Not all stage3 variants have been tested with this installer. The basic installation process is always the same, but due to complex profiles, unexpected blockers may arise when emerge is called. Stick to the basic choices and change after bootstrapping, unless you know how to intervene while installing." \ "Select the base stage3 tarball variant to use for bootstrapping the system. Implicitly determines whether systemd or OpenRC is used. Not all stage3 variants have been tested with this installer. The basic installation process is always the same, but due to complex profiles, unexpected blockers may arise when emerge is called. Stick to the basic choices and change after bootstraping, unless you know how to invervene while installing." \
"$STAGE3_VARIANT" \ "$STAGE3_VARIANT" \
"${ALL_STAGE3_VARIANTS[@]}" "${ALL_STAGE3_VARIANTS[@]}"
then then
@ -1520,15 +1496,6 @@ function ENABLE_SSHD_menu() {
UNSAVED_CHANGES=true UNSAVED_CHANGES=true
} }
function ENABLE_BINPKG_tag() { echo "Enable binary packages"; }
function ENABLE_BINPKG_label() { on_off_label "$ENABLE_BINPKG"; }
function ENABLE_BINPKG_show() { return 0; }
function ENABLE_BINPKG_help() { echo "Use binary packages if available."; }
function ENABLE_BINPKG_menu() {
on_off_toggle "ENABLE_BINPKG"
UNSAVED_CHANGES=true
}
function ROOT_SSH_AUTHORIZED_KEYS_tag() { echo "Authorized keys (root)"; } function ROOT_SSH_AUTHORIZED_KEYS_tag() { echo "Authorized keys (root)"; }
function ROOT_SSH_AUTHORIZED_KEYS_label() { echo "$(sed '/^\s*#/d;/^\s*$/d' <<< "$ROOT_SSH_AUTHORIZED_KEYS" | wc -l) keys"; } function ROOT_SSH_AUTHORIZED_KEYS_label() { echo "$(sed '/^\s*#/d;/^\s*$/d' <<< "$ROOT_SSH_AUTHORIZED_KEYS" | wc -l) keys"; }
function ROOT_SSH_AUTHORIZED_KEYS_show() { return 0; } function ROOT_SSH_AUTHORIZED_KEYS_show() { return 0; }
@ -1625,7 +1592,6 @@ USE_PORTAGE_TESTING=${USE_PORTAGE_TESTING@Q}
SELECT_MIRRORS=${SELECT_MIRRORS@Q} SELECT_MIRRORS=${SELECT_MIRRORS@Q}
SELECT_MIRRORS_LARGE_FILE=${SELECT_MIRRORS_LARGE_FILE@Q} SELECT_MIRRORS_LARGE_FILE=${SELECT_MIRRORS_LARGE_FILE@Q}
SYSTEMD=\$([[ \$STAGE3_VARIANT == *systemd* ]] && echo "true" || echo "false") SYSTEMD=\$([[ \$STAGE3_VARIANT == *systemd* ]] && echo "true" || echo "false")
MUSL=\$([[ \$STAGE3_VARIANT == *musl* ]] && echo "true" || echo "false")
################################################ ################################################
@ -1633,7 +1599,6 @@ MUSL=\$([[ \$STAGE3_VARIANT == *musl* ]] && echo "true" || echo "false")
ADDITIONAL_PACKAGES=(${ADDITIONAL_PACKAGES[@]@Q}) ADDITIONAL_PACKAGES=(${ADDITIONAL_PACKAGES[@]@Q})
ENABLE_SSHD=${ENABLE_SSHD@Q} ENABLE_SSHD=${ENABLE_SSHD@Q}
ENABLE_BINPKG=${ENABLE_BINPKG@Q}
ROOT_SSH_AUTHORIZED_KEYS=${ROOT_SSH_AUTHORIZED_KEYS@Q} ROOT_SSH_AUTHORIZED_KEYS=${ROOT_SSH_AUTHORIZED_KEYS@Q}

View File

@ -1,3 +1,4 @@
C.UTF-8 UTF-8
aa_DJ.UTF-8 UTF-8 aa_DJ.UTF-8 UTF-8
aa_DJ ISO-8859-1 aa_DJ ISO-8859-1
aa_ER UTF-8 aa_ER UTF-8
@ -76,7 +77,6 @@ brx_IN UTF-8
bs_BA.UTF-8 UTF-8 bs_BA.UTF-8 UTF-8
bs_BA ISO-8859-2 bs_BA ISO-8859-2
byn_ER UTF-8 byn_ER UTF-8
C.UTF-8 UTF-8
ca_AD.UTF-8 UTF-8 ca_AD.UTF-8 UTF-8
ca_AD ISO-8859-15 ca_AD ISO-8859-15
ca_ES.UTF-8 UTF-8 ca_ES.UTF-8 UTF-8

View File

@ -35,10 +35,10 @@ function disk_configuration() {
# #
# Parameters: # Parameters:
# swap=<size> Create a swap partition with given size, or no swap # swap=<size> Create a swap partition with given size, or no swap
# at all if set to false. # at all if set to false
# type=[efi|bios] Selects the boot type. Defaults to efi if not given. # type=[efi|bios] Selects the boot type. Defaults to efi if not given.
# luks=[true|false] Encrypt root partition. Defaults to false if not given. # luks=[true|false] Encrypt root partition. Defaults to false if not given.
# root_fs=[ext4|btrfs] Root filesystem. Defaults to ext4 if not given. # root_fs=[ext4|btrfs] Root filesystem
#create_classic_single_disk_layout swap=8GiB type=efi luks=true root_fs=ext4 /dev/sdX #create_classic_single_disk_layout swap=8GiB type=efi luks=true root_fs=ext4 /dev/sdX
# 2. create_btrfs_centric_layout # 2. create_btrfs_centric_layout
@ -52,7 +52,7 @@ function disk_configuration() {
# #
# Parameters: # Parameters:
# swap=<size> Create a swap partition with given size, or no swap # swap=<size> Create a swap partition with given size, or no swap
# at all if set to false. # at all if set to false
# type=[efi|bios] Selects the boot type. Defaults to efi if not given. # type=[efi|bios] Selects the boot type. Defaults to efi if not given.
# encrypt=[true|false] Encrypt the zfs datasets. Defaults to false if not given. # encrypt=[true|false] Encrypt the zfs datasets. Defaults to false if not given.
# compress=[false|<compression>] Compress the zfs datasets. For valid values visit man zfsprops. Defaults to false if not given. # compress=[false|<compression>] Compress the zfs datasets. For valid values visit man zfsprops. Defaults to false if not given.
@ -68,30 +68,13 @@ function disk_configuration() {
# #
# Parameters: # Parameters:
# swap=<size> Create a swap partition with given size for each disk, # swap=<size> Create a swap partition with given size for each disk,
# or no swap at all if set to false. # or no swap at all if set to false
# type=[efi|bios] Selects the boot type. Defaults to efi if not given. # type=[efi|bios] Selects the boot type. Defaults to efi if not given.
# luks=[true|false] Encrypt root partition. Defaults to true if not given. # root_fs=[ext4|btrfs] Root filesystem
# root_fs=[ext4|btrfs] Root filesystem. Defaults to ext4 if not given.
# Careful: You will get N times the swap amount, so be sure to divide beforehand. # Careful: You will get N times the swap amount, so be sure to divide beforehand.
#create_raid0_luks_layout swap=4GiB type=efi root_fs=ext4 /dev/sd{X,Y} #create_raid0_luks_layout swap=4GiB type=efi root_fs=ext4 /dev/sd{X,Y}
# 4. create_raid1_luks_layout # 4. create_btrfs_centric_layout
#
# This layout creates the single disk layout on multiple disks and combines
# the swap and root partitions in separate raid1 arrays. Useful if you e.g. have
# several nvme drives and want data redundancy. Only one boot partition will actually
# be used though.
#
# Parameters:
# swap=<size> Create a swap partition with given size for each disk,
# or no swap at all if set to false.
# type=[efi|bios] Selects the boot type. Defaults to efi if not given.
# luks=[true|false] Encrypt root partition. Defaults to true if not given.
# root_fs=[ext4|btrfs] Root filesystem. Defaults to ext4 if not given.
# Careful: You will get N times the swap amount, so be sure to divide beforehand.
#create_raid1_luks_layout swap=4GiB type=efi root_fs=ext4 /dev/sd{X,Y}
# 5. create_btrfs_centric_layout
# #
# This layout is the same as the single_disk_layout, but uses btrfs as the root # This layout is the same as the single_disk_layout, but uses btrfs as the root
# filesystem and allows you to put additional disks into the btrfs device pool. # filesystem and allows you to put additional disks into the btrfs device pool.
@ -102,7 +85,7 @@ function disk_configuration() {
# #
# Parameters: # Parameters:
# swap=<size> Create a swap partition with given size, or no swap # swap=<size> Create a swap partition with given size, or no swap
# at all if set to false. # at all if set to false
# type=[efi|bios] Selects the boot type. Defaults to efi if not given. # type=[efi|bios] Selects the boot type. Defaults to efi if not given.
# luks=[true|false] Encrypt root partition and btrfs devices. Defaults # luks=[true|false] Encrypt root partition and btrfs devices. Defaults
# to false if not given. # to false if not given.
@ -188,7 +171,8 @@ function disk_configuration() {
HOSTNAME="gentoo" HOSTNAME="gentoo"
# The timezone for the new system # The timezone for the new system
TIMEZONE="Atlantic/Azores" TIMEZONE="Europe/London"
#TIMEZONE="Europe/Berlin"
# The default keymap for the system # The default keymap for the system
KEYMAP="us" KEYMAP="us"
@ -199,28 +183,27 @@ KEYMAP_INITRAMFS="$KEYMAP"
# A list of additional locales to generate. You should only # A list of additional locales to generate. You should only
# add locales here if you really need them and want to localize # add locales here if you really need them and want to localize
# your system. Otherwise, leave this list empty, and use "C.UTF-8" as the locale. # your system. Otherwise, leave this list empty, and use "C.utf8" as the locale.
# Be careful that the syntax for locales is a bit different from the name of the resulting # Be careful that the syntax for locales is a bit different from the name of the resulting
# locale. For a list of supported locales, see the file /usr/share/i18n/SUPPORTED. # locale. For a list of supported locales, see the file /usr/share/i18n/SUPPORTED.
LOCALES="" LOCALES=""
# The locale to set for the system. Be careful, the locale names deviate from the LOCALES # The locale to set for the system. Be careful, the locale names deviate from the LOCALES
# list entries (e.g. .UTF-8 vs .utf8). See `locale -a` for all available locales. # list entries (e.g. .UTF-8 vs .utf8). See `locale -a` for all available locales.
# Although `locale -a` lists the suffix in lower case without any hyphens, it is best to always use UTF-8 in preference to utf8. LOCALE="C.utf8"
LOCALE="C.UTF-8" # For a german system you could use:
# For a PT system you could use:
# LOCALES=" # LOCALES="
# pt_PT.UTF-8 UTF-8 # de_DE.UTF-8 UTF-8
# pt_PT ISO-8859-1 # de_DE ISO-8859-1
# pt_PT@euro ISO-8859-15 # de_DE@euro ISO-8859-15
# " # End of LOCALES # " # End of LOCALES
# LOCALE="pt_PT.UTF-8" # LOCALE="de_DE.utf8"
################################################ ################################################
# Network configuration # Network configuration
# The following network configuration only applies to systemd # The following network configuration only applies to systemd
# configurations and will otherwise be ignored. All OpenRC based # configurations and will otherwise be ignore. All openrc based
# configurations always just starts dhcpcd. # configurations always just starts dhcpcd.
# Enable systemd-networkd to configure internet # Enable systemd-networkd to configure internet
@ -258,21 +241,19 @@ GENTOO_MIRROR="https://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo
GENTOO_ARCH="amd64" GENTOO_ARCH="amd64"
# The stage3 tarball variant to use. Determines whether systemd # The stage3 tarball variant to use. Determines whether systemd
# or OpenRC is used based on whether "systemd" is contained in this string. # or openrc is used based on whether "systemd" is contained in this string.
STAGE3_VARIANT="systemd" STAGE3_VARIANT="systemd"
# The stage3 tarball to download and bootstrap # The stage3 tarball to download and bootstrap
STAGE3_BASENAME="stage3-$GENTOO_ARCH-$STAGE3_VARIANT" STAGE3_BASENAME="stage3-$GENTOO_ARCH-$STAGE3_VARIANT"
# Automatically set to true, if the stage3 tarball is based on systemd. In this case # Automatically set to true, if the stage3 tarball is based on systemd. In this case
# we need to use slightly different utilities to setup the base system. # we need to use slightly different utilities to setup the base system.
SYSTEMD=$([[ $STAGE3_VARIANT == *systemd* ]] && echo "true" || echo "false") SYSTEMD=$([[ $STAGE3_VARIANT == *systemd* ]] && echo "true" || echo "false")
# Automatically set to true, if the stage3 tarball is based on musl.
MUSL=$([[ $STAGE3_VARIANT == *musl* ]] && echo "true" || echo "false")
# If set to true, the installer will add ACCEPT_KEYWORDS="~$GENTOO_ARCH" # If set to true, the installer will add ACCEPT_KEYWORDS="~$GENTOO_ARCH"
# to /etc/portage/make.conf to enable packages in testing. # to /etc/portage/make.conf to enable packages in testing.
USE_PORTAGE_TESTING=true USE_PORTAGE_TESTING=true
# If set to true, the best gentoo mirrors will be selected # If set to true, the best best gentoo mirrors will be selected
# automatically by app-portage/mirrorselect # automatically by app-portage/mirrorselect
SELECT_MIRRORS=true SELECT_MIRRORS=true
@ -293,9 +274,6 @@ ADDITIONAL_PACKAGES=()
# only allows the use of ed25519 keys, and requires pubkey authentication) # only allows the use of ed25519 keys, and requires pubkey authentication)
ENABLE_SSHD=true ENABLE_SSHD=true
# Enable binary portage packages where available
ENABLE_BINPKG=false
# An ssh key to add to the authorized_keys file for the root user. # An ssh key to add to the authorized_keys file for the root user.
# This variable will become the content of the authorized_keys file, # This variable will become the content of the authorized_keys file,
# so you may specify one key per line (include the newlines in the variable). # so you may specify one key per line (include the newlines in the variable).
@ -308,76 +286,3 @@ ROOT_SSH_AUTHORIZED_KEYS=""
# To prove that you have read and edited the config # To prove that you have read and edited the config
# properly, set the following value to true. # properly, set the following value to true.
I_HAVE_READ_AND_EDITED_THE_CONFIG_PROPERLY=false I_HAVE_READ_AND_EDITED_THE_CONFIG_PROPERLY=false
################################################
# Hooks
# before_prepare_environment() {
# einfo 'before prepare environment'
# }
# after_prepare_environment() {
# einfo 'after prepare environment'
# }
# before_disk_configuration() {
# einfo 'before disk configuration'
# }
# after_disk_configuration() {
# einfo 'after disk configuration'
# }
# before_download_stage3() {
# einfo "stage3 basename: $1"
# einfo 'before download stage3'
# }
# after_download_stage3() {
# einfo "stage3 downloaded file name: $1"
# einfo 'after download stage3'
# }
# before_extract_stage3() {
# einfo "stage3 downloaded file path: $1"
# einfo "root mountpoint: $1"
# einfo 'before extract stage3'
# }
# after_extract_stage3() {
# einfo "stage3 downloaded file path: $1"
# einfo "root mountpoint: $1"
# einfo 'after extract stage3'
# }
# before_install() {
# einfo 'before install'
# }
# after_install() {
# einfo 'after install'
# }
# before_configure_base_system() {
# einfo 'before configure base system'
# }
# after_configure_base_system() {
# einfo 'after configure base system'
# }
# before_configure_portage() {
# einfo 'before configure portage'
# }
# after_configure_portage() {
# einfo 'after configure portage'
# }
# before_install_kernel() {
# einfo 'before install kernel'
# }
# after_install_kernel() {
# einfo 'after install kernel'
# }

View File

@ -104,7 +104,7 @@ if [[ -z "$ACTION" ]]; then
# Default if configuration exists: Run installer # Default if configuration exists: Run installer
ACTION="install" ACTION="install"
else else
# Default if configuration does not exist: Run configurator, and exit afterwards. # Default if configuration does not exists: Run configurator, and exit afterwards.
echo "You have not created a gentoo.conf. Starting configurator instead of installing." echo "You have not created a gentoo.conf. Starting configurator instead of installing."
exec "$GENTOO_INSTALL_REPO_DIR/configure" "$CONFIG" exec "$GENTOO_INSTALL_REPO_DIR/configure" "$CONFIG"
fi fi

View File

@ -293,10 +293,10 @@ function expand_ids() {
# Single disk, 3 partitions (efi, swap, root) # Single disk, 3 partitions (efi, swap, root)
# Parameters: # Parameters:
# swap=<size> Create a swap partition with given size, or no swap at all if set to false. # swap=<size> Create a swap partition with given size, or no swap at all if set to false
# type=[efi|bios] Selects the boot type. Defaults to efi if not given. # type=[efi|bios] Selects the boot type. Defaults to efi if not given.
# luks=[true|false] Encrypt root partition. Defaults to false if not given. # luks=[true|false] Encrypt root partition. Defaults to false if not given.
# root_fs=[ext4|btrfs] Root filesystem. Defaults to ext4 if not given. # root_fs=[ext4|btrfs] Root filesystem
function create_classic_single_disk_layout() { function create_classic_single_disk_layout() {
local known_arguments=('+swap' '?type' '?luks' '?root_fs') local known_arguments=('+swap' '?type' '?luks' '?root_fs')
local extra_arguments=() local extra_arguments=()
@ -311,7 +311,7 @@ function create_classic_single_disk_layout() {
local root_fs="${arguments[root_fs]:-ext4}" local root_fs="${arguments[root_fs]:-ext4}"
create_gpt new_id=gpt device="$device" create_gpt new_id=gpt device="$device"
create_partition new_id="part_$type" id=gpt size=1GiB type="$type" create_partition new_id="part_$type" id=gpt size=512MiB type="$type"
[[ $size_swap != "false" ]] \ [[ $size_swap != "false" ]] \
&& create_partition new_id=part_swap id=gpt size="$size_swap" type=swap && create_partition new_id=part_swap id=gpt size="$size_swap" type=swap
create_partition new_id=part_root id=gpt size=remaining type=linux create_partition new_id=part_root id=gpt size=remaining type=linux
@ -353,7 +353,7 @@ function create_single_disk_layout() {
# Skip partitioning, and use existing pre-formatted partitions. These must be trivially mountable. # Skip partitioning, and use existing pre-formatted partitions. These must be trivially mountable.
# Parameters: # Parameters:
# swap=<device|false> Use the given device as swap, or no swap at all if set to false. # swap=<device|false> Use the given device as swap, or no swap at all if set to false
# boot=<device> Use the given device as the bios/efi partition. # boot=<device> Use the given device as the bios/efi partition.
# type=[efi|bios] Selects the boot type. Defaults to efi if not given. # type=[efi|bios] Selects the boot type. Defaults to efi if not given.
function create_existing_partitions_layout() { function create_existing_partitions_layout() {
@ -389,7 +389,7 @@ function create_existing_partitions_layout() {
# Multiple disks, up to 3 partitions on first disk (efi, optional swap, root with zfs). # Multiple disks, up to 3 partitions on first disk (efi, optional swap, root with zfs).
# Additional devices will be added to the zfs pool. # Additional devices will be added to the zfs pool.
# Parameters: # Parameters:
# swap=<size> Create a swap partition with given size, or no swap at all if set to false. # swap=<size> Create a swap partition with given size, or no swap at all if set to false
# type=[efi|bios] Selects the boot type. Defaults to efi if not given. # type=[efi|bios] Selects the boot type. Defaults to efi if not given.
# encrypt=[true|false] Encrypt zfs pool. Defaults to false if not given. # encrypt=[true|false] Encrypt zfs pool. Defaults to false if not given.
# pool_type=[stripe|mirror] Select raid type. Defaults to stripe. # pool_type=[stripe|mirror] Select raid type. Defaults to stripe.
@ -408,7 +408,7 @@ function create_zfs_centric_layout() {
# Create layout on first disk # Create layout on first disk
create_gpt new_id="gpt_dev0" device="${extra_arguments[0]}" create_gpt new_id="gpt_dev0" device="${extra_arguments[0]}"
create_partition new_id="part_${type}_dev0" id="gpt_dev0" size=1GiB type="$type" create_partition new_id="part_${type}_dev0" id="gpt_dev0" size=512MiB type="$type"
[[ $size_swap != "false" ]] \ [[ $size_swap != "false" ]] \
&& create_partition new_id="part_swap_dev0" id="gpt_dev0" size="$size_swap" type=swap && create_partition new_id="part_swap_dev0" id="gpt_dev0" size="$size_swap" type=swap
create_partition new_id="part_root_dev0" id="gpt_dev0" size=remaining type=linux create_partition new_id="part_root_dev0" id="gpt_dev0" size=remaining type=linux
@ -444,12 +444,11 @@ function create_zfs_centric_layout() {
# - swap: raid 0 → fs # - swap: raid 0 → fs
# - root: raid 0 → luks → fs # - root: raid 0 → luks → fs
# Parameters: # Parameters:
# swap=<size> Create a swap partition with given size for each disk, or no swap at all if set to false. # swap=<size> Create a swap partition with given size for each disk, or no swap at all if set to false
# type=[efi|bios] Selects the boot type. Defaults to efi if not given. # type=[efi|bios] Selects the boot type. Defaults to efi if not given.
# luks=[true|false] Encrypt root partition. Defaults to true if not given. # root_fs=[ext4|btrfs] Root filesystem
# root_fs=[ext4|btrfs] Root filesystem. Defaults to ext4 if not given.
function create_raid0_luks_layout() { function create_raid0_luks_layout() {
local known_arguments=('+swap' '?type' '?luks' '?root_fs') local known_arguments=('+swap' '?type' '?root_fs')
local extra_arguments=() local extra_arguments=()
declare -A arguments; parse_arguments "$@" declare -A arguments; parse_arguments "$@"
@ -457,12 +456,11 @@ function create_raid0_luks_layout() {
|| die_trace 1 "Expected at least one positional argument (the devices)" || die_trace 1 "Expected at least one positional argument (the devices)"
local size_swap="${arguments[swap]}" local size_swap="${arguments[swap]}"
local type="${arguments[type]:-efi}" local type="${arguments[type]:-efi}"
local use_luks="${arguments[luks]:-true}"
local root_fs="${arguments[root_fs]:-ext4}" local root_fs="${arguments[root_fs]:-ext4}"
for i in "${!extra_arguments[@]}"; do for i in "${!extra_arguments[@]}"; do
create_gpt new_id="gpt_dev${i}" device="${extra_arguments[$i]}" create_gpt new_id="gpt_dev${i}" device="${extra_arguments[$i]}"
create_partition new_id="part_${type}_dev${i}" id="gpt_dev${i}" size=1GiB type="$type" create_partition new_id="part_${type}_dev${i}" id="gpt_dev${i}" size=512MiB type="$type"
[[ $size_swap != "false" ]] \ [[ $size_swap != "false" ]] \
&& create_partition new_id="part_swap_dev${i}" id="gpt_dev${i}" size="$size_swap" type=raid && create_partition new_id="part_swap_dev${i}" id="gpt_dev${i}" size="$size_swap" type=raid
create_partition new_id="part_root_dev${i}" id="gpt_dev${i}" size=remaining type=raid create_partition new_id="part_root_dev${i}" id="gpt_dev${i}" size=remaining type=raid
@ -471,17 +469,12 @@ function create_raid0_luks_layout() {
[[ $size_swap != "false" ]] \ [[ $size_swap != "false" ]] \
&& create_raid new_id=part_raid_swap name="swap" level=0 ids="$(expand_ids '^part_swap_dev[[:digit:]]$')" && create_raid new_id=part_raid_swap name="swap" level=0 ids="$(expand_ids '^part_swap_dev[[:digit:]]$')"
create_raid new_id=part_raid_root name="root" level=0 ids="$(expand_ids '^part_root_dev[[:digit:]]$')" create_raid new_id=part_raid_root name="root" level=0 ids="$(expand_ids '^part_root_dev[[:digit:]]$')"
create_luks new_id=part_luks_root name="root" id=part_raid_root
local root_id="part_raid_root"
if [[ "$use_luks" == "true" ]]; then
create_luks new_id=part_luks_root name="root" id=part_raid_root
root_id="part_luks_root"
fi
format id="part_${type}_dev0" type="$type" label="$type" format id="part_${type}_dev0" type="$type" label="$type"
[[ $size_swap != "false" ]] \ [[ $size_swap != "false" ]] \
&& format id=part_raid_swap type=swap label=swap && format id=part_raid_swap type=swap label=swap
format id="$root_id" type="$root_fs" label=root format id=part_luks_root type="$root_fs" label=root
if [[ $type == "efi" ]]; then if [[ $type == "efi" ]]; then
DISK_ID_EFI="part_${type}_dev0" DISK_ID_EFI="part_${type}_dev0"
@ -490,76 +483,12 @@ function create_raid0_luks_layout() {
fi fi
[[ $size_swap != "false" ]] \ [[ $size_swap != "false" ]] \
&& DISK_ID_SWAP=part_raid_swap && DISK_ID_SWAP=part_raid_swap
DISK_ID_ROOT="$root_id" DISK_ID_ROOT=part_luks_root
if [[ $root_fs == "btrfs" ]]; then if [[ $root_fs == "btrfs" ]]; then
DISK_ID_ROOT_TYPE="btrfs" DISK_ID_ROOT_TYPE="btrfs"
DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,compress=zstd,subvol=/root" DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,compress=zstd,subvol=/root"
elif [[ $root_fs == "ext4" ]]; then elif [[ $root_fs == "btrfs" ]]; then
DISK_ID_ROOT_TYPE="ext4"
DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,errors=remount-ro,discard"
else
die "Unsupported root filesystem type"
fi
}
# Multiple disks, with raid 1 and luks
# - efi: partition on all disks, but only first disk used
# - swap: raid 1 → fs
# - root: raid 1 → luks → fs
# Parameters:
# swap=<size> Create a swap partition with given size for each disk, or no swap at all if set to false.
# type=[efi|bios] Selects the boot type. Defaults to efi if not given.
# luks=[true|false] Encrypt root partition. Defaults to true if not given.
# root_fs=[ext4|btrfs] Root filesystem. Defaults to ext4 if not given.
function create_raid1_luks_layout() {
local known_arguments=('+swap' '?type' '?luks' '?root_fs')
local extra_arguments=()
declare -A arguments; parse_arguments "$@"
[[ ${#extra_arguments[@]} -gt 0 ]] \
|| die_trace 1 "Expected at least one positional argument (the devices)"
local size_swap="${arguments[swap]}"
local type="${arguments[type]:-efi}"
local use_luks="${arguments[luks]:-true}"
local root_fs="${arguments[root_fs]:-ext4}"
for i in "${!extra_arguments[@]}"; do
create_gpt new_id="gpt_dev${i}" device="${extra_arguments[$i]}"
create_partition new_id="part_${type}_dev${i}" id="gpt_dev${i}" size=1GiB type="$type"
[[ $size_swap != "false" ]] \
&& create_partition new_id="part_swap_dev${i}" id="gpt_dev${i}" size="$size_swap" type=raid
create_partition new_id="part_root_dev${i}" id="gpt_dev${i}" size=remaining type=raid
done
[[ $size_swap != "false" ]] \
&& create_raid new_id=part_raid_swap name="swap" level=1 ids="$(expand_ids '^part_swap_dev[[:digit:]]$')"
create_raid new_id=part_raid_root name="root" level=1 ids="$(expand_ids '^part_root_dev[[:digit:]]$')"
local root_id="part_raid_root"
if [[ "$use_luks" == "true" ]]; then
create_luks new_id=part_luks_root name="root" id=part_raid_root
root_id="part_luks_root"
fi
format id="part_${type}_dev0" type="$type" label="$type"
[[ $size_swap != "false" ]] \
&& format id=part_raid_swap type=swap label=swap
format id="$root_id" type="$root_fs" label=root
if [[ $type == "efi" ]]; then
DISK_ID_EFI="part_${type}_dev0"
else
DISK_ID_BIOS="part_${type}_dev0"
fi
[[ $size_swap != "false" ]] \
&& DISK_ID_SWAP=part_raid_swap
DISK_ID_ROOT="$root_id"
if [[ $root_fs == "btrfs" ]]; then
DISK_ID_ROOT_TYPE="btrfs"
DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,compress=zstd,subvol=/root"
elif [[ $root_fs == "ext4" ]]; then
DISK_ID_ROOT_TYPE="ext4" DISK_ID_ROOT_TYPE="ext4"
DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,errors=remount-ro,discard" DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,errors=remount-ro,discard"
else else
@ -570,7 +499,7 @@ function create_raid1_luks_layout() {
# Multiple disks, up to 3 partitions on first disk (efi, optional swap, root with btrfs). # Multiple disks, up to 3 partitions on first disk (efi, optional swap, root with btrfs).
# Additional devices will be first encrypted and then put directly into btrfs array. # Additional devices will be first encrypted and then put directly into btrfs array.
# Parameters: # Parameters:
# swap=<size> Create a swap partition with given size, or no swap at all if set to false. # swap=<size> Create a swap partition with given size, or no swap at all if set to false
# type=[efi|bios] Selects the boot type. Defaults to efi if not given. # type=[efi|bios] Selects the boot type. Defaults to efi if not given.
# luks=[true|false] Encrypt root partition and btrfs devices. Defaults to false if not given. # luks=[true|false] Encrypt root partition and btrfs devices. Defaults to false if not given.
# raid_type=[raid0|raid1] Select raid type. Defaults to raid0. # raid_type=[raid0|raid1] Select raid type. Defaults to raid0.
@ -589,7 +518,7 @@ function create_btrfs_centric_layout() {
# Create layout on first disk # Create layout on first disk
create_gpt new_id="gpt_dev0" device="${extra_arguments[0]}" create_gpt new_id="gpt_dev0" device="${extra_arguments[0]}"
create_partition new_id="part_${type}_dev0" id="gpt_dev0" size=1GiB type="$type" create_partition new_id="part_${type}_dev0" id="gpt_dev0" size=512MiB type="$type"
[[ $size_swap != "false" ]] \ [[ $size_swap != "false" ]] \
&& create_partition new_id="part_swap_dev0" id="gpt_dev0" size="$size_swap" type=swap && create_partition new_id="part_swap_dev0" id="gpt_dev0" size="$size_swap" type=swap
create_partition new_id="part_root_dev0" id="gpt_dev0" size=remaining type=linux create_partition new_id="part_root_dev0" id="gpt_dev0" size=remaining type=linux

View File

@ -64,8 +64,6 @@ function preprocess_config() {
} }
function prepare_installation_environment() { function prepare_installation_environment() {
maybe_exec 'before_prepare_environment'
einfo "Preparing installation environment" einfo "Preparing installation environment"
local wanted_programs=( local wanted_programs=(
@ -96,8 +94,6 @@ function prepare_installation_environment() {
# Sync time now to prevent issues later # Sync time now to prevent issues later
sync_time sync_time
maybe_exec 'after_prepare_environment'
} }
function check_encryption_key() { function check_encryption_key() {
@ -243,18 +239,6 @@ function disk_create_partition() {
sgdisk -n "0:0:$arg_size" -t "0:$type" -u "0:$partuuid" $extra_args "$device" >/dev/null \ sgdisk -n "0:0:$arg_size" -t "0:$type" -u "0:$partuuid" $extra_args "$device" >/dev/null \
|| die "Could not create new gpt partition ($new_id) on '$device' ($id)" || die "Could not create new gpt partition ($new_id) on '$device' ($id)"
partprobe "$device" partprobe "$device"
# On some system, we need to wait a bit for the partition to show up.
local new_device
new_device="$(resolve_device_by_id "$new_id")" \
|| die "Could not resolve new device with id=$new_id"
for i in {1..10}; do
[[ -e "$new_device" ]] && break
[[ "$i" -eq 1 ]] && printf "Waiting for partition (%s) to appear..." "$new_device"
printf " %s" "$((10 - i + 1))"
sleep 1
[[ "$i" -eq 10 ]] && echo
done
} }
function disk_create_raid() { function disk_create_raid() {
@ -291,19 +275,12 @@ function disk_create_raid() {
local mddevice="/dev/md/$name" local mddevice="/dev/md/$name"
local uuid="${DISK_ID_TO_UUID[$new_id]}" local uuid="${DISK_ID_TO_UUID[$new_id]}"
extra_args=()
if [[ ${level} == 1 ]]; then
extra_args+=("--metadata=1.0")
else
extra_args+=("--metadata=1.2")
fi
einfo "Creating raid$level ($new_id) on $devices_desc" einfo "Creating raid$level ($new_id) on $devices_desc"
mdadm \ mdadm \
--create "$mddevice" \ --create "$mddevice" \
--verbose \ --verbose \
--homehost="$HOSTNAME" \ --homehost="$HOSTNAME" \
"${extra_args[@]}" \ --metadata=1.2 \
--raid-devices="${#devices[@]}" \ --raid-devices="${#devices[@]}" \
--uuid="$uuid" \ --uuid="$uuid" \
--level="$level" \ --level="$level" \
@ -422,9 +399,6 @@ function disk_format() {
mkswap "$device" \ mkswap "$device" \
|| die "Could not format device '$device' ($id)" || die "Could not format device '$device' ($id)"
fi fi
# Try to swapoff in case the system enabled swap automatically
swapoff "$device" &>/dev/null
;; ;;
'ext4') 'ext4')
if [[ -v "arguments[label]" ]]; then if [[ -v "arguments[label]" ]]; then
@ -746,8 +720,6 @@ function apply_disk_configuration() {
|| die "Aborted" || die "Aborted"
countdown "Applying in " 5 countdown "Applying in " 5
maybe_exec 'before_disk_configuration'
einfo "Applying disk configuration" einfo "Applying disk configuration"
apply_disk_actions apply_disk_actions
@ -755,8 +727,6 @@ function apply_disk_configuration() {
elog "New lsblk output:" elog "New lsblk output:"
for_line_in <(lsblk \ for_line_in <(lsblk \
|| die "Error in lsblk") elog || die "Error in lsblk") elog
maybe_exec 'after_disk_configuration'
} }
function mount_efivars() { function mount_efivars() {
@ -818,7 +788,7 @@ function download_stage3() {
cd "$TMP_DIR" \ cd "$TMP_DIR" \
|| die "Could not cd into '$TMP_DIR'" || die "Could not cd into '$TMP_DIR'"
local STAGE3_RELEASES="$GENTOO_MIRROR/releases/$GENTOO_ARCH/autobuilds/current-$STAGE3_BASENAME/" local STAGE3_RELEASES="$GENTOO_MIRROR/releases/amd64/autobuilds/current-$STAGE3_BASENAME/"
# Download upstream list of files # Download upstream list of files
CURRENT_STAGE3="$(download_stdout "$STAGE3_RELEASES")" \ CURRENT_STAGE3="$(download_stdout "$STAGE3_RELEASES")" \
@ -834,8 +804,6 @@ function download_stage3() {
# File to indiciate successful verification # File to indiciate successful verification
CURRENT_STAGE3_VERIFIED="${CURRENT_STAGE3}.verified" CURRENT_STAGE3_VERIFIED="${CURRENT_STAGE3}.verified"
maybe_exec 'before_download_stage3' "$STAGE3_BASENAME"
# Download file if not already downloaded # Download file if not already downloaded
if [[ -e $CURRENT_STAGE3_VERIFIED ]]; then if [[ -e $CURRENT_STAGE3_VERIFIED ]]; then
einfo "$STAGE3_BASENAME tarball already downloaded and verified" einfo "$STAGE3_BASENAME tarball already downloaded and verified"
@ -872,8 +840,6 @@ function download_stage3() {
# Create verification file in case the script is restarted # Create verification file in case the script is restarted
touch_or_die 0644 "$CURRENT_STAGE3_VERIFIED" touch_or_die 0644 "$CURRENT_STAGE3_VERIFIED"
fi fi
maybe_exec 'after_download_stage3' "${CURRENT_STAGE3}"
} }
function extract_stage3() { function extract_stage3() {
@ -884,8 +850,6 @@ function extract_stage3() {
[[ -e "$TMP_DIR/$CURRENT_STAGE3" ]] \ [[ -e "$TMP_DIR/$CURRENT_STAGE3" ]] \
|| die "stage3 file does not exist" || die "stage3 file does not exist"
maybe_exec 'before_extract_stage3' "$TMP_DIR/$CURRENT_STAGE3" "$ROOT_MOUNTPOINT"
# Go to root directory # Go to root directory
cd "$ROOT_MOUNTPOINT" \ cd "$ROOT_MOUNTPOINT" \
|| die "Could not move to '$ROOT_MOUNTPOINT'" || die "Could not move to '$ROOT_MOUNTPOINT'"
@ -900,8 +864,6 @@ function extract_stage3() {
|| die "Error while extracting tarball" || die "Error while extracting tarball"
cd "$TMP_DIR" \ cd "$TMP_DIR" \
|| die "Could not cd into '$TMP_DIR'" || die "Could not cd into '$TMP_DIR'"
maybe_exec 'after_extract_stage3' "$TMP_DIR/$CURRENT_STAGE3" "$ROOT_MOUNTPOINT"
} }
function gentoo_umount() { function gentoo_umount() {

View File

@ -13,19 +13,11 @@ function install_stage3() {
} }
function configure_base_system() { function configure_base_system() {
if [[ $MUSL == "true" ]]; then einfo "Generating locales"
einfo "Installing musl-locales" echo "$LOCALES" > /etc/locale.gen \
if [[ $USE_PORTAGE_TESTING == "false" ]]; then || die "Could not write /etc/locale.gen"
echo "sys-apps/musl-locales" >> /etc/portage/package.accept_keywords/musl-locales locale-gen \
fi || die "Could not generate locales"
try emerge --verbose sys-apps/musl-locales
else
einfo "Generating locales"
echo "$LOCALES" > /etc/locale.gen \
|| die "Could not write /etc/locale.gen"
locale-gen \
|| die "Could not generate locales"
fi
if [[ $SYSTEMD == "true" ]]; then if [[ $SYSTEMD == "true" ]]; then
einfo "Setting machine-id" einfo "Setting machine-id"
@ -57,19 +49,10 @@ function configure_base_system() {
|| die "Could not sed replace in /etc/conf.d/hostname" || die "Could not sed replace in /etc/conf.d/hostname"
# Set timezone # Set timezone
if [[ $MUSL == "true" ]]; then einfo "Selecting timezone"
try emerge -v sys-libs/timezone-data echo "$TIMEZONE" > /etc/timezone \
einfo "Selecting timezone" || die "Could not write /etc/timezone"
echo -e "\nTZ=\"$TIMEZONE\"" >> /etc/env.d/00musl \ try emerge -v --config sys-libs/timezone-data
|| die "Could not write to /etc/env.d/00musl"
else
einfo "Selecting timezone"
echo "$TIMEZONE" > /etc/timezone \
|| die "Could not write /etc/timezone"
chmod 644 /etc/timezone \
|| die "Could not set correct permissions for /etc/timezone"
try emerge -v --config sys-libs/timezone-data
fi
# Set keymap # Set keymap
einfo "Selecting keymap" einfo "Selecting keymap"
@ -91,7 +74,6 @@ function configure_portage() {
touch_or_die 0644 "/etc/portage/package.use/zz-autounmask" touch_or_die 0644 "/etc/portage/package.use/zz-autounmask"
mkdir_or_die 0755 "/etc/portage/package.keywords" mkdir_or_die 0755 "/etc/portage/package.keywords"
touch_or_die 0644 "/etc/portage/package.keywords/zz-autounmask" touch_or_die 0644 "/etc/portage/package.keywords/zz-autounmask"
touch_or_die 0644 "/etc/portage/package.license"
if [[ $SELECT_MIRRORS == "true" ]]; then if [[ $SELECT_MIRRORS == "true" ]]; then
einfo "Temporarily installing mirrorselect" einfo "Temporarily installing mirrorselect"
@ -104,12 +86,6 @@ function configure_portage() {
try mirrorselect "${mirrorselect_params[@]}" try mirrorselect "${mirrorselect_params[@]}"
fi fi
if [[ $ENABLE_BINPKG == "true" ]]; then
echo 'FEATURES="getbinpkg"' >> /etc/portage/make.conf
getuto
chmod 644 /etc/portage/gnupg/pubring.kbx
fi
chmod 644 /etc/portage/make.conf \ chmod 644 /etc/portage/make.conf \
|| die "Could not chmod 644 /etc/portage/make.conf" || die "Could not chmod 644 /etc/portage/make.conf"
} }
@ -184,7 +160,7 @@ function generate_initramfs() {
cat > "$(dirname "$output")/generate_initramfs.sh" <<EOF cat > "$(dirname "$output")/generate_initramfs.sh" <<EOF
#!/bin/bash #!/bin/bash
kver="\$1" kver="\$1"
output="\$2" # At setup time, this was "$output" output="\$2"
[[ -n "\$kver" ]] || { echo "usage \$0 <kernel_version> <output>" >&2; exit 1; } [[ -n "\$kver" ]] || { echo "usage \$0 <kernel_version> <output>" >&2; exit 1; }
dracut \\ dracut \\
--kver "\$kver" \\ --kver "\$kver" \\
@ -194,7 +170,7 @@ dracut \\
--add "bash ${modules[*]}" \\ --add "bash ${modules[*]}" \\
${dracut_opts[@]@Q} \\ ${dracut_opts[@]@Q} \\
--force \\ --force \\
"\$output" "$output"
EOF EOF
} }
@ -214,10 +190,11 @@ function install_kernel_efi() {
# Copy kernel to EFI # Copy kernel to EFI
local kernel_file local kernel_file
kernel_file="$(find "/boot" \( -name "vmlinuz-*" -or -name 'kernel-*' \) -printf '%f\n' | sort -V | tail -n 1)" \ kernel_file="$(find "/boot" -name "vmlinuz-*" -printf '%f\n' | sort -V | tail -n 1)" \
|| die "Could not list newest kernel file" || die "Could not list newest kernel file"
try cp "/boot/$kernel_file" "/boot/efi/vmlinuz.efi" cp "/boot/$kernel_file" "/boot/efi/vmlinuz.efi" \
|| die "Could not copy kernel to EFI partition"
# Generate initramfs # Generate initramfs
generate_initramfs "/boot/efi/initramfs.img" generate_initramfs "/boot/efi/initramfs.img"
@ -229,26 +206,15 @@ function install_kernel_efi() {
|| die "Could not resolve device with id=$DISK_ID_EFI" || die "Could not resolve device with id=$DISK_ID_EFI"
efipartdev="$(realpath "$efipartdev")" \ efipartdev="$(realpath "$efipartdev")" \
|| die "Error in realpath '$efipartdev'" || die "Error in realpath '$efipartdev'"
local sys_efipart local efipartnum="${efipartdev: -1}"
sys_efipart="/sys/class/block/$(basename "$efipartdev")" \
|| die "Could not construct /sys path to efi partition"
local efipartnum
efipartnum="$(cat "$sys_efipart/partition")" \
|| die "Failed to find partition number for EFI partition $efipartdev"
local gptdev local gptdev
gptdev="/dev/$(basename "$(readlink -f "$sys_efipart/..")")" \ gptdev="$(resolve_device_by_id "${DISK_ID_PART_TO_GPT_ID[$DISK_ID_EFI]}")" \
|| die "Failed to find parent device for EFI partition $efipartdev" || die "Could not resolve device with id=${DISK_ID_PART_TO_GPT_ID[$DISK_ID_EFI]}"
if [[ ! -e "$gptdev" ]] || [[ -z "$gptdev" ]]; then
gptdev="$(resolve_device_by_id "${DISK_ID_PART_TO_GPT_ID[$DISK_ID_EFI]}")" \
|| die "Could not resolve device with id=${DISK_ID_PART_TO_GPT_ID[$DISK_ID_EFI]}"
fi
try efibootmgr --verbose --create --disk "$gptdev" --part "$efipartnum" --label "gentoo" --loader '\vmlinuz.efi' --unicode 'initrd=\initramfs.img'" $(get_cmdline)" try efibootmgr --verbose --create --disk "$gptdev" --part "$efipartnum" --label "gentoo" --loader '\vmlinuz.efi' --unicode 'initrd=\initramfs.img'" $(get_cmdline)"
# Create script to repeat adding efibootmgr entry # Create script to repeat adding efibootmgr entry
cat > "/boot/efi/efibootmgr_add_entry.sh" <<EOF cat > "/boot/efi/efibootmgr_add_entry.sh" <<EOF
#!/bin/bash #!/bin/bash
# This is the command that was used to create the efibootmgr entry when the
# system was installed using gentoo-install.
efibootmgr --verbose --create --disk "$gptdev" --part "$efipartnum" --label "gentoo" --loader '\\vmlinuz.efi' --unicode 'initrd=\\initramfs.img'" $(get_cmdline)" efibootmgr --verbose --create --disk "$gptdev" --part "$efipartnum" --label "gentoo" --loader '\\vmlinuz.efi' --unicode 'initrd=\\initramfs.img'" $(get_cmdline)"
EOF EOF
} }
@ -270,10 +236,11 @@ function install_kernel_bios() {
# Link kernel to known name # Link kernel to known name
local kernel_file local kernel_file
kernel_file="$(find "/boot" \( -name "vmlinuz-*" -or -name 'kernel-*' \) -printf '%f\n' | sort -V | tail -n 1)" \ kernel_file="$(find "/boot" -name "vmlinuz-*" -printf '%f\n' | sort -V | tail -n 1)" \
|| die "Could not list newest kernel file" || die "Could not list newest kernel file"
try cp "/boot/$kernel_file" "/boot/bios/vmlinuz-current" cp "/boot/$kernel_file" "/boot/bios/vmlinuz-current" \
|| die "Could copy kernel to /boot/bios/vmlinuz-current"
# Generate initramfs # Generate initramfs
generate_initramfs "/boot/bios/initramfs.img" generate_initramfs "/boot/bios/initramfs.img"
@ -307,11 +274,6 @@ function install_kernel() {
else else
install_kernel_bios install_kernel_bios
fi fi
einfo "Installing linux-firmware"
echo "sys-kernel/linux-firmware linux-fw-redistributable no-source-code" >> /etc/portage/package.license \
|| die "Could not write to /etc/portage/package.license"
try emerge --verbose linux-firmware
} }
function add_fstab_entry() { function add_fstab_entry() {
@ -339,8 +301,6 @@ function generate_fstab() {
function main_install_gentoo_in_chroot() { function main_install_gentoo_in_chroot() {
[[ $# == 0 ]] || die "Too many arguments" [[ $# == 0 ]] || die "Too many arguments"
maybe_exec 'before_install'
# Remove the root password, making the account accessible for automated # Remove the root password, making the account accessible for automated
# tasks during the period of installation. # tasks during the period of installation.
einfo "Clearing root password" einfo "Clearing root password"
@ -363,12 +323,9 @@ function main_install_gentoo_in_chroot() {
try emerge-webrsync try emerge-webrsync
# Configure basic system things like timezone, locale, ... # Configure basic system things like timezone, locale, ...
maybe_exec 'before_configure_base_system'
configure_base_system configure_base_system
maybe_exec 'after_configure_base_system'
# Prepare portage environment # Prepare portage environment
maybe_exec 'before_configure_portage'
configure_portage configure_portage
# Install git (for git portage overlays) # Install git (for git portage overlays)
@ -396,7 +353,6 @@ EOF
|| die "Could not delete obsolete rsync gentoo repository" || die "Could not delete obsolete rsync gentoo repository"
try emerge --sync try emerge --sync
fi fi
maybe_exec 'after_configure_portage'
einfo "Generating ssh host keys" einfo "Generating ssh host keys"
try ssh-keygen -A try ssh-keygen -A
@ -404,11 +360,7 @@ EOF
# Install authorized_keys before dracut, which might need them for remote unlocking. # Install authorized_keys before dracut, which might need them for remote unlocking.
install_authorized_keys install_authorized_keys
einfo "Enabling dracut USE flag on sys-kernel/installkernel" # Install required programs and kernel now, in oder to
echo "sys-kernel/installkernel dracut" > /etc/portage/package.use/installkernel \
|| die "Could not write /etc/portage/package.use/installkernel"
# Install required programs and kernel now, in order to
# prevent emerging module before an imminent kernel upgrade # prevent emerging module before an imminent kernel upgrade
try emerge --verbose sys-kernel/dracut sys-kernel/gentoo-kernel-bin app-arch/zstd try emerge --verbose sys-kernel/dracut sys-kernel/gentoo-kernel-bin app-arch/zstd
@ -424,22 +376,12 @@ EOF
try emerge --verbose sys-fs/cryptsetup try emerge --verbose sys-fs/cryptsetup
fi fi
if [[ $SYSTEMD == "true" && $USED_LUKS == "true" ]] ; then
einfo "Enabling cryptsetup USE flag on sys-apps/systemd"
echo "sys-apps/systemd cryptsetup" > /etc/portage/package.use/systemd \
|| die "Could not write /etc/portage/package.use/systemd"
einfo "Rebuilding systemd with changed USE flag"
try emerge --verbose --changed-use --oneshot sys-apps/systemd
fi
# Install btrfs-progs if we used btrfs # Install btrfs-progs if we used btrfs
if [[ $USED_BTRFS == "true" ]]; then if [[ $USED_BTRFS == "true" ]]; then
einfo "Installing btrfs-progs" einfo "Installing btrfs-progs"
try emerge --verbose sys-fs/btrfs-progs try emerge --verbose sys-fs/btrfs-progs
fi fi
try emerge --verbose dev-vcs/git
# Install zfs kernel module and tools if we used zfs # Install zfs kernel module and tools if we used zfs
if [[ $USED_ZFS == "true" ]]; then if [[ $USED_ZFS == "true" ]]; then
einfo "Installing zfs" einfo "Installing zfs"
@ -458,9 +400,7 @@ EOF
fi fi
# Install kernel and initramfs # Install kernel and initramfs
maybe_exec 'before_install_kernel'
install_kernel install_kernel
maybe_exec 'after_install_kernel'
# Generate a valid fstab file # Generate a valid fstab file
generate_fstab generate_fstab
@ -526,13 +466,10 @@ EOF
|| die "Could not modify /etc/portage/make.conf" || die "Could not modify /etc/portage/make.conf"
fi fi
maybe_exec 'after_install'
einfo "Gentoo installation complete." einfo "Gentoo installation complete."
[[ $USED_LUKS == "true" ]] \ [[ $USED_LUKS == "true" ]] \
&& einfo "A backup of your luks headers can be found at '$LUKS_HEADER_BACKUP_DIR', in case you want to have a backup." && einfo "A backup of your luks headers can be found at '$LUKS_HEADER_BACKUP_DIR', in case you want to have a backup."
einfo "You may now reboot your system or execute ./install --chroot $ROOT_MOUNTPOINT to enter your system in a chroot." einfo "You may now reboot your system."
einfo "Chrooting in this way is always possible in case you need to fix something after rebooting."
} }
function main_install() { function main_install() {

View File

@ -377,9 +377,7 @@ function check_wanted_programs() {
local checkfile local checkfile
for tuple in "$@"; do for tuple in "$@"; do
program="${tuple%%=*}" program="${tuple%%=*}"
checkfile="" checkfile="${tuple##*=}"
[[ "$tuple" == *=* ]] \
&& checkfile="${tuple##*=}"
if ! has_program "${program#"?"}" "$checkfile"; then if ! has_program "${program#"?"}" "$checkfile"; then
if [[ "$program" == "?"* ]]; then if [[ "$program" == "?"* ]]; then
missing_wanted+=("${program#"?"}") missing_wanted+=("${program#"?"}")
@ -417,8 +415,8 @@ function check_wanted_programs() {
&& need_zfs=true && need_zfs=true
if [[ -v "pacman_packages[$program]" ]]; then if [[ -v "pacman_packages[$program]" ]]; then
# Assignments to the empty string are explicitly ignored, # Assignments to the empty string are explcitly ignored,
# as for example, zfs needs to be handled separately. # as for example zfs needs to be handeled separately.
[[ -n "${pacman_packages[$program]}" ]] \ [[ -n "${pacman_packages[$program]}" ]] \
&& packages+=("${pacman_packages[$program]}") && packages+=("${pacman_packages[$program]}")
else else
@ -429,9 +427,9 @@ function check_wanted_programs() {
if [[ "$need_zfs" == true ]]; then if [[ "$need_zfs" == true ]]; then
elog "On an Arch live-stick you need the archzfs repository and some tools and modifications to use zfs." elog "On an Arch live-stick you need the archzfs repository and some tools and modifications to use zfs."
elog "There is an automated installer available at https://raw.githubusercontent.com/eoli3n/archiso-zfs/master/init." elog "There is an automated installer available at https://eoli3n.github.io/archzfs/init."
if ask "Do you want to automatically download and execute this zfs installation script?"; then if ask "Do you want to automatically download and execute this zfs installation script?"; then
curl -s "https://raw.githubusercontent.com/eoli3n/archiso-zfs/master/init" | bash curl -s "https://eoli3n.github.io/archzfs/init" | bash
fi fi
fi fi
@ -445,9 +443,3 @@ function check_wanted_programs() {
ask "Continue without recommended programs?" ask "Continue without recommended programs?"
fi fi
} }
# exec function if defined
# $@ function name and arguments
function maybe_exec() {
type "$1" &>/dev/null && "$@"
}