Add cleanup and more streamlined hook descriptions
This commit is contained in:
parent
e886ef1616
commit
f1ff8615b6
@ -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
|
||||
|
@ -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
|
11
hooks/zzz_snap-pac-uki_cleanup.hook
Normal file
11
hooks/zzz_snap-pac-uki_cleanup.hook
Normal 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
|
15
scripts/snap-pac-uki_cleanup.fish
Executable file
15
scripts/snap-pac-uki_cleanup.fish
Executable 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
|
Loading…
Reference in New Issue
Block a user