summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2024-08-21 17:22:24 +0200
committerfxqnlr <[email protected]>2024-08-21 17:22:24 +0200
commit30d2f304395a2908c50ab215c501d4085428167b (patch)
tree383623875616776739f8e39e4f54416d0f964ea5
parent5d3b6fe143d7daad1802b8935de60eae48cae465 (diff)
downloadgenefi-30d2f304395a2908c50ab215c501d4085428167b.tar
genefi-30d2f304395a2908c50ab215c501d4085428167b.tar.gz
genefi-30d2f304395a2908c50ab215c501d4085428167b.zip
add removal of entries
-rw-r--r--echo5
-rwxr-xr-xgenefi.sh44
-rw-r--r--grep0
3 files changed, 39 insertions, 10 deletions
diff --git a/echo b/echo
new file mode 100644
index 0000000..57db8a9
--- /dev/null
+++ b/echo
@@ -0,0 +1,5 @@
1BootCurrent: 0000
2Timeout: 1 seconds
3BootOrder: 0001,0000
4Boot0000* gentoo-6.6.41 HD(1,GPT,334e6de7-2c83-4e0c-a676-157c989027ee,0x800,0x200000)/File(\EFI\Linux\gentoo-6.6.41-gentoo-dist.efi)
5Boot0001* gentoo-6.6.47 HD(1,GPT,334e6de7-2c83-4e0c-a676-157c989027ee,0x800,0x200000)/File(\EFI\Linux\gentoo-6.6.47-gentoo-dist.efi)
diff --git a/genefi.sh b/genefi.sh
index 5e3ad14..dc3e876 100755
--- a/genefi.sh
+++ b/genefi.sh
@@ -4,24 +4,48 @@ version () {
4} 4}
5 5
6generate () { 6generate () {
7 efi_path=/efi/EFI/Linux 7 local efi_path=/efi/EFI/Linux
8 cd $efi_path
9 8
10 select efi_file in *; do break; done; 9 cd $efi_path
10
11 PS3="Select the efi file: "
12 select efi_file in *.efi; do break; done;
11 echo "creating EFI entry for $efi_file" 13 echo "creating EFI entry for $efi_file"
12 14
13 readarray -d "-" -t file_arr <<< $efi_file 15 readarray -d "-" -t file_arr <<< $efi_file
14 kernel_version=${file_arr[1]} 16 local kernel_version=${file_arr[1]}
15 echo "recognized kernel version $kernel_version" 17 echo "recognized kernel version $kernel_version"
16 18
17 efi_label="gentoo-$kernel_version" 19 local efi_label="gentoo-$kernel_version"
18 echo "assigned label '$efi_label'" 20 echo "assigned label '$efi_label'"
19 21
20 doas efibootmgr --create --disk=/dev/nvme0n1 --part=1 --label="$efi_label" --loader="\\EFI\\Linux\\$efi_file" --unicode 22 doas efibootmgr --create --disk=/dev/nvme0n1 --part=1 --label="$efi_label" --loader="\\EFI\\Linux\\$efi_file" --unicode >> /dev/null
21} 23}
22 24
23if [[ "$1" = "-v" ]] || [[ "$1" = "-V" ]] || [[ "$1" = "--version" ]]; then 25remove () {
24 version "0.2.0" 26 readarray -d '\n' -t boot_entries <<< $( efibootmgr --unicode | grep -o -E " gentoo-[0-9]+.[0-9]+.[0-9]+" )
25else 27 PS3="Select the entry to delete: "
28 select boot_entry in $boot_entries; do break; done;
29 local boot_num="$(efibootmgr --unicode | grep "$boot_entry" | grep -o -E "^Boot[0-9]+" | grep -o -E "[0-9]+")"
30 echo "delete entry $boot_entry (Boot$boot_num)"
31 doas efibootmgr --unicode -B -b $boot_num >> /dev/null
32}
33
34case $1 in
35"-v" | "--version" | "-V")
36 version "0.3.0"
37;;
38"generate")
39 generate
40;;
41"remove")
42 remove
43;;
44"")
26 generate 45 generate
27fi 46 remove
47;;
48*)
49 echo unknown argument
50;;
51esac
diff --git a/grep b/grep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/grep