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