Skip to content

Instantly share code, notes, and snippets.

@LaurentFough
Forked from Strykar/orphans.hook
Created May 14, 2021 04:26
Show Gist options
  • Save LaurentFough/9d3836ea0199cfbcaf3777d65313a771 to your computer and use it in GitHub Desktop.
Save LaurentFough/9d3836ea0199cfbcaf3777d65313a771 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