I used to program extensively in a variety of languages, but have not done anything for many years and now have lost my nerve.
I want to build on the code from /etc/apt/apt.conf.d/05etckeeper to work with Snapper, the new-in btrfs (et al) snapshot package.
Code: Select all
DPkg::Pre-Invoke { "if [ -x /usr/bin/etckeeper ]; then etckeeper pre-install; fi"; };
DPkg::Post-Invoke { "if [ -x /usr/bin/etckeeper ]; then etckeeper post-install; fi"; };
I know that something similar to my quest is done with the 'pid' but I have no clue how to do it in the 'standard' way. Happily there can't be multiple dpkg instances running concurrently (prevented by dpkg?) so I don't have to worry about that issue.
Q1. Please, what is the 'standard' way of passing parameters about?
I hope to use:
Code: Select all
snapper -c etc create -t pre -p (which 'prints' the parameter (int) to pass to the following invocation)
snapper -c etc create -t post --pre-number <parameter>
I'd like to learn ruby, for lots of reasons, but if someone is kind enough to post shell-script or something I'll work the rest out!
Q2. Please, how do I pick up the 'printed' output of the 'pre' call? I think it's just a 'get' from the stream but perhaps I've missed something.?
Thank you in advance!
Oh and one final thing: before anyone says write a wrapper script for dpkg/apt/aptitude to avoid parameter passing, I'm doing it this way round as a learning exercise!