diff --git a/scripts/snap-pac-uki_cleanup.fish b/scripts/snap-pac-uki_cleanup.fish index 98b66a0..0657cc8 100755 --- a/scripts/snap-pac-uki_cleanup.fish +++ b/scripts/snap-pac-uki_cleanup.fish @@ -6,10 +6,12 @@ set -l snapshot_ids (snapper -c $config --jsonout ls | jq ".$config | .[] | .num # 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]*') +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" + set -l path "/boot/EFI/Linux/snap-pac-uki-$x.efi" + rm $path + echo "==> removed UKI: $path" end end diff --git a/scripts/snap-pac-uki_create.fish b/scripts/snap-pac-uki_create.fish index 03a49d2..7174905 100755 --- a/scripts/snap-pac-uki_create.fish +++ b/scripts/snap-pac-uki_create.fish @@ -12,7 +12,7 @@ end # check if UKI already exists -set -l ukis (ls /boot/EFI/Linux/ | grep "snap-pac-uki-[1-9][0-9]*\.efi" | grep -o '[1-9][0-9]*') +set -l ukis (ls /boot/EFI/Linux/ | grep '^snap-pac-uki-[1-9][0-9]*\.efi$' | grep -o "[1-9][0-9]*") if contains $id $ukis echo "==> UKI already exists; no UKI creation"