snap-pac-uki/scripts/snap-pac-uki_cleanup.fish

16 lines
368 B
Fish
Executable File

#!/bin/fish
# get snapshots
set -l config "root"
set -l snapshot_ids (snapper -c $config --jsonout ls | jq ".$config | .[] | .number")
# get current ukis
set -l ukis (ls /boot/EFI/Linux/ | grep "snap-pac-uki-[1-9][0-9]*\.efi" | grep -o '[1-9][0-9]*')
for x in $ukis
if not contains $x $snapshot_ids
rm "/boot/EFI/Linux/snap-pac-uki-$x.efi"
end
end