add script to prune old entries in efi
This commit is contained in:
parent
457509b217
commit
427e606aa2
1 changed files with 15 additions and 0 deletions
15
pruneEfiStubs.sh
Executable file
15
pruneEfiStubs.sh
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
mapfile ENTRIES < <(efibootmgr -v | tail +4 | grep HD\()
|
||||||
|
for entry in "${ENTRIES[@]}" ; do
|
||||||
|
# echo "Processing"
|
||||||
|
# echo "$entry"
|
||||||
|
BOOTID=$( sed -e "s/Boot\(.\{4\}\).*/\1/" <<<$entry )
|
||||||
|
FILE=$( sed -e "s/.*File(\(.*\)).*/\1/" <<<$entry)
|
||||||
|
if [[ -f "$FILE" ]] ; then
|
||||||
|
echo "$FILE exists"
|
||||||
|
else
|
||||||
|
echo "$FILE doesn't exists"
|
||||||
|
efibootmgr -B -b "$BOOTID"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Add table
Reference in a new issue