diff options
-rwxr-xr-x | genefi.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/genefi.sh b/genefi.sh new file mode 100755 index 0000000..5e3ad14 --- /dev/null +++ b/genefi.sh | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/bin/sh | ||
2 | version () { | ||
3 | echo "genefi by fxqnlr v$1" | ||
4 | } | ||
5 | |||
6 | generate () { | ||
7 | efi_path=/efi/EFI/Linux | ||
8 | cd $efi_path | ||
9 | |||
10 | select efi_file in *; do break; done; | ||
11 | echo "creating EFI entry for $efi_file" | ||
12 | |||
13 | readarray -d "-" -t file_arr <<< $efi_file | ||
14 | kernel_version=${file_arr[1]} | ||
15 | echo "recognized kernel version $kernel_version" | ||
16 | |||
17 | efi_label="gentoo-$kernel_version" | ||
18 | echo "assigned label '$efi_label'" | ||
19 | |||
20 | doas efibootmgr --create --disk=/dev/nvme0n1 --part=1 --label="$efi_label" --loader="\\EFI\\Linux\\$efi_file" --unicode | ||
21 | } | ||
22 | |||
23 | if [[ "$1" = "-v" ]] || [[ "$1" = "-V" ]] || [[ "$1" = "--version" ]]; then | ||
24 | version "0.2.0" | ||
25 | else | ||
26 | generate | ||
27 | fi | ||