From 5d3b6fe143d7daad1802b8935de60eae48cae465 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Wed, 21 Aug 2024 11:30:50 +0200 Subject: initial commit --- genefi.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 genefi.sh (limited to 'genefi.sh') diff --git a/genefi.sh b/genefi.sh new file mode 100755 index 0000000..5e3ad14 --- /dev/null +++ b/genefi.sh @@ -0,0 +1,27 @@ +#!/bin/sh +version () { + echo "genefi by fxqnlr v$1" +} + +generate () { + efi_path=/efi/EFI/Linux + cd $efi_path + + select efi_file in *; do break; done; + echo "creating EFI entry for $efi_file" + + readarray -d "-" -t file_arr <<< $efi_file + kernel_version=${file_arr[1]} + echo "recognized kernel version $kernel_version" + + efi_label="gentoo-$kernel_version" + echo "assigned label '$efi_label'" + + doas efibootmgr --create --disk=/dev/nvme0n1 --part=1 --label="$efi_label" --loader="\\EFI\\Linux\\$efi_file" --unicode +} + +if [[ "$1" = "-v" ]] || [[ "$1" = "-V" ]] || [[ "$1" = "--version" ]]; then + version "0.2.0" +else + generate +fi -- cgit v1.2.3