Move EFI related commands/tasks into dedicated script

This commit is contained in:
2025-11-05 12:18:37 -05:00
parent 82871fc03a
commit 0b033e852c
3 changed files with 67 additions and 46 deletions

View File

@@ -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`

61
efi.sh Normal file
View File

@@ -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'

View File

@@ -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 <jean@easthighnerd.net> ##
## ##
@@ -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"