From 0b033e852cb9b5406004e3ccd1181a55494cf5c8 Mon Sep 17 00:00:00 2001 From: "Jean (east-high-Nerd)" Date: Wed, 5 Nov 2025 12:18:37 -0500 Subject: [PATCH] Move EFI related commands/tasks into dedicated script --- README.md | 2 +- efi.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ install.sh | 50 +++++--------------------------------------- 3 files changed, 67 insertions(+), 46 deletions(-) create mode 100644 efi.sh diff --git a/README.md b/README.md index f657e48..e7e3173 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The purpose of this branch is to modularize as many functions of the scripts as [ ] Move (at least almost) all Fedora related commands and tasks to `fedora.sh` [ ] Move (at least almost) all elementary OS related commands and tasks to `elementary.sh` [ ] Rename flags in all distro specific scripts from numbered (i.e. `-1`, `-2`) to descriptive (i.e. `--mmdebstrap`, `--network-interfaces`) -[ ] Move all EFI related commands and tasks to a new `efi.sh` script +[X] Move all EFI related commands and tasks to a new `efi.sh` script [X] Rename `mkfs.zfs.sh` to `zfs.sh` [ ] Point any distro-specific commands/tasks that are shared with Debian to use `debian.sh` to avoid any unnecessary duplication [ ] Rewrite `README.md` diff --git a/efi.sh b/efi.sh new file mode 100644 index 0000000..dc07e16 --- /dev/null +++ b/efi.sh @@ -0,0 +1,61 @@ +#!/bin/bash +set -euo pipefail + + +baseDir="$(realpath "$(basename "${0}")")" + + +source \ + "${baseDir}/system.conf" + + +mkdir \ + -p \ + /boot/efi/EFI/ZBM + +mkdir \ + -p \ + /boot/efi/EFI/BOOT + +curl \ + --progress-bar \ + --show-error \ + --output \ + /boot/efi/EFI/ZBM/VMLINUZ.EFI \ + --location \ + https://get.zfsbootmenu.org/efi + +rsync \ + -pogAXtlHrDx \ + --stats \ + --info=progress2 \ + /boot/efi/EFI/ZBM/VMLINUZ.EFI \ + /boot/efi/EFI/ZBM/VMLINUZ-BACKUP.EFI + +rsync \ + -pogAXtlHrDx \ + --stats \ + --info=progress2 \ + /boot/efi/EFI/ZBM/VMLINUZ.EFI \ + /boot/efi/EFI/BOOT/BOOTX64.EFI + +rsync \ + -pogAXtlHrDx \ + --stats \ + --info=progress2 \ + /boot/efi/EFI/ZBM/VMLINUZ.EFI \ + /boot/efi/EFI/BOOT/shellx64.efi + +efibootmgr \ + -c \ + -d "${disk}" \ + -p '1' \ + -L 'ZFSBootMenu (Backup)' \ + -l '\EFI\ZBM\VMLINUZ-BACKUP.EFI' + +efibootmgr \ + -c \ + -d "${disk}" \ + -p '1' \ + -L 'ZFSBootMenu' \ + -l '\EFI\ZBM\VMLINUZ.EFI' diff --git a/install.sh b/install.sh index 53a3635..2e7085a 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/bin/bash set -euo pipefail -BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")" +baseDir="$(dirname "${0}" | sed "s|^\.|${PWD}|")" printf \ '\033[?47l\012' @@ -9,7 +9,7 @@ printf \ cat << EOF ####################################### ## ## -## $(cat "${BASEDIR}/title") Script ## +## $(cat "${baseDir}/title") Script ## ## ## ## Jean ## ## ## @@ -27,7 +27,7 @@ EOF source \ /etc/os-release source \ - "${BASEDIR}/system.conf" + "${baseDir}/system.conf" if [[ ! "${DISK}" == **/dev/disk/by-id/** ]]; then if [[ "${DISK}" == **/dev/nvme** ]]; then @@ -227,47 +227,7 @@ if [[ ! "${*}" = *--no-part* ]]; then fi if [[ ! "${*}" = *--no-part* ]]; then - mkdir \ - -p \ - /boot/efi/EFI/ZBM - - mkdir \ - -p \ - /boot/efi/EFI/BOOT - - curl \ - --progress-bar \ - --show-error \ - --output \ - /boot/efi/EFI/ZBM/VMLINUZ.EFI \ - --location \ - https://get.zfsbootmenu.org/efi - - cp \ - /boot/efi/EFI/ZBM/VMLINUZ.EFI \ - /boot/efi/EFI/ZBM/VMLINUZ-BACKUP.EFI - - cp \ - /boot/efi/EFI/ZBM/VMLINUZ.EFI \ - /boot/efi/EFI/BOOT/BOOTX64.EFI - - cp \ - /boot/efi/EFI/ZBM/VMLINUZ.EFI \ - /boot/efi/EFI/BOOT/shellx64.efi - - efibootmgr \ - -c \ - -d "${DISK}" \ - -p '1' \ - -L 'ZFSBootMenu (Backup)' \ - -l '\EFI\ZBM\VMLINUZ-BACKUP.EFI' - - efibootmgr \ - -c \ - -d "${DISK}" \ - -p '1' \ - -L 'ZFSBootMenu' \ - -l '\EFI\ZBM\VMLINUZ.EFI' + "${baseDir}/efi.sh" fi if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then @@ -289,4 +249,4 @@ zfs \ snapshot \ ${HOSTNAME,,}/ROOT/${ID}@install -"${BASEDIR}/post-inst.sh" +"${baseDir}/post-inst.sh"