#!/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 set -l path "/boot/EFI/Linux/snap-pac-uki-$x.efi" rm $path echo "==> removed UKI: $path" end end