You are not logged in.

#1 2016-05-08 11:42:16

zerophase
Member
Registered: 2015-09-03
Posts: 228

Writing hook for uninstalling orphans after running pacman.

I tried writing a hook for removing orphans after running pacman. The thing is it isn't successful. I run into issues with the database being locked. Plus, I believe if it does successfully run it would run a second time, as removing the orphans would trigger it again. Does anyone know the correct way of checking and removing orphans, after running pacman?

[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = Package
Target = *

[Action]
Depends = base
When = PostTransaction
Exec = /usr/bin/pacman -Rns "$(/usr/bin/pacman -Qtdq)"

Offline

#2 2016-05-08 11:50:33

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Writing hook for uninstalling orphans after running pacman.

Maybe use 'pacman -Rs' or 'pacman -Rss'?


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#3 2016-05-08 12:11:38

TheChickenMan
Member
From: United States
Registered: 2015-07-25
Posts: 354

Re: Writing hook for uninstalling orphans after running pacman.

What if you use the hook to call a script which waits for a few seconds first. Then it could could call pacman after the database has closed out. You could also have this script create / then delete a flag file to determine if it's the first time it was run since being called by the pacman hook. That would prevent an infinite loop.


If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet.
Niels Bohr

Offline

#4 2016-05-08 12:16:24

zerophase
Member
Registered: 2015-09-03
Posts: 228

Re: Writing hook for uninstalling orphans after running pacman.

ROOKIE wrote:

Maybe use 'pacman -Rs' or 'pacman -Rss'?

TheChickenMan wrote:

What if you use the hook to call a script which waits for a few seconds first. Then it could could call pacman after the database has closed out. You could also have this script create / then delete a flag file to determine if it's the first time it was run since being called by the pacman hook. That would prevent an infinite loop.

Thanks for both of the suggestions. I'll give them both a try.

Offline

#5 2016-05-08 12:16:36

apg
Developer
Registered: 2012-11-10
Posts: 211

Re: Writing hook for uninstalling orphans after running pacman.

zerophase wrote:

Does anyone know the correct way of checking and removing orphans, after running pacman?

A pacman wrapper script, not a hook.

Offline

Board footer

Powered by FluxBB