Cleaned up both scripts

This commit is contained in:
Adrian Wannenmacher 2020-09-25 17:06:22 +02:00
parent 64ad4e635e
commit e44f63ae09
Signed by: tfld
GPG Key ID: 19D986ECB1E492D5
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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"