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

Re: Run script after package install, update



On Sun 15 Jun 2025 at 06:23:20 (-0400), The Wanderer wrote:
> On 2025-06-15 at 04:01, tomas@tuxteam.de wrote:

> > OK, here is the screwdriver (from man apt.conf(5)):
> > 
> >        Pre-Invoke, Post-Invoke
> >            This is a list of shell commands to run before/after
> >            invoking dpkg(1). Like options this must be specified
> >            in list notation. The commands are invoked in order
> >            using /bin/sh; should any fail APT will abort.
> > 
> > (Those are in the DPkg section, so probably their full name is
> > DPkg::Post-Invoke, etc).
> 
> That's for running (before/)after *every* dpkg invocation (within apt),
> though, isn't it? By my read, the OP was looking for something which
> would run *only when grub has been updated as part of the invocation*.

But the OP only has to call a script from /etc/apt/apt.conf.d/NNfoo
that tests whether /boot/grub/config is more recent than an arbitrary
file that the script touches at the end of its execution, returning
true when it's not. (For minimal footprint, the arbitrary file could
be the script itself, or even NNfoo.)

> Unless there's some way for the command being run to receive information
> about the dpkg session involved (in which case this would boil down to
> "write a shell script and use that as the command"), or a way for a
> command running independent of apt to *detect* whether such an update
> has happened, that doesn't look like it would satisfy the need.

Cheers,
David.


Reply to: