Add cleanup and more streamlined hook descriptions

This commit is contained in:
Adrian Wannenmacher 2020-09-25 15:22:09 +02:00
parent e886ef1616
commit f1ff8615b6
Signed by: tfld
GPG Key ID: 19D986ECB1E492D5
4 changed files with 28 additions and 2 deletions

View File

@ -6,7 +6,7 @@ Type = Package
Target = *
[Action]
Description = Performing snapper pre snapshot UKI creation...
Description = Performing pre UKI creation...
When = PreTransaction
Exec = /usr/share/libalpm/scripts/snap-pac-uki_create.fish
AbortOnFail

View File

@ -6,6 +6,6 @@ Type = Package
Target = *
[Action]
Description = Performing snapper post snapshot UKI creation...
Description = Performing post UKI creation...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/snap-pac-uki_create.fish

View File

@ -0,0 +1,11 @@
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Performing UKI cleanup...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/snap-pac-uki_cleanup.fish

View File

@ -0,0 +1,15 @@
#!/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