Skip to content

Instantly share code, notes, and snippets.

@Strykar
Last active March 27, 2024 05:33
Show Gist options
  • Save Strykar/3b3cd5bbdabe7e5c77f9414b2b4fe7e8 to your computer and use it in GitHub Desktop.
Save Strykar/3b3cd5bbdabe7e5c77f9414b2b4fe7e8 to your computer and use it in GitHub Desktop.
Pacman post transaction hook to list/remove orphaned packages
[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = Package
Target = *
[Action]
Description = Searching for orphaned packages...
When = PostTransaction
Exec = /usr/bin/bash -c "/usr/bin/pacman -Qtd || /usr/bin/echo '==> no orphans found.'"
#Exec = /usr/bin/bash -c "[[ if $(/usr/bin/pacman -Qtdq) = 0 ]] && /usr/bin/pacman -Rns $(/usr/bin/pacman -Qtdq) || /usr/bin/echo '==> No orphaned packages found.'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment