diff --git a/scripts/config.sh b/scripts/config.sh index 6726da4..05938a0 100644 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -8,11 +8,9 @@ source "$GENTOO_BOOTSTRAP_DIR/scripts/internal_config.sh" || exit 1 # Disk configuration # Enable swap? -ENABLE_SWAP=false - +ENABLE_SWAP=true # Enable partitioning (will still ask before doing anything critical) ENABLE_PARTITIONING=true - # Format the partitions with the correct filesystems, # if you didn't chose automatic partitioning, you will be asked # before any formatting is done. diff --git a/scripts/functions.sh b/scripts/functions.sh index 7167104..2de186a 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -153,6 +153,16 @@ format_partitions() { || die "Could not create ext4 filesystem" } +mount_efivars() { + # Skip if already mounted + mountpoint -q -- "/sys/firmware/efi/efivars" \ + && return + + # Mount efivars + einfo "Mounting efivars" + mount -t efivarfs efivarfs "/sys/firmware/efi/efivars" +} + mount_by_partuuid() { local dev local partuuid="$1" diff --git a/scripts/main.sh b/scripts/main.sh index 4e77bca..4f64717 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -56,7 +56,8 @@ main_install_gentoo_in_chroot() { || die "Could not change root password" # Mount efi partition - einfo "Mounting efi" + mount_efivars + einfo "Mounting efi partition" mount_by_partuuid "$PARTITION_UUID_EFI" "/boot/efi" # Sync portage @@ -107,7 +108,7 @@ main_install_gentoo_in_chroot() { # Copy kernel to EFI local kernel_version - kernel_version="$(find "/boot" -name "vmlinuz-*" | sort -V | tail -1)" \ + kernel_version="$(find "/boot" -name "vmlinuz-*" -printf '%f\n' | sort -V | tail -1)" \ || die "Could not list newest kernel file" kernel_version="${kernel_version#vmlinuz-}" \ || die "Could not find kernel version" @@ -127,8 +128,7 @@ main_install_gentoo_in_chroot() { efidev="$(get_device_by_partuuid "$PARTITION_UUID_EFI")" \ || die "Could not resolve partition UUID '$PARTITION_UUID_EFI'" local efipartnum="${efidev: -1}" - efibootmgr --verbose --create --disk "$PARTITION_DEVICE" --part "$efipartnum" --label "gentoo" --loader '\EFI\vmlinuz.efi' --unicode "root=$linuxdev initrd=initramfs.img" \ - || die "Could not add efi boot entry" + try efibootmgr --verbose --create --disk "$PARTITION_DEVICE" --part "$efipartnum" --label "gentoo" --loader '\EFI\vmlinuz.efi' --unicode "root=$linuxdev initrd=initramfs.img" # Install additional packages, if any. if [[ -n "$ADDITIONAL_PACKAGES" ]]; then @@ -202,7 +202,9 @@ main_install() { gentoo_umount install_stage3 + mount_efivars gentoo_chroot "$GENTOO_BOOTSTRAP_BIND/scripts/main.sh" install_gentoo_in_chroot + gentoo_umount } main_chroot() {