helper/pruneEfiStubs.sh
2022-03-08 22:24:01 +01:00

15 lines
392 B
Bash
Executable file

#!/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