Compare commits

..

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

9 changed files with 165 additions and 659 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. It provides transparent block-level compression,
It provides transparent block-level compression, instant snapshots and full-disk encryption. instant snapshots and full-disk encryption. Generally encrypting your root fs doesn't cost you
Generally, encrypting your root fs doesn't cost you anything and protects your data in case you lose your device. 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
@ -191,20 +185,6 @@ or [Discord](https://discord.com/invite/gentoolinux).
If you experience any issues after rebooting and need to fix something inside the chroot, If you experience any issues after rebooting and need to fix something inside the chroot,
you can use the installer to chroot into an existing system. Run `./install --help` for more infos. you can use the installer to chroot into an existing system. Run `./install --help` for more infos.
#### 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.
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.
# This opens an emergency shell in the chroot.
echo 'ACCEPT_KEYWORDS="~amd64"' >> /etc/portage/make.conf # Enable testing for your architecture.
emerge -v gentoo-kernel-bin # Update kernel to newest version
exit # Ctrl-D
# Now select 'retry' when asked about what to do next.
```
#### Q: I get errors after partitioning about blkid not being able to find a UUID #### Q: I get errors after partitioning about blkid not being able to find a UUID
**A:** Be sure that all devices are unmounted and not in use before starting the script. **A:** Be sure that all devices are unmounted and not in use before starting the script.

234
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 | OpenRC, desktop profile, might have blockers"
"nomultilib-openrc" "nomultilib-openrc | Minimal OpenRC base without 32bits support (Experimental)" "desktop-openrc" "desktop-openrc | systemd, 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,14 +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_INTERFACE_NAME="en*"
SYSTEMD_NETWORKD_DHCP=true
SYSTEMD_NETWORKD_ADDRESSES=("192.168.1.100/32" "fd00::1/64")
SYSTEMD_NETWORKD_GATEWAY="192.168.1.1"
SYSTEMD_INITRAMFS_SSHD=false
function disk_configuration() { function disk_configuration() {
#create_zfs_centric_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" encrypt=true compress=zstd pool_type=standard /dev/sdX #create_zfs_centric_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" encrypt=true compress=zstd pool_type=standard /dev/sdX
@ -436,10 +409,8 @@ function load_default_config() {
SELECT_MIRRORS_LARGE_FILE=false SELECT_MIRRORS_LARGE_FILE=false
ADDITIONAL_PACKAGES=() ADDITIONAL_PACKAGES=()
ENABLE_SSHD=true INSTALL_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
@ -496,12 +467,6 @@ function on_off_label() {
on_off_str "$1" "${prefix}[*]" "${prefix}[ ]" on_off_str "$1" "${prefix}[*]" "${prefix}[ ]"
} }
function on_off_label_inverted() {
local var=$1
shift
on_off_label "$(is_on "$var" && echo false || echo true)" "$@"
}
function is_on() { function is_on() {
[[ "$1" == true ]] [[ "$1" == true ]]
} }
@ -878,12 +843,6 @@ MENU_ITEMS=(
"KEYMAP_INITRAMFS" "KEYMAP_INITRAMFS"
"LOCALES" "LOCALES"
"LOCALE" "LOCALE"
"SYSTEMD_NETWORKD"
"SYSTEMD_INITRAMFS_SSHD"
"SYSTEMD_NETWORKD_INTERFACE_NAME"
"SYSTEMD_NETWORKD_DHCP"
"SYSTEMD_NETWORKD_ADDRESSES"
"SYSTEMD_NETWORKD_GATEWAY"
"--------" "--------"
"STAGE3_VARIANT" "STAGE3_VARIANT"
"PORTAGE_SYNC_TYPE" "PORTAGE_SYNC_TYPE"
@ -895,8 +854,7 @@ MENU_ITEMS=(
"SELECT_MIRRORS" "SELECT_MIRRORS"
"SELECT_MIRRORS_LARGE_FILE" "SELECT_MIRRORS_LARGE_FILE"
"--------" "--------"
"ENABLE_SSHD" "INSTALL_SSHD"
"ENABLE_BINPKG"
"ROOT_SSH_AUTHORIZED_KEYS" "ROOT_SSH_AUTHORIZED_KEYS"
"ADDITIONAL_PACKAGES" "ADDITIONAL_PACKAGES"
) )
@ -924,8 +882,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 +899,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
@ -997,8 +954,7 @@ function PARTITIONING_SWAP_menu() {
dialog \ dialog \
--title "Select swap amount" \ --title "Select swap amount" \
--inputbox "Enter the amount of swap for the new system. Use the correct suffix (e.g. 16GiB, 1000MB)." \ --inputbox "Enter the amount of swap for the new system. Use the correct suffix (e.g. 16GiB, 1000MB)." \
"${INPUTBOX_SIZE[@]}" "$PARTITIONING_SWAP" \ "${INPUTBOX_SIZE[@]}" "$PARTITIONING_SWAP"
|| return 0
PARTITIONING_SWAP="$dialog_out" PARTITIONING_SWAP="$dialog_out"
UNSAVED_CHANGES=true UNSAVED_CHANGES=true
} }
@ -1033,7 +989,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 +1129,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 +1137,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=()
@ -1198,8 +1154,7 @@ function PARTITIONING_DEVICES_menu() {
dialog \ dialog \
--title "Select devices" \ --title "Select devices" \
--inputbox "Enter the path of all devices which you want to partition, separated by space. (e.g. /dev/sda /dev/sdb).$invalid_line" \ --inputbox "Enter the path of all devices which you want to partition, separated by space. (e.g. /dev/sda /dev/sdb).$invalid_line" \
"${INPUTBOX_SIZE[@]}" "${PARTITIONING_DEVICES[*]}" \ "${INPUTBOX_SIZE[@]}" "${PARTITIONING_DEVICES[*]}"
|| return 0
read -ra PARTITIONING_DEVICES <<< "$dialog_out" read -ra PARTITIONING_DEVICES <<< "$dialog_out"
UNSAVED_CHANGES=true UNSAVED_CHANGES=true
} }
@ -1212,8 +1167,7 @@ function HOSTNAME_menu() {
dialog \ dialog \
--title "Select hostname" \ --title "Select hostname" \
--inputbox "Enter the hostname for your new system." \ --inputbox "Enter the hostname for your new system." \
"${INPUTBOX_SIZE[@]}" "$HOSTNAME" \ "${INPUTBOX_SIZE[@]}" "$HOSTNAME"
|| return 0
HOSTNAME="$dialog_out" HOSTNAME="$dialog_out"
UNSAVED_CHANGES=true UNSAVED_CHANGES=true
} }
@ -1289,7 +1243,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"
@ -1320,84 +1274,14 @@ function LOCALE_menu() {
fi fi
} }
function SYSTEMD_NETWORKD_tag() { echo "Configure network"; }
function SYSTEMD_NETWORKD_label() { on_off_label "$SYSTEMD_NETWORKD"; }
function SYSTEMD_NETWORKD_show() { [[ $STAGE3_VARIANT == *systemd* ]]; }
function SYSTEMD_NETWORKD_help() { echo "Enable systemd-network to configure networking on the new system."; }
function SYSTEMD_NETWORKD_menu() {
on_off_toggle "SYSTEMD_NETWORKD"
UNSAVED_CHANGES=true
}
function SYSTEMD_INITRAMFS_SSHD_tag() { echo " ├ Enable sshd in initramfs"; }
function SYSTEMD_INITRAMFS_SSHD_label() { on_off_label "$SYSTEMD_INITRAMFS_SSHD" " ├ "; }
function SYSTEMD_INITRAMFS_SSHD_show() { [[ $STAGE3_VARIANT == *systemd* ]] && is_on "$SYSTEMD_NETWORKD"; }
function SYSTEMD_INITRAMFS_SSHD_help() { echo "Install and enable sshd in the initramfs. This can be used to unlock encrypted partitions / ZFS via ssh, or to get an emergency shell. Visit https://github.com/gsauthof/dracut-sshd for more information."; }
function SYSTEMD_INITRAMFS_SSHD_menu() {
on_off_toggle "SYSTEMD_INITRAMFS_SSHD"
UNSAVED_CHANGES=true
}
function SYSTEMD_NETWORKD_INTERFACE_NAME_tag() { echo " ├ Interface Name"; }
function SYSTEMD_NETWORKD_INTERFACE_NAME_label() { echo " ├ ($(ellipsis 20 "$SYSTEMD_NETWORKD_INTERFACE_NAME"))"; }
function SYSTEMD_NETWORKD_INTERFACE_NAME_show() { [[ $STAGE3_VARIANT == *systemd* ]] && is_on "$SYSTEMD_NETWORKD"; }
function SYSTEMD_NETWORKD_INTERFACE_NAME_help() { echo "The network interface(s) to configure. Defaults to all interfaces matching en*."; }
function SYSTEMD_NETWORKD_INTERFACE_NAME_menu() {
dialog \
--title "Network Interface Name" \
--inputbox "Enter the network interface name which should be configured. Can include wildcards." \
"${INPUTBOX_SIZE[@]}" "$SYSTEMD_NETWORKD_INTERFACE_NAME" \
|| return 0
SYSTEMD_NETWORKD_INTERFACE_NAME="$dialog_out"
UNSAVED_CHANGES=true
}
function SYSTEMD_NETWORKD_DHCP_tag() { echo " └ Static IP"; }
function SYSTEMD_NETWORKD_DHCP_label() { on_off_label_inverted "$SYSTEMD_NETWORKD_DHCP" " └ "; }
function SYSTEMD_NETWORKD_DHCP_show() { [[ $STAGE3_VARIANT == *systemd* ]] && is_on "$SYSTEMD_NETWORKD"; }
function SYSTEMD_NETWORKD_DHCP_help() { echo "Use DHCP to obtain network configuration."; }
function SYSTEMD_NETWORKD_DHCP_menu() {
on_off_toggle "SYSTEMD_NETWORKD_DHCP"
UNSAVED_CHANGES=true
}
function SYSTEMD_NETWORKD_ADDRESSES_tag() { echo " ├ Addresses"; }
function SYSTEMD_NETWORKD_ADDRESSES_label() { echo " ├ ($(ellipsis 20 "${SYSTEMD_NETWORKD_ADDRESSES[*]}"))"; }
function SYSTEMD_NETWORKD_ADDRESSES_show() { [[ $STAGE3_VARIANT == *systemd* ]] && is_on "$SYSTEMD_NETWORKD" && is_off "$SYSTEMD_NETWORKD_DHCP"; }
function SYSTEMD_NETWORKD_ADDRESSES_help() { echo "A space-separated list of addresses with CIDR mask to assign to the network interface."; }
function SYSTEMD_NETWORKD_ADDRESSES_menu() {
dialog \
--title "Network Addresses" \
--inputbox "A space-separated list of addresses with CIDR mask to assign to the network interface." \
"${INPUTBOX_SIZE[@]}" "${SYSTEMD_NETWORKD_ADDRESSES[*]}" \
|| return 0
# shellcheck disable=SC2206
SYSTEMD_NETWORKD_ADDRESSES=($dialog_out)
UNSAVED_CHANGES=true
}
function SYSTEMD_NETWORKD_GATEWAY_tag() { echo " └ Gateway"; }
function SYSTEMD_NETWORKD_GATEWAY_label() { echo " └ ($(ellipsis 20 "$SYSTEMD_NETWORKD_GATEWAY"))"; }
function SYSTEMD_NETWORKD_GATEWAY_show() { [[ $STAGE3_VARIANT == *systemd* ]] && is_on "$SYSTEMD_NETWORKD" && is_off "$SYSTEMD_NETWORKD_DHCP"; }
function SYSTEMD_NETWORKD_GATEWAY_help() { echo "The gateway address for the network."; }
function SYSTEMD_NETWORKD_GATEWAY_menu() {
dialog \
--title "Network Gateway" \
--inputbox "The gateway address for the network." \
"${INPUTBOX_SIZE[@]}" "$SYSTEMD_NETWORKD_GATEWAY" \
|| return 0
SYSTEMD_NETWORKD_GATEWAY="$dialog_out"
UNSAVED_CHANGES=true
}
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
@ -1440,14 +1324,12 @@ function PORTAGE_GIT_FULL_HISTORY_menu() {
function PORTAGE_GIT_MIRROR_tag() { echo " └ Git mirror"; } function PORTAGE_GIT_MIRROR_tag() { echo " └ Git mirror"; }
function PORTAGE_GIT_MIRROR_label() { echo " └ ($(ellipsis 20 "$PORTAGE_GIT_MIRROR"))"; } function PORTAGE_GIT_MIRROR_label() { echo " └ ($(ellipsis 20 "$PORTAGE_GIT_MIRROR"))"; }
function PORTAGE_GIT_MIRROR_show() { one_of "$PORTAGE_SYNC_TYPE" "git"; } function PORTAGE_GIT_MIRROR_show() { one_of "$PORTAGE_SYNC_TYPE" "git"; }
function PORTAGE_GIT_MIRROR_help() { echo "The portage git mirror is the git endpoint that is used to sync the portage tree. You usually should not need to change this!"; } function PORTAGE_GIT_MIRROR_help() { echo "The portage git mirror is the git endpoint that is used to sync the portage tree."; }
function PORTAGE_GIT_MIRROR_menu() { function PORTAGE_GIT_MIRROR_menu() {
dialog \ dialog \
--title "Select portage git mirror" \ --title "Select portage git mirror" \
--inputbox "Enter the portage git mirror that should be used to sync the portage tree." \ --inputbox "Enter the portage git mirror that should be used to sync the portage tree." \
"${INPUTBOX_SIZE[@]}" "$PORTAGE_GIT_MIRROR" \ "${INPUTBOX_SIZE[@]}" "$PORTAGE_GIT_MIRROR"
|| return 0
PORTAGE_GIT_MIRROR="$dialog_out"
UNSAVED_CHANGES=true UNSAVED_CHANGES=true
} }
@ -1458,10 +1340,8 @@ function GENTOO_MIRROR_help() { echo "Enter the initial gentoo mirror that shou
function GENTOO_MIRROR_menu() { function GENTOO_MIRROR_menu() {
dialog \ dialog \
--title "Select gentoo mirror" \ --title "Select gentoo mirror" \
--inputbox "Enter the initial gentoo mirror that should be used for the system (or until mirrorselect is run). You need to enter the FULL PATH to the tree including relevant subdirectories. Leave this as it is if in doubt!" \ --inputbox "Enter the initial gentoo mirror that should be used for the installation process (until mirrorselect is run)." \
"${INPUTBOX_SIZE[@]}" "$GENTOO_MIRROR" \ "${INPUTBOX_SIZE[@]}" "$GENTOO_MIRROR"
|| return 0
GENTOO_MIRROR="$dialog_out"
UNSAVED_CHANGES=true UNSAVED_CHANGES=true
} }
@ -1511,21 +1391,12 @@ function SELECT_MIRRORS_LARGE_FILE_menu() {
UNSAVED_CHANGES=true UNSAVED_CHANGES=true
} }
function ENABLE_SSHD_tag() { echo "Enable sshd"; } function INSTALL_SSHD_tag() { echo "Install sshd"; }
function ENABLE_SSHD_label() { on_off_label "$ENABLE_SSHD"; } function INSTALL_SSHD_label() { on_off_label "$INSTALL_SSHD"; }
function ENABLE_SSHD_show() { return 0; } function INSTALL_SSHD_show() { return 0; }
function ENABLE_SSHD_help() { echo "Install and enable sshd on the new system. A reasonably secure sshd configuration will be provided. It will by default only allow ed25519 keys, restrict key exchange algorithms to a reasonable subset, disable any password based authentication, and only allow root to login."; } function INSTALL_SSHD_help() { echo "Install and enable sshd on the new system. A reasonably secure sshd configuration will be provided. It will by default only allow ed25519 keys, restrict key exchange algorithms to a reasonable subset, disable any password based authentication, and only allow root to login."; }
function ENABLE_SSHD_menu() { function INSTALL_SSHD_menu() {
on_off_toggle "ENABLE_SSHD" on_off_toggle "INSTALL_SSHD"
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 UNSAVED_CHANGES=true
} }
@ -1603,13 +1474,6 @@ KEYMAP_INITRAMFS=${KEYMAP_INITRAMFS@Q}
LOCALES=${LOCALES@Q} LOCALES=${LOCALES@Q}
LOCALE=${LOCALE@Q} LOCALE=${LOCALE@Q}
SYSTEMD_NETWORKD=${SYSTEMD_NETWORKD@Q}
SYSTEMD_NETWORKD_INTERFACE_NAME=${SYSTEMD_NETWORKD_INTERFACE_NAME@Q}
SYSTEMD_NETWORKD_DHCP=${SYSTEMD_NETWORKD_DHCP@Q}
SYSTEMD_NETWORKD_ADDRESSES=${SYSTEMD_NETWORKD_ADDRESSES@Q}
SYSTEMD_NETWORKD_GATEWAY=${SYSTEMD_NETWORKD_GATEWAY@Q}
SYSTEMD_INITRAMFS_SSHD=${SYSTEMD_INITRAMFS_SSHD@Q}
################################################ ################################################
# Gentoo configuration # Gentoo configuration
@ -1625,15 +1489,13 @@ 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")
################################################ ################################################
# Additional (optional) configuration # Additional (optional) configuration
ADDITIONAL_PACKAGES=(${ADDITIONAL_PACKAGES[@]@Q}) ADDITIONAL_PACKAGES=(${ADDITIONAL_PACKAGES[@]@Q})
ENABLE_SSHD=${ENABLE_SSHD@Q} INSTALL_SSHD=${INSTALL_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,43 +183,20 @@ 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
# The following network configuration only applies to systemd
# configurations and will otherwise be ignored. All OpenRC based
# configurations always just starts dhcpcd.
# Enable systemd-networkd to configure internet
SYSTEMD_NETWORKD=true
# The interfaces to match and configure (systemd [Match] -> Name)
SYSTEMD_NETWORKD_INTERFACE_NAME="en*"
# Whether to use DHCP (systemd [Network] -> DHCP)
SYSTEMD_NETWORKD_DHCP=true
# If DHCP is disabled, assign the given list of addresses including CIDR mask. (systemd [Network] -> Address)
SYSTEMD_NETWORKD_ADDRESSES=("192.168.1.100/32" "fd00::1/64")
# If DHCP is disabled, use the given gateway
SYSTEMD_NETWORKD_GATEWAY="192.168.1.1"
# Enable sshd in initramfs to allow unlocking encrypted devices / enter emergency shell if needed.
# Requires systemd. Visit https://github.com/gsauthof/dracut-sshd for more information.
SYSTEMD_INITRAMFS_SSHD=false
################################################ ################################################
@ -258,21 +219,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
@ -291,10 +250,7 @@ ADDITIONAL_PACKAGES=()
# Install and configure sshd (a reasonably secure config is provided, which # Install and configure sshd (a reasonably secure config is provided, which
# 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 INSTALL_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,
@ -308,76 +264,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,8 +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."
exec "$GENTOO_INSTALL_REPO_DIR/configure" "$CONFIG" exec "$GENTOO_INSTALL_REPO_DIR/configure" "$CONFIG"
fi fi
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
@ -465,6 +439,12 @@ function format_zfs_standard() {
einfo "Creating zfs pool on $devices_desc" einfo "Creating zfs pool on $devices_desc"
if [[ "$compress" != false ]]; then
extra_args+=(
"-O" "compression=$compress"
)
fi
local zfs_stdin="" local zfs_stdin=""
if [[ "$encrypt" == true ]]; then if [[ "$encrypt" == true ]]; then
extra_args+=( extra_args+=(
@ -493,10 +473,6 @@ function format_zfs_standard() {
<<< "$zfs_stdin" \ <<< "$zfs_stdin" \
|| die "Could not create zfs pool on $devices_desc" || die "Could not create zfs pool on $devices_desc"
if [[ "$compress" != false ]]; then
zfs set "compression=$compress" rpool \
|| die "Could enable compression on dataset 'rpool'"
fi
zfs create rpool/ROOT \ zfs create rpool/ROOT \
|| die "Could not create zfs dataset 'rpool/ROOT'" || die "Could not create zfs dataset 'rpool/ROOT'"
zfs create -o mountpoint=/ rpool/ROOT/default \ zfs create -o mountpoint=/ rpool/ROOT/default \
@ -746,8 +722,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 +729,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 +790,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 +806,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 +842,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 +852,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 +866,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() {
@ -964,12 +928,7 @@ function gentoo_chroot() {
einfo "Mounting virtual filesystems" einfo "Mounting virtual filesystems"
( (
mountpoint -q -- "$chroot_dir/proc" || mount -t proc /proc "$chroot_dir/proc" || exit 1 mountpoint -q -- "$chroot_dir/proc" || mount -t proc /proc "$chroot_dir/proc" || exit 1
mountpoint -q -- "$chroot_dir/run" || { mountpoint -q -- "$chroot_dir/tmp" || mount --rbind /tmp "$chroot_dir/tmp" || exit 1
mount --rbind /run "$chroot_dir/run" &&
mount --make-rslave "$chroot_dir/run"; } || exit 1
mountpoint -q -- "$chroot_dir/tmp" || {
mount --rbind /tmp "$chroot_dir/tmp" &&
mount --make-rslave "$chroot_dir/tmp"; } || exit 1
mountpoint -q -- "$chroot_dir/sys" || { mountpoint -q -- "$chroot_dir/sys" || {
mount --rbind /sys "$chroot_dir/sys" && mount --rbind /sys "$chroot_dir/sys" &&
mount --make-rslave "$chroot_dir/sys"; } || exit 1 mount --make-rslave "$chroot_dir/sys"; } || exit 1
@ -992,8 +951,10 @@ function gentoo_chroot() {
function enable_service() { function enable_service() {
if [[ $SYSTEMD == "true" ]]; then if [[ $SYSTEMD == "true" ]]; then
try systemctl enable "$1" systemctl enable "$1" \
|| die "Could not enable $1 service"
else else
try rc-update add "$1" default rc-update add "$1" default \
|| die "Could not add $1 to default services"
fi fi
} }

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,24 +86,22 @@ function configure_portage() {
try mirrorselect "${mirrorselect_params[@]}" try mirrorselect "${mirrorselect_params[@]}"
fi fi
if [[ $ENABLE_BINPKG == "true" ]]; then if [[ $USE_PORTAGE_TESTING == "true" ]]; then
echo 'FEATURES="getbinpkg"' >> /etc/portage/make.conf einfo "Adding ~$GENTOO_ARCH to ACCEPT_KEYWORDS"
getuto echo "ACCEPT_KEYWORDS=\"~$GENTOO_ARCH\"" >> /etc/portage/make.conf \
chmod 644 /etc/portage/gnupg/pubring.kbx || die "Could not modify /etc/portage/make.conf"
fi 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"
} }
function enable_sshd() { function install_sshd() {
einfo "Installing and enabling sshd" einfo "Installing sshd"
install -m0600 -o root -g root "$GENTOO_INSTALL_REPO_DIR/contrib/sshd_config" /etc/ssh/sshd_config \ install -m0600 -o root -g root "$GENTOO_INSTALL_REPO_DIR/contrib/sshd_config" /etc/ssh/sshd_config \
|| die "Could not install /etc/ssh/sshd_config" || die "Could not install /etc/ssh/sshd_config"
enable_service sshd enable_service sshd
}
function install_authorized_keys() {
mkdir_or_die 0700 "/root/" mkdir_or_die 0700 "/root/"
mkdir_or_die 0700 "/root/.ssh" mkdir_or_die 0700 "/root/.ssh"
@ -154,37 +134,25 @@ function generate_initramfs() {
|| die "Could not figure out kernel version from /usr/src/linux symlink." || die "Could not figure out kernel version from /usr/src/linux symlink."
kver="${kver#linux-}" kver="${kver#linux-}"
dracut_opts=()
if [[ $SYSTEMD == "true" && $SYSTEMD_INITRAMFS_SSHD == "true" ]]; then
cd /tmp || die "Could not change into /tmp"
try git clone https://github.com/gsauthof/dracut-sshd
try cp -r dracut-sshd/46sshd /usr/lib/dracut/modules.d
sed -e 's/^Type=notify/Type=simple/' \
-e 's@^\(ExecStart=/usr/sbin/sshd\) -D@\1 -e -D@' \
-i /usr/lib/dracut/modules.d/46sshd/sshd.service \
|| die "Could not replace sshd options in service file"
dracut_opts+=("--install" "/etc/systemd/network/20-wired.network")
modules+=("systemd-networkd")
fi
# Generate initramfs # Generate initramfs
# TODO --conf "/dev/null" \ # TODO --conf "/dev/null" \
# TODO --confdir "/dev/null" \ # TODO --confdir "/dev/null" \
try dracut \ try dracut \
--kver "$kver" \ --kver "$kver" \
--zstd \ --zstd \
--no-hostonly \ --no-hostonly \
--ro-mnt \ --ro-mnt \
--add "bash ${modules[*]}" \ --add "bash ${modules[*]}" \
"${dracut_opts[@]}" \
--force \ --force \
"$output" "$output"
# TODO --conf "/dev/null" \\
# TODO --confdir "/dev/null" \\
# Create script to repeat initramfs generation # Create script to repeat initramfs generation
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" \\
@ -192,9 +160,8 @@ dracut \\
--no-hostonly \\ --no-hostonly \\
--ro-mnt \\ --ro-mnt \\
--add "bash ${modules[*]}" \\ --add "bash ${modules[*]}" \\
${dracut_opts[@]@Q} \\
--force \\ --force \\
"\$output" "$output"
EOF EOF
} }
@ -214,10 +181,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 +197,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 +227,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"
@ -301,17 +259,13 @@ function install_kernel_bios() {
function install_kernel() { function install_kernel() {
# Install vanilla kernel # Install vanilla kernel
einfo "Installing vanilla kernel and related tools" einfo "Installing vanilla kernel and related tools"
try emerge --verbose sys-kernel/dracut sys-kernel/gentoo-kernel-bin app-arch/zstd
if [[ $IS_EFI == "true" ]]; then if [[ $IS_EFI == "true" ]]; then
install_kernel_efi install_kernel_efi
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 +293,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 +315,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,21 +345,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"
try ssh-keygen -A
# Install authorized_keys before dracut, which might need them for remote unlocking.
install_authorized_keys
einfo "Enabling dracut USE flag on sys-kernel/installkernel"
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
try emerge --verbose sys-kernel/dracut sys-kernel/gentoo-kernel-bin app-arch/zstd
# Install mdadm if we used raid (needed for uuid resolving) # Install mdadm if we used raid (needed for uuid resolving)
if [[ $USED_RAID == "true" ]]; then if [[ $USED_RAID == "true" ]]; then
@ -424,22 +358,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"
@ -447,20 +371,18 @@ EOF
einfo "Enabling zfs services" einfo "Enabling zfs services"
if [[ $SYSTEMD == "true" ]]; then if [[ $SYSTEMD == "true" ]]; then
try systemctl enable zfs.target systemctl enable zfs.target || die "Could not enable zfs.target service"
try systemctl enable zfs-import-cache systemctl enable zfs-import-cache || die "Could not enable zfs-import-cache service"
try systemctl enable zfs-mount systemctl enable zfs-mount || die "Could not enable zfs-mount service"
try systemctl enable zfs-import.target systemctl enable zfs-import.target || die "Could not enable zfs-import.target service"
else else
try rc-update add zfs-import boot rc-update add zfs-import boot || die "Could not add zfs-import to boot services"
try rc-update add zfs-mount boot rc-update add zfs-mount boot || die "Could not add zfs-mount to boot services"
fi fi
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
@ -469,27 +391,21 @@ EOF
einfo "Installing gentoolkit" einfo "Installing gentoolkit"
try emerge --verbose app-portage/gentoolkit try emerge --verbose app-portage/gentoolkit
# Install and enable sshd
if [[ $INSTALL_SSHD == "true" ]]; then
install_sshd
fi
if [[ $SYSTEMD == "true" ]]; then if [[ $SYSTEMD == "true" ]]; then
if [[ $SYSTEMD_NETWORKD == "true" ]]; then # Enable systemd networking and dhcp
# Enable systemd networking and dhcp enable_service systemd-networkd
enable_service systemd-networkd enable_service systemd-resolved
enable_service systemd-resolved echo -en "[Match]\nName=en*\n\n[Network]\nDHCP=yes" > /etc/systemd/network/20-wired-dhcp.network \
if [[ $SYSTEMD_NETWORKD_DHCP == "true" ]]; then || die "Could not write dhcp network config to '/etc/systemd/network/20-wired-dhcp.network'"
echo -en "[Match]\nName=${SYSTEMD_NETWORKD_INTERFACE_NAME}\n\n[Network]\nDHCP=yes" > /etc/systemd/network/20-wired.network \ chown root:systemd-network /etc/systemd/network/20-wired-dhcp.network \
|| die "Could not write dhcp network config to '/etc/systemd/network/20-wired.network'" || die "Could not change owner of '/etc/systemd/network/20-wired-dhcp.network'"
else chmod 640 /etc/systemd/network/20-wired-dhcp.network \
addresses="" || die "Could not change permissions of '/etc/systemd/network/20-wired-dhcp.network'"
for addr in "${SYSTEMD_NETWORKD_ADDRESSES[@]}"; do
addresses="${addresses}Address=$addr\n"
done
echo -en "[Match]\nName=${SYSTEMD_NETWORKD_INTERFACE_NAME}\n\n[Network]\n${addresses}Gateway=$SYSTEMD_NETWORKD_GATEWAY" > /etc/systemd/network/20-wired.network \
|| die "Could not write dhcp network config to '/etc/systemd/network/20-wired.network'"
fi
chown root:systemd-network /etc/systemd/network/20-wired.network \
|| die "Could not change owner of '/etc/systemd/network/20-wired.network'"
chmod 640 /etc/systemd/network/20-wired.network \
|| die "Could not change permissions of '/etc/systemd/network/20-wired.network'"
fi
else else
# Install and enable dhcpcd # Install and enable dhcpcd
einfo "Installing dhcpcd" einfo "Installing dhcpcd"
@ -498,10 +414,6 @@ EOF
enable_service dhcpcd enable_service dhcpcd
fi fi
if [[ $ENABLE_SSHD == "true" ]]; then
enable_sshd
fi
# Install additional packages, if any. # Install additional packages, if any.
if [[ ${#ADDITIONAL_PACKAGES[@]} -gt 0 ]]; then if [[ ${#ADDITIONAL_PACKAGES[@]} -gt 0 ]]; then
einfo "Installing additional packages" einfo "Installing additional packages"
@ -517,22 +429,10 @@ EOF
ewarn "Root password cleared, set one as soon as possible!" ewarn "Root password cleared, set one as soon as possible!"
fi fi
# If configured, change to gentoo testing at the last moment.
# This is to ensure a smooth installation process. You can deal
# with the blockers after installation ;)
if [[ $USE_PORTAGE_TESTING == "true" ]]; then
einfo "Adding ~$GENTOO_ARCH to ACCEPT_KEYWORDS"
echo "ACCEPT_KEYWORDS=\"~$GENTOO_ARCH\"" >> /etc/portage/make.conf \
|| die "Could not modify /etc/portage/make.conf"
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 && "$@"
}