Compare commits

..

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

10 changed files with 321 additions and 1207 deletions

210
README.md
View File

@ -1,83 +1,71 @@
## About gentoo-install
This project aspires to be your favourite way to install gentoo.
It aims to provide a smooth installation experience, both for beginners and experts.
You may configure it by using a menuconfig-inspired interface or simply via a config file.
This is an installer for gentoo with a simple configuration TUI inspired by menuconfig.
The configurator is only used to generate a `gentoo.conf` file, which can also be
edited by hand, or reused later if desired. An example configuration is provided with the repository.
It supports the most common disk layouts, different file systems like ext4, ZFS and btrfs as well
The installer supports the most common disk layouts, different file systems like ext4, ZFS and btrfs as well
as additional layers such as LUKS or mdraid. It also supports both EFI (recommended) and BIOS boot,
and can be used with systemd or OpenRC as the init system. SSH can also be configured to allow using an automation framework
like [Ansible](https://github.com/ansible/ansible) or [Fora](https://github.com/oddlama/fora) to automate beyond system installation.
[Usage](#usage) |
[Overview](#overview) |
[Updating the Kernel](#updating-the-kernel) |
[Recommendations](#recommendations) |
[FAQ](#troubleshooting-and-faq)
and can be used with systemd or OpenRC as the init system.
![](contrib/screenshot_configure.png)
This installer might appeal to you if
## Quick start
- 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.
First, boot into a live environment of your choice. I recommend using an [Arch Linux](https://www.archlinux.org/download/) live iso,
as the installer will then be able to automatically download required programs or setup zfs support on the fly. After that,
proceed with the following steps:
Of course, we do encourage everyone to install gentoo manually. You will learn a lot if you
haven't done so already.
1. Either clone this repo or download and extract a copy
1. Run `./configure` and save your desired configuration
1. Begin installation using `./install`
## Usage
First, boot into a live environment of your choice. I recommend using an [Arch Linux](https://www.archlinux.org/download/) live ISO,
as the installer will then be able to automatically download required programs or setup ZFS support on the fly.
Afterwards, proceed with the following steps:
```bash
pacman -Sy git # (Archlinux) Install git in live environment, then clone:
git clone "https://github.com/oddlama/gentoo-install"
cd gentoo-install
./configure # configure to your liking, save as gentoo.conf
./install # begin installation
```
Every option is explained in detail in `gentoo.conf.example` and in the help menus of the TUI configurator.
Every option is explained in detail in `gentoo.conf.example` and in the help menu popups in the configurator.
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
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
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).
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
The installer performs the following main steps (in roughly this order),
with some parts depending on the chosen configuration:
The system will use `sys-kernel/gentoo-kernel-bin`, which should be suitable
to boot most systems out of the box. It is strongly recommend to replace this kernel
with a custom built one, when the system is functional.
1. Partition disks (highly dependent on configuration)
2. Download and extract stage3 tarball (with cryptographic verification)
\[Continues in chroot from here\]
3. Setup portage (initial rsync/git sync, run mirrorselect, create zz-autounmask files)
4. Base system configuration (hostname, timezone, keymap, locales)
5. Install required packages (git, kernel, ...)
6. Make system bootable (generate fstab, build initramfs, create efibootmgr/syslinux boot entry)
7. Ensure minimal working system (automatic wired networking, install eix, set root password)
- (Optional) Install sshd with secure config (no password logins)
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
to emerge. The critical commands will ask you what to do in case of a failure.
Here is an outline of the steps that are carried out:
1. Partition disks (supports gpt, raid, luks)
1. Download and cryptographically verify the newest stage3 tarball
1. Extract the stage3 tarball
1. Sync portage tree
1. Configure portage (create zz-autounmask files, configure `make.conf`)
1. Select the fastest gentoo mirrors if desired
1. Configure the base system (timezone, keymap, locales, ...)
1. Install git and other required tools (e.g. zfs if you have used zfs)
1. Install `sys-kernel/gentoo-kernel-bin` (until you can compile your own)
1. Generate an initramfs with dracut
1. Create efibootmgr entry or install syslinux depending on whether your system uses EFI or BIOS
1. Generate fstab
1. Depending on the configuration:
- (Optional) Install sshd with secure config
- (Optional) Install dhcpcd (if using OpenRC)
- (Optional) Install additional packages provided in config
1. Asks if a root password should be set
The goal of the installer is just to setup a minimal gentoo system following best-practices.
Anything beyond that is considered out-of-scope (with the exception of configuring sshd).
Here are some things that you might want to consider doing after the system installation is finished:
Anything else is probably out of scope for this script, but you can obviously do
what you want later on when the system is booted. Here are some things that you probably
want to consider doing after the base system installation is finished:
1. Read the news with `eselect news read`.
2. Compile a custom kernel and remove `gentoo-kernel-bin`
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` for native builds
- Set `CPU_FLAGS_X86` using the `cpuid2cpuflags` tool
4. Use a safe umask like `umask 077`
- Set `FEATURES="buildpkg"` if you want to build binary packages
4. Use a safe umask like `umask 0077`
If you are looking for a way to detect and manage your kernel configuration, have a look at [autokernel](https://github.com/oddlama/autokernel).
### (Optional) sshd
@ -96,124 +84,24 @@ These will simply be passed to a final `emerge` call before the script is done,
where autounmasking will also be done automatically. It is recommended to keep
this to a minimum, because of the quite "interactive" nature of gentoo package management ;)
## Updating the kernel
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.
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/`
or `/boot/bios` which may be used to generate a new initramfs for the given kernel version.
Depending on whether your system uses EFI or BIOS boot, you will also find your kernel and initramfs in different locations:
```bash
# EFI
kernel="/boot/efi/vmlinuz.efi"
initrd="/boot/efi/initramfs.img"
# BIOS
kernel="/boot/bios/vmlinuz-current"
initrd="/boot/bios/initramfs.img"
```
In both cases, the update procedure is as follows:
1. Emerge new kernel
2. `eselect kernel set <kver>`
3. Backup old kernel and initramfs (`mv "$kernel"{,.bak}`, `mv "$initrd"{,.bak}`)
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)
## Recommendations
This project started out as a way of documenting a best-practices installation for myself.
As the project grew larger, I've added more configuration options to suit legacy needs.
Below I've outlined several decisions I've made for this project, or decisions you
have during configuration. If you intend on setting up a modern system, you might want
to check them out. Please keep in mind that those are all based on my personal opinions and
experience. Your mileage may vary.
#### EFI vs BIOS
Use EFI. BIOS is old and deprecated for a long time now.
Only certain VPS hosters may require you to use BIOS still (time to write to them about that!)
#### EFIstub booting
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.
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.
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
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
I recommend using a modern file system like ZFS, both on desktops and servers.
It provides transparent block-level compression, instant snapshots and full-disk encryption.
Generally, encrypting your root fs doesn't cost you anything and protects your data in case you lose your device.
#### Systemd vs OpenRC
I will not entertain the religious eternal debate here. Both are fine init systems, and
I've been using both *a lot*. If you cannot decide, here are some objective facts:
- OpenRC is a service manager. Setting up all the other services is a lot of work, but you will learn a lot.
- Systemd is an OS-level software suite. It brings an insane amount of features with a steep learning curve.
Here's a non-exhaustive list of things you will ~do manually~ learn when using OpenRC,
that are already provided for in systemd: udev, dhcp, acpi events (power/sleep button),
cron jobs, reliable syslog, logrotate, process sandboxing, persistent backlight setting, persistent audio mute-status, user-owned login sessions, ...
Make of this what you will, both have their own quirks. Choose your poison.
#### Miscellaneous
- Use the newer iwd for WiFi instead of wpa_supplicant
- (If systemd) Use timers instead of cron jobs
## Troubleshooting and FAQ
After the initial sanity check, the script should be able to finish unattendedly.
But given the unpredictability of future gentoo versions, you might still run into issues
once in a while.
The script checks every command for success, so if anything fails during installation,
you will be given a proper message of what went wrong. Inside the chroot,
most commands will be executed in a checked loop, and allow you to interactively
fix problems with a shell, to retry, or to skip the command. You can report
issues specific to this script on the issue tracker. To seek help
regarding gentoo in general, visit the official [IRC](https://www.gentoo.org/get-involved/irc-channels/)
or [Discord](https://discord.com/invite/gentoolinux).
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.
#### 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.
```
fix problems with a shell, to retry, or to skip the command.
#### 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.
Use `wipefs -a <DEVICE>` on your partitions or fully wipe the disk before use.
**A:** Use `wipefs -a <DEVICE>` on your partitions or fully wipe the disk before use.
The new partitions probably align with previously existing partitions that had
filesystems on them. Some filesystems signatures like those of ZFS can coexist with
other signatures and may cause blkid to find ambiguous information.
## References
* [Gentoo AMD64 Handbook](https://wiki.gentoo.org/wiki/Handbook:AMD64)
* [Sakaki's EFI Install Guide](https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide)
* [Gentoo AMD64 Handbook](https://wiki.gentoo.org/wiki/Handbook:AMD64)

511
configure vendored
View File

@ -8,7 +8,8 @@ set -uo pipefail
# Find the directory this script is stored in. (from: http://stackoverflow.com/questions/59895)
function get_source_dir() {
local source="${BASH_SOURCE[0]}"
while [[ -h $source ]]; do
while [[ -h $source ]]
do
local tmp
tmp="$(cd -P "$(dirname "${source}")" && pwd)"
source="$(readlink "${source}")"
@ -43,13 +44,7 @@ while [[ $# -gt 0 ]]; do
shift
done
check_wanted_programs dialog libncurses-dev=ncursesw6-config
# Determine whether EFI is available
HAS_EFI_SUPPORT=$([[ -d /sys/firmware/efi ]] && echo -n "true" || echo -n "false")
DEFAULT_BOOT_TYPE=$([[ $HAS_EFI_SUPPORT == true ]] && echo -n "efi" || echo -n "bios")
EFI_UNSUPPORTED_MESSAGE_SHORT="Missing EFI support on this system!"
EFI_UNSUPPORTED_MESSAGE="Apparently, your system does NOT support efi. Double-check before proceeding!"
check_has_programs dialog ncurses=ncursesw6-config
# Wrap dialog in two functions to prevent it from cluttering stderr.
function dialog_wrapper() { dialog_out=$(command dialog --colors "$@" 3>&2 2>&1 1>&3 3>&-); }
@ -67,7 +62,7 @@ function get_timezone() {
timezone=${file#*zoneinfo/}
if [[ $timezone == "$file" ]]; then
# not pointing to expected location or not Region/City
echo "Atlantic/Azores"
echo "Europe/London"
else
echo "$timezone"
fi
@ -108,6 +103,14 @@ function get_all_timezones() {
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() {
LOCALES=""
N_LOCALES=0
@ -156,20 +159,11 @@ function define_zfs_compression() {
}
function define_disk_layout() {
local swapdev
case "$PARTITIONING_SCHEME" in
"classic_single_disk") define_disk_configuration_function "create_classic_single_disk_layout swap=$(define_swap) type=${PARTITIONING_BOOT_TYPE@Q} luks=${PARTITIONING_USE_LUKS@Q} root_fs=${PARTITIONING_ROOT_FS@Q}" "${PARTITIONING_DEVICE@Q}" ;;
"existing_partitions")
if [[ "$PARTITIONING_USE_SWAP" ]]; then
swapdev=${PARTITIONING_SWAP_DEVICE:-false}
else
swapdev=false
fi
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_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}" ;;
"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}" ;;
"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}" ;;
"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}" ;;
"custom")
# Show current function declaration, trim trailing whitespace
declare -f disk_configuration \
@ -178,45 +172,18 @@ function define_disk_layout() {
esac
}
INIT_SYSTEMS=("systemd" "OpenRC")
ALL_GENTOO_ARCHS=("x86" "amd64" "arm" "arm64")
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-mergedusr" "systemd-mergedusr | Minimal systemd base with merged filesystem layout"
"desktop-systemd" "systemd-desktop | systemd, desktop profile, might have blockers"
"nomultilib-openrc" "nomultilib-openrc | Minimal OpenRC base without 32bits support (Experimental)"
"nomultilib-systemd" "nomultilib-systemd | Minimal systemd base without 32bits support (Experimental)"
"nomultilib-systemd-mergedusr" "nomultilib-systemd-mergedusr | Minimal systemd base with merged filesystem layout and without 32bits support (Experimental)"
"x32-openrc" "x32-openrc | Minimal OpenRC base without 64bits support (Experimental)"
"x32-systemd" "x32-systemd | Minimal systemd base without 64bits support (Experimental)"
"x32-systemd-mergedusr" "x32-systemd-mergedusr | Minimal systemd base with merged filesystem layout and without 64bits support (Experimental)"
"llvm-openrc" "llvm-openrc | Minimal OpenRC base compiled with LLVM (Experimental)"
"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=(
"classic_single_disk" "Classic single disk layout (boot/efi, swap?, root)"
"existing_partitions" "Skip partitioning, use existing pre-formatted partitions"
"classic_single_disk" "Classic single disk layout (boot, swap, root)"
"zfs_centric" "ZFS centric (optional ZFS compression and encryption)"
"btrfs_centric" "Btrfs centric (optional raid0/1 via btrfs)"
"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 (edit the config manually later)"
)
PARTITIONING_BOOT_TYPES=(
"efi" "efi$([[ $HAS_EFI_SUPPORT == true ]] && echo -n "" || echo -n " (!! $EFI_UNSUPPORTED_MESSAGE_SHORT !!)")"
"bios" "bios"
)
PARTITIONING_BOOT_TYPES=("efi" "bios")
PARTITIONING_ROOT_FS_TYPES=("ext4" "btrfs")
PARTITIONING_BTRFS_RAID_TYPES=("raid0" "raid1")
PARTITIONING_ZFS_POOL_TYPES=("standard" "custom")
@ -262,50 +229,16 @@ function create_classic_single_disk_layout() {
PARTITIONING_ROOT_FS="${arguments[root_fs]:-ext4}"
}
function create_existing_partitions_layout() {
PARTITIONING_SCHEME="existing_partitions"
local known_arguments=('+swap' '+boot' '?type')
local extra_arguments=()
declare -A arguments; parse_arguments "$@"
PARTITIONING_DEVICE="${extra_arguments[0]}"
if [[ "${arguments[swap]}" == "false" ]]; then
PARTITIONING_USE_SWAP=false
PARTITIONING_SWAP_DEVICE=""
else
PARTITIONING_USE_SWAP=true
PARTITIONING_SWAP_DEVICE="${arguments[swap]}"
fi
PARTITIONING_BOOT_TYPE="${arguments[type]}"
PARTITIONING_BOOT_DEVICE="${arguments[boot]}"
}
function create_raid0_luks_layout() {
PARTITIONING_SCHEME="raid0_luks"
local known_arguments=('+swap' '?type' '?luks' '?root_fs')
local known_arguments=('+swap' '?type' '?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}"
}
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}"
}
@ -320,7 +253,7 @@ function create_zfs_centric_layout() {
parse_swap "${arguments[swap]}"
PARTITIONING_BOOT_TYPE="${arguments[type]}"
PARTITIONING_ZFS_POOL_TYPE="${arguments[pool_type]:-standard}"
PARTITIONING_ZFS_USE_ENCRYPTION="${arguments[encrypt]:-false}"
PARTITIONING_ZFS_ENCRYPTION="${arguments[encrypt]:-false}"
parse_zfs_compression "${arguments[compress]:-false}"
}
@ -349,7 +282,7 @@ function create_btrfs_centric_layout() {
get_all_keymaps
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)
@ -378,6 +311,12 @@ function load_selected_locales() {
function process_config() {
disk_configuration
if [[ "$SYSTEMD" == true ]]; then
INIT_SYSTEM="systemd"
else
INIT_SYSTEM="OpenRC"
fi
if [[ "$KEYMAP" == "$KEYMAP_INITRAMFS" ]]; then
KEYMAP_INITRAMFS_OTHER=false
else
@ -399,7 +338,7 @@ function load_config() {
# shellcheck disable=SC1090
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
}
@ -409,21 +348,15 @@ function load_default_config() {
KEYMAP="$(get_default_keymap)"
KEYMAP_INITRAMFS="$KEYMAP"
LOCALES="C.UTF-8 UTF-8"
LOCALE="C.UTF-8"
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
LOCALE="C.utf8"
function disk_configuration() {
#create_zfs_centric_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" encrypt=true compress=zstd pool_type=standard /dev/sdX
create_classic_single_disk_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" luks=true root_fs=ext4 /dev/sdX
#create_zfs_centric_layout swap=8GiB type=efi encrypt=true compress=zstd pool_type=standard /dev/sdX
create_classic_single_disk_layout swap=8GiB type=efi luks=true root_fs=ext4 /dev/sdX
}
STAGE3_VARIANT="systemd"
SYSTEMD=true
PORTAGE_SYNC_TYPE="git"
PORTAGE_GIT_FULL_HISTORY=false
PORTAGE_GIT_MIRROR="https://anongit.gentoo.org/git/repo/sync/gentoo.git"
@ -431,15 +364,12 @@ function load_default_config() {
GENTOO_MIRROR="https://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo"
GENTOO_ARCH="amd64"
USE_PORTAGE_TESTING=true
SELECT_MIRRORS=false
SELECT_MIRRORS=true
SELECT_MIRRORS_LARGE_FILE=false
ADDITIONAL_PACKAGES=()
ENABLE_SSHD=true
ENABLE_BINPKG=false
INSTALL_SSHD=true
ROOT_SSH_AUTHORIZED_KEYS=""
# All settings are unsaved.
UNSAVED_CHANGES=true
@ -496,12 +426,6 @@ function on_off_label() {
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() {
[[ "$1" == true ]]
}
@ -525,7 +449,7 @@ function one_of() {
# $2: description
# $3: space separated index list of selected items (e.g. "0 1 5 6")
# $@: all items
function menu_splitlist() {
function menu_splitlist() {
local title="$1"
local description="$2"
local selected_index_list="$3"
@ -630,7 +554,7 @@ function menu_radiolist_labeled() {
# $2: description
# $3: default item
# $@: items
function menu_radiolist() {
function menu_radiolist() {
local title="$1"
local description="$2"
local default_item="$3"
@ -680,52 +604,6 @@ function menu_radiolist() {
fi
}
# $1: title
# $2: description
# $3: current device (will be canonicalized if possible)
function menu_select_device() {
local title="$1"
local desc="$2"
local prev_selected
prev_selected=$(canonicalize_device "$3")
while true; do
local all_devices=()
for dev in /dev/disk/by-id/*; do
all_devices+=("$dev" "$(basename "$dev")")
done
all_devices+=("/dev/null" "<enter custom path>")
if menu_radiolist_labeled "$title" "$desc" "$prev_selected" "${all_devices[@]}"; then
if [[ "$dialog_out" == "/dev/null" ]]; then
while true; do
if dialog \
--title "$1" \
--inputbox "$([[ -e $prev_selected ]] || echo -n "\Z1The previously selected device $prev_selected does not exist!\Zn ")Enter the path of the desired device." \
"${INPUTBOX_SIZE[@]}" "$prev_selected"
then
# Repeat until selected device exists or cancelled
prev_selected="$dialog_out"
[[ ! -e "$dialog_out" ]] && continue
return 0
else
# <Cancel> -> return to previous menu
break
fi
done
# Return to radiolist
continue
else
return 0
fi
else
# <Cancel>
return 1
fi
done
}
function msgbox_help() {
dialog --msgbox "$1" "${HELP_POPUP_SIZE[@]}"
}
@ -857,14 +735,12 @@ init_menu_size
MENU_ITEMS=(
"PARTITIONING_SCHEME"
"PARTITIONING_BOOT_TYPE"
"PARTITIONING_BOOT_DEVICE"
"PARTITIONING_USE_SWAP"
"PARTITIONING_SWAP"
"PARTITIONING_SWAP_DEVICE"
"PARTITIONING_ROOT_FS"
"PARTITIONING_USE_LUKS"
"PARTITIONING_ZFS_POOL_TYPE"
"PARTITIONING_ZFS_USE_ENCRYPTION"
"PARTITIONING_ZFS_ENCRYPTION"
"PARTITIONING_ZFS_USE_COMPRESSION"
"PARTITIONING_ZFS_COMPRESSION"
"PARTITIONING_BTRFS_RAID_TYPE"
@ -878,25 +754,17 @@ MENU_ITEMS=(
"KEYMAP_INITRAMFS"
"LOCALES"
"LOCALE"
"SYSTEMD_NETWORKD"
"SYSTEMD_INITRAMFS_SSHD"
"SYSTEMD_NETWORKD_INTERFACE_NAME"
"SYSTEMD_NETWORKD_DHCP"
"SYSTEMD_NETWORKD_ADDRESSES"
"SYSTEMD_NETWORKD_GATEWAY"
"--------"
"STAGE3_VARIANT"
"INIT_SYSTEM"
"PORTAGE_SYNC_TYPE"
"PORTAGE_GIT_FULL_HISTORY"
"PORTAGE_GIT_MIRROR"
"GENTOO_MIRROR"
"GENTOO_ARCH"
"USE_PORTAGE_TESTING"
"SELECT_MIRRORS"
"SELECT_MIRRORS_LARGE_FILE"
"--------"
"ENABLE_SSHD"
"ENABLE_BINPKG"
"INSTALL_SSHD"
"ROOT_SSH_AUTHORIZED_KEYS"
"ADDITIONAL_PACKAGES"
)
@ -920,12 +788,10 @@ function PARTITIONING_SCHEME_menu() {
then
# Set disk scheme
case "$dialog_out" in
"classic_single_disk") create_classic_single_disk_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" luks=false root_fs=ext4 /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 ;;
"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 ;;
"raid1_luks") create_raid1_luks_layout swap=8GiB type="$DEFAULT_BOOT_TYPE" luks=true root_fs=ext4 /dev/sdX /dev/sdY ;;
"classic_single_disk") create_classic_single_disk_layout swap=8GiB type=efi luks=false root_fs=ext4 /dev/sdX ;;
"zfs_centric") create_zfs_centric_layout swap=8GiB type=efi encrypt=true compress=zstd pool_type=standard /dev/sdX ;;
"btrfs_centric") create_btrfs_centric_layout swap=8GiB type=efi raid_type=raid0 luks=false /dev/sdX ;;
"raid0_luks") create_raid0_luks_layout swap=8GiB type=efi root_fs=ext4 /dev/sdX /dev/sdY ;;
"custom") PARTITIONING_SCHEME="$dialog_out" ;;
esac
UNSAVED_CHANGES=true
@ -936,16 +802,17 @@ function PARTITIONING_SCHEME_menu() {
}
function PARTITIONING_BOOT_TYPE_tag() { echo " ├ Boot type"; }
function PARTITIONING_BOOT_TYPE_label() { echo " ├ ($PARTITIONING_BOOT_TYPE)$([[ $PARTITIONING_BOOT_TYPE == efi && $HAS_EFI_SUPPORT == false ]] && echo -n " \Z1$EFI_UNSUPPORTED_MESSAGE_SHORT\Zn" || echo -n "")"; }
function PARTITIONING_BOOT_TYPE_label() { echo " ├ ($PARTITIONING_BOOT_TYPE)"; }
function PARTITIONING_BOOT_TYPE_show() { [[ $PARTITIONING_SCHEME != "custom" ]]; }
function PARTITIONING_BOOT_TYPE_help() { echo "Select whether to use EFI or BIOS boot."; }
function PARTITIONING_BOOT_TYPE_menu() {
if menu_radiolist_labeled \
if menu_radiolist \
"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." \
"$PARTITIONING_BOOT_TYPE" \
"${PARTITIONING_BOOT_TYPES[@]}"
then
# Set timezone
PARTITIONING_BOOT_TYPE="$dialog_out"
UNSAVED_CHANGES=true
else
@ -954,32 +821,6 @@ function PARTITIONING_BOOT_TYPE_menu() {
fi
}
function PARTITIONING_BOOT_DEVICE_tag() { echo " ├ Boot Device"; }
function PARTITIONING_BOOT_DEVICE_label() {
local devshort=$PARTITIONING_BOOT_DEVICE
devshort=$(shorten_device "$devshort")
if [[ -e "$PARTITIONING_BOOT_DEVICE" ]]; then
echo " ├ ($devshort)"
else
echo " ├ (\Z1$devshort\Zn)"
fi
}
function PARTITIONING_BOOT_DEVICE_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "existing_partitions"; }
function PARTITIONING_BOOT_DEVICE_help() { echo "The device to use for the boot partition. For EFI systems this is the efi partition. Must be formatted already."; }
function PARTITIONING_BOOT_DEVICE_menu() {
if menu_select_device \
"Select boot device" \
"Select the device containing the EFI filesystem or /boot partition respectively for systems using efi or bios boot." \
"$PARTITIONING_BOOT_DEVICE"
then
PARTITIONING_BOOT_DEVICE="$dialog_out"
UNSAVED_CHANGES=true
else
# Return to menu
true
fi
}
function PARTITIONING_USE_SWAP_tag() { echo " ├ Use swap"; }
function PARTITIONING_USE_SWAP_label() { on_off_label "$PARTITIONING_USE_SWAP" " ├ "; }
function PARTITIONING_USE_SWAP_show() { [[ $PARTITIONING_SCHEME != "custom" ]]; }
@ -991,49 +832,20 @@ function PARTITIONING_USE_SWAP_menu() {
function PARTITIONING_SWAP_tag() { echo " │ └ Swap amount"; }
function PARTITIONING_SWAP_label() { echo " │ └ ($PARTITIONING_SWAP)"; }
function PARTITIONING_SWAP_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && is_on "$PARTITIONING_USE_SWAP" && ! one_of "$PARTITIONING_SCHEME" "existing_partitions"; }
function PARTITIONING_SWAP_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && is_on "$PARTITIONING_USE_SWAP"; }
function PARTITIONING_SWAP_help() { echo "Select the amount of swap to use."; }
function PARTITIONING_SWAP_menu() {
dialog \
--title "Select swap amount" \
--inputbox "Enter the amount of swap for the new system. Use the correct suffix (e.g. 16GiB, 1000MB)." \
"${INPUTBOX_SIZE[@]}" "$PARTITIONING_SWAP" \
|| return 0
"${INPUTBOX_SIZE[@]}" "$PARTITIONING_SWAP"
PARTITIONING_SWAP="$dialog_out"
UNSAVED_CHANGES=true
}
function PARTITIONING_SWAP_DEVICE_tag() { echo " │ └ Swap Device"; }
function PARTITIONING_SWAP_DEVICE_label() {
local dev=${PARTITIONING_SWAP_DEVICE:-/dev/sdB}
local devshort
devshort=$(shorten_device "$dev")
if [[ -e "$dev" ]]; then
echo " │ └ ($devshort)"
else
echo " │ └ (\Z1$devshort\Zn)"
fi
}
function PARTITIONING_SWAP_DEVICE_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && is_on "$PARTITIONING_USE_SWAP" && one_of "$PARTITIONING_SCHEME" "existing_partitions"; }
function PARTITIONING_SWAP_DEVICE_help() { echo "The device to use as swap."; }
function PARTITIONING_SWAP_DEVICE_menu() {
if menu_select_device \
"Select swap device" \
"Select the device to use as swap." \
"$PARTITIONING_SWAP_DEVICE"
then
PARTITIONING_SWAP_DEVICE="$dialog_out"
UNSAVED_CHANGES=true
else
# Return to menu
true
fi
}
function PARTITIONING_ROOT_FS_tag() { echo " ├ Root filesystem"; }
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_menu() {
if menu_radiolist \
@ -1042,6 +854,7 @@ function PARTITIONING_ROOT_FS_menu() {
"$PARTITIONING_ROOT_FS" \
"${PARTITIONING_ROOT_FS_TYPES[@]}"
then
# Set timezone
PARTITIONING_ROOT_FS="$dialog_out"
UNSAVED_CHANGES=true
else
@ -1059,18 +872,15 @@ function PARTITIONING_USE_LUKS_menu() {
UNSAVED_CHANGES=true
}
function PARTITIONING_ZFS_USE_ENCRYPTION_tag() { echo " ├ ZFS Encryption"; }
function PARTITIONING_ZFS_USE_ENCRYPTION_label() { on_off_label "$PARTITIONING_ZFS_USE_ENCRYPTION" " ├ "; }
function PARTITIONING_ZFS_USE_ENCRYPTION_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "zfs_centric" && one_of "$PARTITIONING_ZFS_POOL_TYPE" "standard"; }
function PARTITIONING_ZFS_USE_ENCRYPTION_help() { echo "Determines if ZFS encryption will be used to encrypt your root partition. You can export the desired encryption key via export GENTOO_INSTALL_ENCRYPTION_KEY='...' before installing if you don't want to be asked."; }
function PARTITIONING_ZFS_USE_ENCRYPTION_menu() {
on_off_toggle "PARTITIONING_ZFS_USE_ENCRYPTION"
function PARTITIONING_ZFS_ENCRYPTION_tag() { echo " ├ ZFS Encryption"; }
function PARTITIONING_ZFS_ENCRYPTION_label() { on_off_label "$PARTITIONING_ZFS_ENCRYPTION" " ├ "; }
function PARTITIONING_ZFS_ENCRYPTION_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "zfs_centric" && one_of "$PARTITIONING_ZFS_POOL_TYPE" "standard"; }
function PARTITIONING_ZFS_ENCRYPTION_help() { echo "Determines if ZFS encryption will be used to encrypt your root partition. You can export the desired encryption key via export GENTOO_INSTALL_ENCRYPTION_KEY='...' before installing if you don't want to be asked."; }
function PARTITIONING_ZFS_ENCRYPTION_menu() {
on_off_toggle "PARTITIONING_ZFS_ENCRYPTION"
UNSAVED_CHANGES=true
}
# TODO keylocation prompt | file
# TODO if loc is file, another checkbox to "autogenerate and save new key" openssl rand -hex 32 > file
function PARTITIONING_ZFS_USE_COMPRESSION_tag() { echo " ├ Use ZFS Compression"; }
function PARTITIONING_ZFS_USE_COMPRESSION_label() { on_off_label "$PARTITIONING_ZFS_USE_COMPRESSION" " ├ "; }
function PARTITIONING_ZFS_USE_COMPRESSION_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "zfs_centric" && one_of "$PARTITIONING_ZFS_POOL_TYPE" "standard"; }
@ -1091,6 +901,7 @@ function PARTITIONING_ZFS_COMPRESSION_menu() {
"$PARTITIONING_ZFS_COMPRESSION" \
"${PARTITIONING_ZFS_COMPRESSIONS[@]}"
then
# Set timezone
PARTITIONING_ZFS_COMPRESSION="$dialog_out"
UNSAVED_CHANGES=true
else
@ -1110,6 +921,7 @@ function PARTITIONING_ZFS_POOL_TYPE_menu() {
"$PARTITIONING_ZFS_POOL_TYPE" \
"${PARTITIONING_ZFS_POOL_TYPES[@]}"
then
# Set timezone
PARTITIONING_ZFS_POOL_TYPE="$dialog_out"
UNSAVED_CHANGES=true
else
@ -1129,6 +941,7 @@ function PARTITIONING_BTRFS_RAID_TYPE_menu() {
"$PARTITIONING_BTRFS_RAID_TYPE" \
"${PARTITIONING_BTRFS_RAID_TYPES[@]}"
then
# Set timezone
PARTITIONING_BTRFS_RAID_TYPE="$dialog_out"
UNSAVED_CHANGES=true
else
@ -1139,28 +952,21 @@ function PARTITIONING_BTRFS_RAID_TYPE_menu() {
function PARTITIONING_DEVICE_tag() { echo " └ Device"; }
function PARTITIONING_DEVICE_label() {
local devshort=$PARTITIONING_DEVICE
devshort=$(shorten_device "$devshort")
if [[ -e "$PARTITIONING_DEVICE" ]]; then
echo " └ ($devshort)"
echo " └ ($PARTITIONING_DEVICE)"
else
echo " └ (\Z1$devshort\Zn)"
echo " └ (\Z1$PARTITIONING_DEVICE\Zn)"
fi
}
function PARTITIONING_DEVICE_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "classic_single_disk" "existing_partitions"; }
function PARTITIONING_DEVICE_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "classic_single_disk"; }
function PARTITIONING_DEVICE_help() { echo "The block device to which the layout will be applied."; }
function PARTITIONING_DEVICE_menu() {
if menu_select_device \
"Select root device" \
"Select the device to use as the root device." \
"$PARTITIONING_DEVICE"
then
PARTITIONING_DEVICE="$dialog_out"
UNSAVED_CHANGES=true
else
# Return to menu
true
fi
dialog \
--title "Select device" \
--inputbox "Enter the path of the device which you want to partition. (e.g. /dev/sda)." \
"${INPUTBOX_SIZE[@]}" "$PARTITIONING_DEVICE"
PARTITIONING_DEVICE="$dialog_out"
UNSAVED_CHANGES=true
}
function PARTITIONING_DEVICES_tag() { echo " └ Devices"; }
@ -1173,7 +979,7 @@ function PARTITIONING_DEVICES_label() {
if [[ "$invalid" -gt 0 ]]; then
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)"
elif [[ "${#PARTITIONING_DEVICES[@]}" -eq 0 ]]; then
echo " └ (${#PARTITIONING_DEVICES[@]} devices, \Z1need at least 1\Zn)"
@ -1181,7 +987,7 @@ function PARTITIONING_DEVICES_label() {
echo " └ (${#PARTITIONING_DEVICES[@]} devices)"
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_menu() {
local invalid=()
@ -1198,8 +1004,7 @@ function PARTITIONING_DEVICES_menu() {
dialog \
--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_SIZE[@]}" "${PARTITIONING_DEVICES[*]}" \
|| return 0
"${INPUTBOX_SIZE[@]}" "${PARTITIONING_DEVICES[*]}"
read -ra PARTITIONING_DEVICES <<< "$dialog_out"
UNSAVED_CHANGES=true
}
@ -1212,8 +1017,7 @@ function HOSTNAME_menu() {
dialog \
--title "Select hostname" \
--inputbox "Enter the hostname for your new system." \
"${INPUTBOX_SIZE[@]}" "$HOSTNAME" \
|| return 0
"${INPUTBOX_SIZE[@]}" "$HOSTNAME"
HOSTNAME="$dialog_out"
UNSAVED_CHANGES=true
}
@ -1229,6 +1033,7 @@ function TIMEZONE_menu() {
"$TIMEZONE" \
"${ALL_TIMEZONES[@]}"
then
# Set timezone
TIMEZONE="$dialog_out"
UNSAVED_CHANGES=true
else
@ -1248,6 +1053,7 @@ function KEYMAP_menu() {
"$KEYMAP" \
"${ALL_KEYMAPS[@]}"
then
# Set keymap
KEYMAP="$dialog_out"
UNSAVED_CHANGES=true
else
@ -1278,6 +1084,7 @@ function KEYMAP_INITRAMFS_menu() {
"$KEYMAP_INITRAMFS" \
"${ALL_KEYMAPS[@]}"
then
# Set keymap
KEYMAP_INITRAMFS="$dialog_out"
UNSAVED_CHANGES=true
else
@ -1289,9 +1096,10 @@ function KEYMAP_INITRAMFS_menu() {
function LOCALES_tag() { echo "Locales"; }
function LOCALES_label() { echo "$N_LOCALES selected"; }
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() {
if menu_splitlist "Select locales" "Select which locales to generate." "$SELECTED_LOCALES" "${SUPPORTED_LOCALES[@]}"; then
# Set locales
SELECTED_LOCALES="$dialog_out"
recalculate_locales
UNSAVED_CHANGES=true
@ -1312,6 +1120,7 @@ function LOCALE_menu() {
"$LOCALE" \
"${LOCALE_A[@]}"
then
# Set locale
LOCALE="$dialog_out"
UNSAVED_CHANGES=true
else
@ -1320,88 +1129,19 @@ function LOCALE_menu() {
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_label() { echo "($STAGE3_VARIANT)"; }
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_menu() {
if menu_radiolist_labeled \
"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." \
"$STAGE3_VARIANT" \
"${ALL_STAGE3_VARIANTS[@]}"
function INIT_SYSTEM_tag() { echo "Init system"; }
function INIT_SYSTEM_label() { echo "($INIT_SYSTEM)"; }
function INIT_SYSTEM_show() { return 0; }
function INIT_SYSTEM_help() { echo ""; }
function INIT_SYSTEM_menu() {
if menu_radiolist \
"Select init system" \
"Select the init system you want to use." \
"$INIT_SYSTEM" \
"${INIT_SYSTEMS[@]}"
then
STAGE3_VARIANT="$dialog_out"
# Set init system
INIT_SYSTEM="$dialog_out"
UNSAVED_CHANGES=true
else
# Return to menu
@ -1420,6 +1160,7 @@ function PORTAGE_SYNC_TYPE_menu() {
"$PORTAGE_SYNC_TYPE" \
"${PORTAGE_SYNC_TYPES[@]}"
then
# Set arch
PORTAGE_SYNC_TYPE="$dialog_out"
UNSAVED_CHANGES=true
else
@ -1440,14 +1181,12 @@ function PORTAGE_GIT_FULL_HISTORY_menu() {
function PORTAGE_GIT_MIRROR_tag() { echo " └ 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_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() {
dialog \
--title "Select portage git mirror" \
--inputbox "Enter the portage git mirror that should be used to sync the portage tree." \
"${INPUTBOX_SIZE[@]}" "$PORTAGE_GIT_MIRROR" \
|| return 0
PORTAGE_GIT_MIRROR="$dialog_out"
"${INPUTBOX_SIZE[@]}" "$PORTAGE_GIT_MIRROR"
UNSAVED_CHANGES=true
}
@ -1458,10 +1197,8 @@ function GENTOO_MIRROR_help() { echo "Enter the initial gentoo mirror that shou
function GENTOO_MIRROR_menu() {
dialog \
--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_SIZE[@]}" "$GENTOO_MIRROR" \
|| return 0
GENTOO_MIRROR="$dialog_out"
--inputbox "Enter the initial gentoo mirror that should be used for the installation process (until mirrorselect is run)." \
"${INPUTBOX_SIZE[@]}" "$GENTOO_MIRROR"
UNSAVED_CHANGES=true
}
@ -1476,6 +1213,7 @@ function GENTOO_ARCH_menu() {
"$GENTOO_ARCH" \
"${ALL_GENTOO_ARCHS[@]}"
then
# Set arch
GENTOO_ARCH="$dialog_out"
UNSAVED_CHANGES=true
else
@ -1484,15 +1222,6 @@ function GENTOO_ARCH_menu() {
fi
}
function USE_PORTAGE_TESTING_tag() { echo "Enable bleeding edge (~$GENTOO_ARCH)"; }
function USE_PORTAGE_TESTING_label() { on_off_label "$USE_PORTAGE_TESTING"; }
function USE_PORTAGE_TESTING_show() { return 0; }
function USE_PORTAGE_TESTING_help() { echo "Determines if the system should use bleeding edge software from the respective architecture's testing branch. This will add ACCEPT_KEYWORDS=\"~\$GENTOO_ARCH\" to /etc/portage/make.conf"; }
function USE_PORTAGE_TESTING_menu() {
on_off_toggle "USE_PORTAGE_TESTING"
UNSAVED_CHANGES=true
}
function SELECT_MIRRORS_tag() { echo "Run mirrorselect"; }
function SELECT_MIRRORS_label() { on_off_label "$SELECT_MIRRORS"; }
function SELECT_MIRRORS_show() { return 0; }
@ -1511,21 +1240,12 @@ function SELECT_MIRRORS_LARGE_FILE_menu() {
UNSAVED_CHANGES=true
}
function ENABLE_SSHD_tag() { echo "Enable sshd"; }
function ENABLE_SSHD_label() { on_off_label "$ENABLE_SSHD"; }
function ENABLE_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 ENABLE_SSHD_menu() {
on_off_toggle "ENABLE_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"
function INSTALL_SSHD_tag() { echo "Install sshd"; }
function INSTALL_SSHD_label() { on_off_label "$INSTALL_SSHD"; }
function INSTALL_SSHD_show() { return 0; }
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 INSTALL_SSHD_menu() {
on_off_toggle "INSTALL_SSHD"
UNSAVED_CHANGES=true
}
@ -1581,6 +1301,12 @@ function save() {
KEYMAP_INITRAMFS="$KEYMAP"
fi
if [[ $INIT_SYSTEM == "systemd" ]]; then
SYSTEMD=true
else
SYSTEMD=false
fi
cat > "$1" <<EOF
# vim: set ft=sh ts=4 sw=4 sts=-1 noet:
# This file will be interpreted by /bin/bash.
@ -1603,37 +1329,26 @@ KEYMAP_INITRAMFS=${KEYMAP_INITRAMFS@Q}
LOCALES=${LOCALES@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
SYSTEMD=${SYSTEMD@Q}
PORTAGE_SYNC_TYPE=${PORTAGE_SYNC_TYPE@Q}
PORTAGE_GIT_FULL_HISTORY=${PORTAGE_GIT_FULL_HISTORY@Q}
PORTAGE_GIT_MIRROR=${PORTAGE_GIT_MIRROR@Q}
GENTOO_MIRROR=${GENTOO_MIRROR@Q}
GENTOO_ARCH=${GENTOO_ARCH@Q}
STAGE3_VARIANT=${STAGE3_VARIANT@Q}
STAGE3_BASENAME="stage3-\$GENTOO_ARCH-\$STAGE3_VARIANT"
USE_PORTAGE_TESTING=${USE_PORTAGE_TESTING@Q}
STAGE3_BASENAME="stage3-\$GENTOO_ARCH$([[ $SYSTEMD == true ]] && echo -n "-systemd" || echo -n "-openrc")"
SELECT_MIRRORS=${SELECT_MIRRORS@Q}
SELECT_MIRRORS_LARGE_FILE=${SELECT_MIRRORS_LARGE_FILE@Q}
SYSTEMD=\$([[ \$STAGE3_VARIANT == *systemd* ]] && echo "true" || echo "false")
MUSL=\$([[ \$STAGE3_VARIANT == *musl* ]] && echo "true" || echo "false")
################################################
# Additional (optional) configuration
ADDITIONAL_PACKAGES=(${ADDITIONAL_PACKAGES[@]@Q})
ENABLE_SSHD=${ENABLE_SSHD@Q}
ENABLE_BINPKG=${ENABLE_BINPKG@Q}
INSTALL_SSHD=${INSTALL_SSHD@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 ISO-8859-1
aa_ER UTF-8
@ -76,7 +77,6 @@ brx_IN UTF-8
bs_BA.UTF-8 UTF-8
bs_BA ISO-8859-2
byn_ER UTF-8
C.UTF-8 UTF-8
ca_AD.UTF-8 UTF-8
ca_AD ISO-8859-15
ca_ES.UTF-8 UTF-8

BIN
contrib/screenshot_configure.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -35,10 +35,10 @@ function disk_configuration() {
#
# Parameters:
# 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.
# 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
# 2. create_btrfs_centric_layout
@ -52,7 +52,7 @@ function disk_configuration() {
#
# Parameters:
# 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.
# 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.
@ -68,30 +68,13 @@ function disk_configuration() {
#
# Parameters:
# 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.
# luks=[true|false] Encrypt root partition. Defaults to true if not given.
# root_fs=[ext4|btrfs] Root filesystem. Defaults to ext4 if not given.
# root_fs=[ext4|btrfs] Root filesystem
# 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}
# 4. create_raid1_luks_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
# 4. create_btrfs_centric_layout
#
# 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.
@ -102,7 +85,7 @@ function disk_configuration() {
#
# Parameters:
# 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.
# luks=[true|false] Encrypt root partition and btrfs devices. Defaults
# to false if not given.
@ -188,7 +171,8 @@ function disk_configuration() {
HOSTNAME="gentoo"
# The timezone for the new system
TIMEZONE="Atlantic/Azores"
TIMEZONE="Europe/London"
#TIMEZONE="Europe/Berlin"
# The default keymap for the system
KEYMAP="us"
@ -199,48 +183,29 @@ KEYMAP_INITRAMFS="$KEYMAP"
# A list of additional locales to generate. You should only
# 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
# locale. For a list of supported locales, see the file /usr/share/i18n/SUPPORTED.
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.
# 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.UTF-8"
# For a PT system you could use:
LOCALE="C.utf8"
# For a german system you could use:
# LOCALES="
# pt_PT.UTF-8 UTF-8
# pt_PT ISO-8859-1
# pt_PT@euro ISO-8859-15
# de_DE.UTF-8 UTF-8
# de_DE ISO-8859-1
# de_DE@euro ISO-8859-15
# " # End of LOCALES
# LOCALE="pt_PT.UTF-8"
################################################
# 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
# LOCALE="de_DE.utf8"
################################################
# Gentoo configuration
# 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.
SYSTEMD=true
# Choose whether to download the portage tree via git or rsync.
# Git syncing is significantly faster, and generally preferred for new installations.
PORTAGE_SYNC_TYPE="git"
@ -257,22 +222,13 @@ GENTOO_MIRROR="https://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo
# The architecture of the target system (only tested with amd64)
GENTOO_ARCH="amd64"
# The stage3 tarball variant to use. Determines whether systemd
# or OpenRC is used based on whether "systemd" is contained in this string.
STAGE3_VARIANT="systemd"
# The stage3 tarball to download and bootstrap
STAGE3_BASENAME="stage3-$GENTOO_ARCH-$STAGE3_VARIANT"
# 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.
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")
# The stage3 tarball to install
STAGE3_BASENAME="stage3-$GENTOO_ARCH-systemd"
#STAGE3_BASENAME="stage3-$GENTOO_ARCH-openrc"
#STAGE3_BASENAME="stage3-$GENTOO_ARCH-desktop-systemd"
#STAGE3_BASENAME="stage3-$GENTOO_ARCH-desktop-openrc"
# If set to true, the installer will add ACCEPT_KEYWORDS="~$GENTOO_ARCH"
# to /etc/portage/make.conf to enable packages in testing.
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
SELECT_MIRRORS=true
@ -291,10 +247,7 @@ ADDITIONAL_PACKAGES=()
# Install and configure sshd (a reasonably secure config is provided, which
# only allows the use of ed25519 keys, and requires pubkey authentication)
ENABLE_SSHD=true
# Enable binary portage packages where available
ENABLE_BINPKG=false
INSTALL_SSHD=true
# 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,
@ -308,76 +261,3 @@ ROOT_SSH_AUTHORIZED_KEYS=""
# To prove that you have read and edited the config
# properly, set the following value to true.
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

@ -96,7 +96,7 @@ while [[ $# -gt 0 ]]; do
done
# Check configuration location
[[ -z "${CONFIG%%"$GENTOO_INSTALL_REPO_DIR"*}" ]] \
[[ -z "${CONFIG%%$GENTOO_INSTALL_REPO_DIR*}" ]] \
|| die "Configuration file must be inside the installation directory. This is needed so it is accessible from within the chroot environment."
if [[ -z "$ACTION" ]]; then
@ -104,8 +104,7 @@ if [[ -z "$ACTION" ]]; then
# Default if configuration exists: Run installer
ACTION="install"
else
# Default if configuration does not exist: Run configurator, and exit afterwards.
echo "You have not created a gentoo.conf. Starting configurator instead of installing."
# Default if configuration does not exists: Run configurator, and exit afterwards.
exec "$GENTOO_INSTALL_REPO_DIR/configure" "$CONFIG"
fi
fi

View File

@ -27,8 +27,6 @@ USED_ZFS=false
USED_BTRFS=false
# Flag to track usage of encryption
USED_ENCRYPTION=false
# Flag to track whether partitioning or formatting is forbidden
NO_PARTITIONING_OR_FORMATTING=false
# An array of disk related actions to perform
DISK_ACTIONS=()
@ -106,21 +104,6 @@ function verify_option() {
die_trace 2 "Invalid option $opt='$arg', must be one of ($*)"
}
# Named arguments:
# new_id: Id for the existing device
# device: The block device
function register_existing() {
local known_arguments=('+new_id' '+device')
local extra_arguments=()
declare -A arguments; parse_arguments "$@"
create_new_id new_id
local new_id="${arguments[new_id]}"
local device="${arguments[device]}"
create_resolve_entry_device "$new_id" "$device"
DISK_ACTIONS+=("action=existing" "$@" ";")
}
# Named arguments:
# new_id: Id for the new gpt table
# device|id: The operand block device or previously allocated id
@ -293,10 +276,10 @@ function expand_ids() {
# Single disk, 3 partitions (efi, swap, root)
# 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.
# 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() {
local known_arguments=('+swap' '?type' '?luks' '?root_fs')
local extra_arguments=()
@ -311,7 +294,7 @@ function create_classic_single_disk_layout() {
local root_fs="${arguments[root_fs]:-ext4}"
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=256MiB type="$type"
[[ $size_swap != "false" ]] \
&& 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
@ -351,45 +334,10 @@ function create_single_disk_layout() {
die "'create_single_disk_layout' is deprecated, please use 'create_classic_single_disk_layout' instead. It is fully option-compatible to the old version."
}
# Skip partitioning, and use existing pre-formatted partitions. These must be trivially mountable.
# Parameters:
# 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.
# type=[efi|bios] Selects the boot type. Defaults to efi if not given.
function create_existing_partitions_layout() {
NO_PARTITIONING_OR_FORMATTING=true
local known_arguments=('+swap' '+boot' '?type')
local extra_arguments=()
declare -A arguments; parse_arguments "$@"
[[ ${#extra_arguments[@]} -eq 1 ]] \
|| die_trace 1 "Expected exactly one positional argument (the device)"
local device="${extra_arguments[0]}"
local swap_device="${arguments[swap]}"
local boot_device="${arguments[boot]}"
local type="${arguments[type]:-efi}"
register_existing new_id="part_$type" device="$boot_device"
[[ $swap_device != "false" ]] \
&& register_existing new_id="part_swap" device="$swap_device"
register_existing new_id="part_root" device="$device"
if [[ $type == "efi" ]]; then
DISK_ID_EFI="part_$type"
else
DISK_ID_BIOS="part_$type"
fi
[[ $swap_device != "false" ]] \
&& DISK_ID_SWAP=part_swap
DISK_ID_ROOT="part_root"
DISK_ID_ROOT_TYPE="" # unknown, could be anything. Left empty to skip generating an fstab entry.
}
# Multiple disks, up to 3 partitions on first disk (efi, optional swap, root with zfs).
# Additional devices will be added to the zfs pool.
# 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.
# encrypt=[true|false] Encrypt zfs pool. Defaults to false if not given.
# pool_type=[stripe|mirror] Select raid type. Defaults to stripe.
@ -408,7 +356,7 @@ function create_zfs_centric_layout() {
# Create layout on first disk
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=256MiB type="$type"
[[ $size_swap != "false" ]] \
&& 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
@ -444,12 +392,11 @@ function create_zfs_centric_layout() {
# - swap: raid 0 → fs
# - root: raid 0 → luks → fs
# 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.
# luks=[true|false] Encrypt root partition. Defaults to true if not given.
# root_fs=[ext4|btrfs] Root filesystem. Defaults to ext4 if not given.
# root_fs=[ext4|btrfs] Root filesystem
function create_raid0_luks_layout() {
local known_arguments=('+swap' '?type' '?luks' '?root_fs')
local known_arguments=('+swap' '?type' '?root_fs')
local extra_arguments=()
declare -A arguments; parse_arguments "$@"
@ -457,12 +404,11 @@ function create_raid0_luks_layout() {
|| 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"
create_partition new_id="part_${type}_dev${i}" id="gpt_dev${i}" size=256MiB 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
@ -471,17 +417,12 @@ function create_raid0_luks_layout() {
[[ $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_root name="root" level=0 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
create_luks new_id=part_luks_root name="root" id=part_raid_root
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
format id=part_luks_root type="$root_fs" label=root
if [[ $type == "efi" ]]; then
DISK_ID_EFI="part_${type}_dev0"
@ -490,76 +431,12 @@ function create_raid0_luks_layout() {
fi
[[ $size_swap != "false" ]] \
&& DISK_ID_SWAP=part_raid_swap
DISK_ID_ROOT="$root_id"
DISK_ID_ROOT=part_luks_root
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_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
elif [[ $root_fs == "btrfs" ]]; then
DISK_ID_ROOT_TYPE="ext4"
DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,errors=remount-ro,discard"
else
@ -570,7 +447,7 @@ function create_raid1_luks_layout() {
# 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.
# 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.
# 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.
@ -589,7 +466,7 @@ function create_btrfs_centric_layout() {
# Create layout on first disk
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=256MiB type="$type"
[[ $size_swap != "false" ]] \
&& 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

View File

@ -64,40 +64,35 @@ function preprocess_config() {
}
function prepare_installation_environment() {
maybe_exec 'before_prepare_environment'
einfo "Preparing installation environment"
local wanted_programs=(
local needed_programs=(
gpg
hwclock
lsblk
ntpd
partprobe
python3
"?rhash"
sha512sum
rhash
sgdisk
uuidgen
wget
)
[[ $USED_BTRFS == "true" ]] \
&& wanted_programs+=(btrfs)
&& needed_programs+=(btrfs)
[[ $USED_ZFS == "true" ]] \
&& wanted_programs+=(zfs)
&& needed_programs+=(zfs)
[[ $USED_RAID == "true" ]] \
&& wanted_programs+=(mdadm)
&& needed_programs+=(mdadm)
[[ $USED_LUKS == "true" ]] \
&& wanted_programs+=(cryptsetup)
&& needed_programs+=(cryptsetup)
# Check for existence of required programs
check_wanted_programs "${wanted_programs[@]}"
check_has_programs "${needed_programs[@]}"
# Sync time now to prevent issues later
sync_time
maybe_exec 'after_prepare_environment'
}
function check_encryption_key() {
@ -168,14 +163,6 @@ function summary_color_args() {
done
}
function disk_existing() {
local new_id="${arguments[new_id]}"
if [[ ${disk_action_summarize_only-false} == "true" ]]; then
add_summary_entry __root__ "$new_id" "${arguments[device]}" "(no-format, existing)" ""
fi
# no-op;
}
function disk_create_gpt() {
local new_id="${arguments[new_id]}"
if [[ ${disk_action_summarize_only-false} == "true" ]]; then
@ -243,18 +230,6 @@ function disk_create_partition() {
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)"
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() {
@ -291,19 +266,12 @@ function disk_create_raid() {
local mddevice="/dev/md/$name"
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"
mdadm \
--create "$mddevice" \
--verbose \
--homehost="$HOSTNAME" \
"${extra_args[@]}" \
--metadata=1.2 \
--raid-devices="${#devices[@]}" \
--uuid="$uuid" \
--level="$level" \
@ -422,9 +390,6 @@ function disk_format() {
mkswap "$device" \
|| die "Could not format device '$device' ($id)"
fi
# Try to swapoff in case the system enabled swap automatically
swapoff "$device" &>/dev/null
;;
'ext4')
if [[ -v "arguments[label]" ]]; then
@ -465,6 +430,12 @@ function format_zfs_standard() {
einfo "Creating zfs pool on $devices_desc"
if [[ "$compress" != false ]]; then
extra_args+=(
"-O" "compression=$compress"
)
fi
local zfs_stdin=""
if [[ "$encrypt" == true ]]; then
extra_args+=(
@ -493,10 +464,6 @@ function format_zfs_standard() {
<<< "$zfs_stdin" \
|| 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 \
|| die "Could not create zfs dataset 'rpool/ROOT'"
zfs create -o mountpoint=/ rpool/ROOT/default \
@ -596,7 +563,6 @@ function apply_disk_action() {
unset known_arguments
unset arguments; declare -A arguments; parse_arguments "$@"
case "${arguments[action]}" in
'existing') disk_existing ;;
'create_gpt') disk_create_gpt ;;
'create_partition') disk_create_partition ;;
'create_raid') disk_create_raid ;;
@ -732,22 +698,10 @@ function summarize_disk_actions() {
function apply_disk_configuration() {
summarize_disk_actions
if [[ $NO_PARTITIONING_OR_FORMATTING == true ]]; then
elog "You have chosen an existing disk configuration. No devices will"
elog "actually be re-partitioned or formatted. Please make sure that all"
elog "devices are already formatted."
else
ewarn "Please ensure that all selected devices are fully unmounted and are"
ewarn "not otherwise in use by the system. This includes stopping mdadm arrays"
ewarn "and closing opened luks volumes if applicable for all relevant devices."
ewarn "Otherwise, automatic partitioning may fail."
fi
ask "Do you really want to apply this disk configuration?" \
|| die "Aborted"
countdown "Applying in " 5
maybe_exec 'before_disk_configuration'
einfo "Applying disk configuration"
apply_disk_actions
@ -755,8 +709,6 @@ function apply_disk_configuration() {
elog "New lsblk output:"
for_line_in <(lsblk \
|| die "Error in lsblk") elog
maybe_exec 'after_disk_configuration'
}
function mount_efivars() {
@ -818,7 +770,7 @@ function download_stage3() {
cd "$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
CURRENT_STAGE3="$(download_stdout "$STAGE3_RELEASES")" \
@ -834,15 +786,13 @@ function download_stage3() {
# File to indiciate successful verification
CURRENT_STAGE3_VERIFIED="${CURRENT_STAGE3}.verified"
maybe_exec 'before_download_stage3' "$STAGE3_BASENAME"
# Download file if not already downloaded
if [[ -e $CURRENT_STAGE3_VERIFIED ]]; then
einfo "$STAGE3_BASENAME tarball already downloaded and verified"
else
einfo "Downloading $STAGE3_BASENAME tarball"
download "$STAGE3_RELEASES/${CURRENT_STAGE3}" "${CURRENT_STAGE3}"
download "$STAGE3_RELEASES/${CURRENT_STAGE3}.DIGESTS" "${CURRENT_STAGE3}.DIGESTS"
download "$STAGE3_RELEASES/${CURRENT_STAGE3}.DIGESTS.asc" "${CURRENT_STAGE3}.DIGESTS.asc"
# Import gentoo keys
einfo "Importing gentoo gpg key"
@ -853,27 +803,19 @@ function download_stage3() {
|| die "Could not import gentoo gpg key"
# Verify DIGESTS signature
einfo "Verifying tarball signature"
gpg --quiet --verify "${CURRENT_STAGE3}.DIGESTS" \
|| die "Signature of '${CURRENT_STAGE3}.DIGESTS' invalid!"
einfo "Verifying DIGEST.asc signature"
gpg --quiet --verify "${CURRENT_STAGE3}.DIGESTS.asc" \
|| die "Signature of '${CURRENT_STAGE3}.DIGESTS.asc' invalid!"
# Check hashes
einfo "Verifying tarball integrity"
# Replace any absolute paths in the digest file with just the stage3 basename, so it will be found by rhash
digest_line=$(grep 'tar.xz$' "${CURRENT_STAGE3}.DIGESTS" | sed -e 's/ .*stage3-/ stage3-/')
if type rhash &>/dev/null; then
rhash -P --check <(echo "# SHA512"; echo "$digest_line") \
|| die "Checksum mismatch!"
else
sha512sum --check <<< "$digest_line" \
|| die "Checksum mismatch!"
fi
rhash -P --check <(grep -B 1 'tar.xz$' "${CURRENT_STAGE3}.DIGESTS.asc" | sed -e 's/ .*stage3-/ stage3-/') \
|| die "Checksum mismatch!"
# Create verification file in case the script is restarted
touch_or_die 0644 "$CURRENT_STAGE3_VERIFIED"
fi
maybe_exec 'after_download_stage3' "${CURRENT_STAGE3}"
}
function extract_stage3() {
@ -884,8 +826,6 @@ function extract_stage3() {
[[ -e "$TMP_DIR/$CURRENT_STAGE3" ]] \
|| die "stage3 file does not exist"
maybe_exec 'before_extract_stage3' "$TMP_DIR/$CURRENT_STAGE3" "$ROOT_MOUNTPOINT"
# Go to root directory
cd "$ROOT_MOUNTPOINT" \
|| die "Could not move to '$ROOT_MOUNTPOINT'"
@ -900,8 +840,6 @@ function extract_stage3() {
|| die "Error while extracting tarball"
cd "$TMP_DIR" \
|| die "Could not cd into '$TMP_DIR'"
maybe_exec 'after_extract_stage3' "$TMP_DIR/$CURRENT_STAGE3" "$ROOT_MOUNTPOINT"
}
function gentoo_umount() {
@ -964,12 +902,7 @@ function gentoo_chroot() {
einfo "Mounting virtual filesystems"
(
mountpoint -q -- "$chroot_dir/proc" || mount -t proc /proc "$chroot_dir/proc" || exit 1
mountpoint -q -- "$chroot_dir/run" || {
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/tmp" || mount --rbind /tmp "$chroot_dir/tmp" || exit 1
mountpoint -q -- "$chroot_dir/sys" || {
mount --rbind /sys "$chroot_dir/sys" &&
mount --make-rslave "$chroot_dir/sys"; } || exit 1
@ -992,8 +925,10 @@ function gentoo_chroot() {
function enable_service() {
if [[ $SYSTEMD == "true" ]]; then
try systemctl enable "$1"
systemctl enable "$1" \
|| die "Could not enable $1 service"
else
try rc-update add "$1" default
rc-update add "$1" default \
|| die "Could not add $1 to default services"
fi
}

View File

@ -6,6 +6,8 @@ source "$GENTOO_INSTALL_REPO_DIR/scripts/protection.sh" || exit 1
# Functions
function install_stage3() {
[[ $# == 0 ]] || die "Too many arguments"
prepare_installation_environment
apply_disk_configuration
download_stage3
@ -13,19 +15,11 @@ function install_stage3() {
}
function configure_base_system() {
if [[ $MUSL == "true" ]]; then
einfo "Installing musl-locales"
if [[ $USE_PORTAGE_TESTING == "false" ]]; then
echo "sys-apps/musl-locales" >> /etc/portage/package.accept_keywords/musl-locales
fi
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
einfo "Generating locales"
echo "$LOCALES" > /etc/locale.gen \
|| die "Could not write /etc/locale.gen"
locale-gen \
|| die "Could not generate locales"
if [[ $SYSTEMD == "true" ]]; then
einfo "Setting machine-id"
@ -57,19 +51,10 @@ function configure_base_system() {
|| die "Could not sed replace in /etc/conf.d/hostname"
# Set timezone
if [[ $MUSL == "true" ]]; then
try emerge -v sys-libs/timezone-data
einfo "Selecting timezone"
echo -e "\nTZ=\"$TIMEZONE\"" >> /etc/env.d/00musl \
|| 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
einfo "Selecting timezone"
echo "$TIMEZONE" > /etc/timezone \
|| die "Could not write /etc/timezone"
try emerge -v --config sys-libs/timezone-data
# Set keymap
einfo "Selecting keymap"
@ -91,7 +76,6 @@ function configure_portage() {
touch_or_die 0644 "/etc/portage/package.use/zz-autounmask"
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.license"
if [[ $SELECT_MIRRORS == "true" ]]; then
einfo "Temporarily installing mirrorselect"
@ -102,33 +86,26 @@ function configure_portage() {
[[ $SELECT_MIRRORS_LARGE_FILE == "true" ]] \
&& mirrorselect_params+=("-D")
try mirrorselect "${mirrorselect_params[@]}"
fi
if [[ $ENABLE_BINPKG == "true" ]]; then
echo 'FEATURES="getbinpkg"' >> /etc/portage/make.conf
getuto
chmod 644 /etc/portage/gnupg/pubring.kbx
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
chmod 644 /etc/portage/make.conf \
|| die "Could not chmod 644 /etc/portage/make.conf"
}
function enable_sshd() {
einfo "Installing and enabling sshd"
function install_sshd() {
einfo "Installing sshd"
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"
enable_service sshd
}
function install_authorized_keys() {
mkdir_or_die 0700 "/root/"
mkdir_or_die 0700 "/root/.ssh"
if [[ -n "$ROOT_SSH_AUTHORIZED_KEYS" ]]; then
einfo "Adding authorized keys for root"
touch_or_die 0600 "/root/.ssh/authorized_keys"
echo "$ROOT_SSH_AUTHORIZED_KEYS" > "/root/.ssh/authorized_keys" \
echo "$ROOT_SSH_AUTHORIZED_KEYS" > "$ROOT_HOME/.ssh/authorized_keys" \
|| die "Could not add ssh key to /root/.ssh/authorized_keys"
fi
}
@ -154,48 +131,17 @@ function generate_initramfs() {
|| die "Could not figure out kernel version from /usr/src/linux symlink."
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
# TODO --conf "/dev/null" \
# TODO --confdir "/dev/null" \
try dracut \
--conf "/dev/null" \
--confdir "/dev/null" \
--kver "$kver" \
--zstd \
--no-compress \
--no-hostonly \
--ro-mnt \
--add "bash ${modules[*]}" \
"${dracut_opts[@]}" \
--force \
"$output"
# Create script to repeat initramfs generation
cat > "$(dirname "$output")/generate_initramfs.sh" <<EOF
#!/bin/bash
kver="\$1"
output="\$2" # At setup time, this was "$output"
[[ -n "\$kver" ]] || { echo "usage \$0 <kernel_version> <output>" >&2; exit 1; }
dracut \\
--kver "\$kver" \\
--zstd \\
--no-hostonly \\
--ro-mnt \\
--add "bash ${modules[*]}" \\
${dracut_opts[@]@Q} \\
--force \\
"\$output"
EOF
}
function get_cmdline() {
@ -214,13 +160,15 @@ function install_kernel_efi() {
# Copy kernel to EFI
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"
try cp "/boot/$kernel_file" "/boot/efi/vmlinuz.efi"
mkdir_or_die 0755 "/boot/efi/EFI"
cp "/boot/$kernel_file" "/boot/efi/EFI/vmlinuz.efi" \
|| die "Could not copy kernel to EFI partition"
# Generate initramfs
generate_initramfs "/boot/efi/initramfs.img"
generate_initramfs "/boot/efi/EFI/initramfs.img"
# Create boot entry
einfo "Creating efi boot entry"
@ -229,28 +177,11 @@ function install_kernel_efi() {
|| die "Could not resolve device with id=$DISK_ID_EFI"
efipartdev="$(realpath "$efipartdev")" \
|| die "Error in realpath '$efipartdev'"
local sys_efipart
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 efipartnum="${efipartdev: -1}"
local gptdev
gptdev="/dev/$(basename "$(readlink -f "$sys_efipart/..")")" \
|| die "Failed to find parent device for EFI partition $efipartdev"
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)"
# Create script to repeat adding efibootmgr entry
cat > "/boot/efi/efibootmgr_add_entry.sh" <<EOF
#!/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)"
EOF
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]}"
try efibootmgr --verbose --create --disk "$gptdev" --part "$efipartnum" --label "gentoo" --loader '\EFI\vmlinuz.efi' --unicode 'initrd=\EFI\initramfs.img'" $(get_cmdline)"
}
function generate_syslinux_cfg() {
@ -270,10 +201,11 @@ function install_kernel_bios() {
# Link kernel to known name
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"
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 "/boot/bios/initramfs.img"
@ -301,17 +233,13 @@ function install_kernel_bios() {
function install_kernel() {
# Install vanilla kernel
einfo "Installing vanilla kernel and related tools"
try emerge --verbose sys-kernel/dracut sys-kernel/gentoo-kernel-bin
if [[ $IS_EFI == "true" ]]; then
install_kernel_efi
else
install_kernel_bios
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() {
@ -323,7 +251,7 @@ function generate_fstab() {
einfo "Generating fstab"
install -m0644 -o root -g root "$GENTOO_INSTALL_REPO_DIR/contrib/fstab" /etc/fstab \
|| die "Could not overwrite /etc/fstab"
if [[ $USED_ZFS != "true" && -n $DISK_ID_ROOT_TYPE ]]; then
if [[ $USED_ZFS != "true" ]]; then
add_fstab_entry "UUID=$(get_blkid_uuid_for_id "$DISK_ID_ROOT")" "/" "$DISK_ID_ROOT_TYPE" "$DISK_ID_ROOT_MOUNT_OPTS" "0 1"
fi
if [[ $IS_EFI == "true" ]]; then
@ -339,8 +267,6 @@ function generate_fstab() {
function main_install_gentoo_in_chroot() {
[[ $# == 0 ]] || die "Too many arguments"
maybe_exec 'before_install'
# Remove the root password, making the account accessible for automated
# tasks during the period of installation.
einfo "Clearing root password"
@ -363,12 +289,9 @@ function main_install_gentoo_in_chroot() {
try emerge-webrsync
# Configure basic system things like timezone, locale, ...
maybe_exec 'before_configure_base_system'
configure_base_system
maybe_exec 'after_configure_base_system'
# Prepare portage environment
maybe_exec 'before_configure_portage'
configure_portage
# Install git (for git portage overlays)
@ -396,21 +319,6 @@ EOF
|| die "Could not delete obsolete rsync gentoo repository"
try emerge --sync
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)
if [[ $USED_RAID == "true" ]]; then
@ -424,22 +332,12 @@ EOF
try emerge --verbose sys-fs/cryptsetup
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
if [[ $USED_BTRFS == "true" ]]; then
einfo "Installing btrfs-progs"
try emerge --verbose sys-fs/btrfs-progs
fi
try emerge --verbose dev-vcs/git
# Install zfs kernel module and tools if we used zfs
if [[ $USED_ZFS == "true" ]]; then
einfo "Installing zfs"
@ -447,20 +345,18 @@ EOF
einfo "Enabling zfs services"
if [[ $SYSTEMD == "true" ]]; then
try systemctl enable zfs.target
try systemctl enable zfs-import-cache
try systemctl enable zfs-mount
try systemctl enable zfs-import.target
systemctl enable zfs.target || die "Could not enable zfs.target service"
systemctl enable zfs-import-cache || die "Could not enable zfs-import-cache service"
systemctl enable zfs-mount || die "Could not enable zfs-mount service"
systemctl enable zfs-import.target || die "Could not enable zfs-import.target service"
else
try rc-update add zfs-import boot
try rc-update add zfs-mount boot
rc-update add zfs-import boot || die "Could not add zfs-import to boot services"
rc-update add zfs-mount boot || die "Could not add zfs-mount to boot services"
fi
fi
# Install kernel and initramfs
maybe_exec 'before_install_kernel'
install_kernel
maybe_exec 'after_install_kernel'
# Generate a valid fstab file
generate_fstab
@ -469,28 +365,12 @@ EOF
einfo "Installing gentoolkit"
try emerge --verbose app-portage/gentoolkit
if [[ $SYSTEMD == "true" ]]; then
if [[ $SYSTEMD_NETWORKD == "true" ]]; then
# Enable systemd networking and dhcp
enable_service systemd-networkd
enable_service systemd-resolved
if [[ $SYSTEMD_NETWORKD_DHCP == "true" ]]; then
echo -en "[Match]\nName=${SYSTEMD_NETWORKD_INTERFACE_NAME}\n\n[Network]\nDHCP=yes" > /etc/systemd/network/20-wired.network \
|| die "Could not write dhcp network config to '/etc/systemd/network/20-wired.network'"
else
addresses=""
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
# Install and enable sshd
if [[ $INSTALL_SSHD == "true" ]]; then
install_sshd
fi
if [[ $SYSTEMD != "true" ]]; then
# Install and enable dhcpcd
einfo "Installing dhcpcd"
try emerge --verbose net-misc/dhcpcd
@ -498,8 +378,16 @@ EOF
enable_service dhcpcd
fi
if [[ $ENABLE_SSHD == "true" ]]; then
enable_sshd
if [[ $SYSTEMD == "true" ]]; then
# Enable systemd networking and dhcp
enable_service systemd-networkd
enable_service systemd-resolved
echo -en "[Match]\nName=en*\n\n[Network]\nDHCP=yes" > /etc/systemd/network/20-wired-dhcp.network \
|| die "Could not write dhcp network config to '/etc/systemd/network/20-wired-dhcp.network'"
chown root:systemd-network /etc/systemd/network/20-wired-dhcp.network \
|| die "Could not change owner of '/etc/systemd/network/20-wired-dhcp.network'"
chmod 640 /etc/systemd/network/20-wired-dhcp.network \
|| die "Could not change permissions of '/etc/systemd/network/20-wired-dhcp.network'"
fi
# Install additional packages, if any.
@ -517,22 +405,10 @@ EOF
ewarn "Root password cleared, set one as soon as possible!"
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."
[[ $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 "You may now reboot your system or execute ./install --chroot $ROOT_MOUNTPOINT to enter your system in a chroot."
einfo "Chrooting in this way is always possible in case you need to fix something after rebooting."
einfo "You may now reboot your system."
}
function main_install() {

View File

@ -19,8 +19,8 @@ function eerror() {
function die() {
eerror "$*"
[[ -v GENTOO_INSTALL_REPO_SCRIPT_PID && $$ -ne $GENTOO_INSTALL_REPO_SCRIPT_PID ]] \
&& kill "$GENTOO_INSTALL_REPO_SCRIPT_PID"
[[ $$ == "$GENTOO_INSTALL_REPO_SCRIPT_PID" ]] \
|| kill "$GENTOO_INSTALL_REPO_SCRIPT_PID"
exit 1
}
@ -239,25 +239,6 @@ function create_resolve_entry_device() {
DISK_ID_TO_RESOLVABLE[$id]="device:$dev"
}
# Returns the basename of the device, if its path starts with /dev/disk/by-id/
function shorten_device() {
echo -n "${1#/dev/disk/by-id/}"
}
# Return matching device from /dev/disk/by-id/ if possible,
# otherwise return the parameter unchanged.
function canonicalize_device() {
given_dev="$(realpath "$1")"
for dev in /dev/disk/by-id/*; do
if [[ "$(realpath "$dev")" == "$given_dev" ]]; then
echo -n "$dev"
return 0
fi
done
echo -n "$1"
}
function resolve_device_by_id() {
local id="$1"
[[ -v DISK_ID_TO_RESOLVABLE[$id] ]] \
@ -266,18 +247,15 @@ function resolve_device_by_id() {
local type="${DISK_ID_TO_RESOLVABLE[$id]%%:*}"
local arg="${DISK_ID_TO_RESOLVABLE[$id]#*:}"
local dev
case "$type" in
'partuuid') dev=$(get_device_by_partuuid "$arg") ;;
'ptuuid') dev=$(get_device_by_ptuuid "$arg") ;;
'uuid') dev=$(get_device_by_uuid "$arg") ;;
'mdadm') dev=$(get_device_by_mdadm_uuid "$arg") ;;
'luks') dev=$(get_device_by_luks_name "$arg") ;;
'device') dev="$arg" ;;
'partuuid') get_device_by_partuuid "$arg" ;;
'ptuuid') get_device_by_ptuuid "$arg" ;;
'uuid') get_device_by_uuid "$arg" ;;
'mdadm') get_device_by_mdadm_uuid "$arg" ;;
'luks') get_device_by_luks_name "$arg" ;;
'device') echo -n "$arg" ;;
*) die "Cannot resolve '$type:$arg' to device (unknown type)"
esac
canonicalize_device "$dev"
}
function load_or_generate_uuid() {
@ -351,55 +329,31 @@ function parse_arguments() {
fi
}
# $1: program
# $2: checkfile
function has_program() {
local program="$1"
local checkfile="$2"
if [[ -z "$checkfile" ]]; then
type "$program" &>/dev/null \
|| return 1
elif [[ "${checkfile:0:1}" == "/" ]]; then
[[ -e "$checkfile" ]] \
|| return 1
else
type "$checkfile" &>/dev/null \
|| return 1
fi
return 0
}
function check_wanted_programs() {
local missing_required=()
local missing_wanted=()
function check_has_programs() {
local failed=()
local tuple
local program
local checkfile
for tuple in "$@"; do
program="${tuple%%=*}"
checkfile=""
[[ "$tuple" == *=* ]] \
&& checkfile="${tuple##*=}"
if ! has_program "${program#"?"}" "$checkfile"; then
if [[ "$program" == "?"* ]]; then
missing_wanted+=("${program#"?"}")
else
missing_required+=("$program")
fi
checkfile="${tuple##*=}"
if [[ -z "$checkfile" ]]; then
type "$program" &>/dev/null \
|| failed+=("$program")
elif [[ "${checkfile:0:1}" == "/" ]]; then
[[ -e "$checkfile" ]] \
|| failed+=("$program")
else
type "$checkfile" &>/dev/null \
|| failed+=("$program")
fi
done
[[ "${#missing_required[@]}" -eq 0 && "${#missing_wanted[@]}" -eq 0 ]] \
[[ "${#failed[@]}" -eq 0 ]] \
&& return
if [[ "${#missing_required[@]}" -gt 0 ]]; then
elog "The following programs are required for the installer to work, but are currently missing on your system:" >&2
elog " ${missing_required[*]}" >&2
fi
if [[ "${#missing_wanted[@]}" -gt 0 ]]; then
elog "Missing optional programs:" >&2
elog " ${missing_wanted[*]}" >&2
fi
elog "The following programs are required for the installer to work, but are currently missing on your system:" >&2
elog " ${failed[*]}" >&2
if type pacman &>/dev/null; then
declare -A pacman_packages
@ -407,18 +361,18 @@ function check_wanted_programs() {
[ntpd]=ntp
[zfs]=""
)
elog "Detected pacman package manager."
if ask "Do you want to install all missing programs automatically?"; then
elog "We have detected that pacman is available."
if ask "Do you want to install the missing programs automatically?"; then
local packages
local need_zfs=false
for program in "${missing_required[@]}" "${missing_wanted[@]}"; do
for program in "${failed[@]}"; do
[[ "$program" == "zfs" ]] \
&& need_zfs=true
if [[ -v "pacman_packages[$program]" ]]; then
# Assignments to the empty string are explicitly ignored,
# as for example, zfs needs to be handled separately.
# Assignments to the empty string are explcitly ignored,
# as for example zfs needs to be handeled separately.
[[ -n "${pacman_packages[$program]}" ]] \
&& packages+=("${pacman_packages[$program]}")
else
@ -429,9 +383,9 @@ function check_wanted_programs() {
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 "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
curl -s "https://raw.githubusercontent.com/eoli3n/archiso-zfs/master/init" | bash
curl -s "https://eoli3n.github.io/archzfs/init" | bash
fi
fi
@ -439,15 +393,5 @@ function check_wanted_programs() {
fi
fi
if [[ "${#missing_required[@]}" -gt 0 ]]; then
die "Aborted installer because of missing required programs."
else
ask "Continue without recommended programs?"
fi
}
# exec function if defined
# $@ function name and arguments
function maybe_exec() {
type "$1" &>/dev/null && "$@"
die "Aborted installer because of missing required programs."
}