[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Looking for apt-get internals guide



This one time, at band camp, Matt Zimmerman said:
> (this is debian-devel material; please followup there)

OK. 

For those who missed the original post on -mentors - I'm in charge of
some non-standard packages for a company I work for, and I would like to
write a hook into apt that does things like patch a config file (with a
patch we ship in this non-standard package) or add logcheck-ignore rules
for a package, or many other similar things, but only if the package is
either already installed or being installed now.  The second case seems
to call for a postinst hook into apt.

> On Thu, Nov 06, 2003 at 04:46:39PM -0500, Stephen Gran wrote:
> 
> > To do so, I need to know a little more about apt's guts than I do
> > currently, I'm afraid, and I was hoping someone could point me to a good
> > reference guide about how apt calls external programs (like
> > apt-listchanges) and parsing the syntax that apt calls with and that
> > sort of thing.
> > 
> > Hopefully I've been clear enough - I only have a rough roadmap in my
> > head at this point.  Other suggestions for smarter ways of doing this
> > would be welcome as well.
> 
> There is an internals guide in the apt source code, but it isn't going to be
> what you want.  The best documentation is example code, and there is plenty
> of that around.  The pipeline data is really pretty much self-explanatory;
> add a hook pointing to /bin/cat and watch it for a while.

That sounds like a good plan - I'll start there.

> But, I don't see why you should need to hook into apt at all in order to do
> what you want.  If the files you change are conffiles, your changes should
> be preserved, and if they aren't conffiles, you can divert them.

Many of the files we're shipping modify files that may or may not be on
the system - for instance, we might not ship a box with ftp or dhcp daemons
installed, but only later get requests for them.  If I can make this
hook into apt, it will automagically apply the patches to the conffiles,
add the extra logcheck ignore lines, and set up firewall rules for us.
Writing the script that does the actual work is easy - hooking into apt
is the hard part (at least for me) so that's why I asked.

Thanks for your suggestion - it looks like a good starting point.
-- 
 -----------------------------------------------------------------
|   ,''`.					     Stephen Gran |
|  : :' :					 sgran@debian.org |
|  `. `'			Debian user, admin, and developer |
|    `-					    http://www.debian.org |
 -----------------------------------------------------------------

Attachment: pgpNCarw3Stxk.pgp
Description: PGP signature


Reply to: