You are not logged in.
I'm trying to pass explicitly installed package names to a script my hook is running for recording installed packages so I can easily reinstall across multiple machines. I have NeedsTargets in the hook, but that passes all of the packages installed from executing pacman to the script. Is there anyway to whittle this down to just the explicitly installed packages during post transaction?
Offline
Would running...
pacman -Qqet
in a pre-transaction hook and again in a post-transaction hook and diffing the two work?
Offline
Would running...
pacman -Qqet
in a pre-transaction hook and again in a post-transaction hook and diffing the two work?
The works if I run it in a PreTransaction hook for removal, and PostTransaction for Install.
pkgs=$(</dev/stdin)
native=$(pacman -Qenq | grep "$pkgs")
Offline
This seems like an odd approach: you want to continually update a list you'll only periodically need. When you need the list, I assume you'll copy/move the list file somewhere. Why not just generate it at the time it's needed with `pacman -Qeq`?
If you really want to do this in a hook, though, there is no need for the before and after. Your script is already getting a list of just the packages that are being installed, so just check which (if any) of those are explicit:
pacman -Qeq $@
EDIT: or if the list of packages are coming via stdin:
pacman -Qeq -
Last edited by Trilby (2017-09-19 19:23:37)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
This seems like an odd approach: you want to continually update a list you'll only periodically need. When you need the list, I assume you'll copy/move the list file somewhere. Why not just generate it at the time it's needed with `pacman -Qeq`?
If you really want to do this in a hook, though, there is no need for the before and after. Your script is already getting a list of just the packages that are being installed, so just check which (if any) of those are explicit:
pacman -Qeq $@
EDIT: or if the list of packages are coming via stdin:
pacman -Qeq -
I just want it to be up to date in case I accidentally destroy some data doing an rsync restore. It's just there in case something bad happens when rolling the system back, so I can get everything up again in the shortest time possible.
Offline
If you're going to run `pacman -Qeq` why bother with NeedsTargets at all? Just write the full `pacman -Qeq` output to the file after every transaction.
Offline
I just want it to be up to date in case I accidentally destroy some data doing an rsync restore. It's just there in case something bad happens when rolling the system back, so I can get everything up again in the shortest time possible.
I'm still missing why this needs to be tied at all to updates. Just generate the list right before doing your rsync restore. Surely you update *far* more often than you have to restore from a backup.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
zerophase wrote:I just want it to be up to date in case I accidentally destroy some data doing an rsync restore. It's just there in case something bad happens when rolling the system back, so I can get everything up again in the shortest time possible.
I'm still missing why this needs to be tied at all to updates. Just generate the list right before doing your rsync restore. Surely you update *far* more often than you have to restore from a backup.
I have it setup so the hook doesn't fire every update. Just when I install or remove a package. I'm also going to be picking up a laptop soon that should be fine with most of the same packages. I'm just trying to automate a very minor maintenance task.
Last edited by zerophase (2017-09-23 04:08:54)
Offline