Re: Can I prevent Pacman from running hooks?

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



On 10/13/18 4:11 AM, Tobias Hunger via arch-general wrote:
> I have scripts that will install a set of arch linux machines for me
> with all the tweaks I want. These scripts run pacman a lot to install
> bits and pieces. Usually the script will running pacman to install one
> package and then configure that package and then proceed to install
> the next (set of) packages. This works great, but  a noticeable part
> of the run time is spent on running pacman hooks (e.g. to update the
> man-db and similar things).

If there are specific hooks you don't want to use, you can use the
default HookDir (as documented in alpm-hooks(5) *and* in pacman.conf(5),
this is "/etc/pacman.d/hooks/") to mask them with symlinks to /dev/null.

You've responded that you need to batch each image installation process
using incremental runs inspired by docker, which I sort of understand,
but I don't really see how delaying execution until the end, is a good
idea here.

Consider things like the texinfo package, which installs a hook to run
many install-info processes, once for each file in usr/share/info/ that
the hook detects. I guess you could write your own custom handling for
this and just try to install the whole directory at the end, but you'd
need to judge based on the hook, and adapt to a unique situation. And
it's irrelevant, since delaying execution will not provide benefits over
doing it every time a file is installed -- on the contrary, delaying
execution means you repeat some of the base image work separately for
each child image.

You should override hooks by hand, when you know what they do, know that
they don't require targets, and know that you're handling it yourself at
the end.

> So I am wondering: Is it possible to stop pacman from running hooks
> during package installation? I do know when it is "safe" to not run
> hooks (when the system is not complete yet) and when I need to run all
> of them (right after the system has all packages installed that it
> will have).
> 
> So far I run pacman with a --hookdir that contains symlinks to
> /dev/null named like some of the more expensive hooks that tend to
> take long to complete. But a --no-hooks option to pacman would be
> great for my use case.

Expensive hooks, like the man-db hook? I find that annoying on my
standard system as well, which is why I use
https://github.com/graysky2/mandb-ondemand

I'm extremely skeptical that we'll add a --no-hooks option.

We have a --noscriptlet option, but that's because there's no other way
to stop a scriptlet from doing specific things you don't want done.

Hooks were designed to be configurable and able to be masked on an
individual level via symlinks. An option to prevent hooks from running
would therefore serve no purpose except to say "running hooks at all is
undesirable to me", which I don't think is the statement we want to say...

> Is it possible to run pacman without it triggering hooks?

You can add a NoExtract directive to pacman.conf, which prevents hooks
from being installed to the system in the first place. Although I don't
know how you'd determine what hooks should exist, in order to handle
their actions yourself.

You can also compile your own pacman package using:

CPPFLAGS='-DSYSHOOKDIR=\"/i/dont/want/to/run/any/hooks/\"' ./configure

But I don't see any point to this.

-- 
Eli Schwartz
Bug Wrangler and Trusted User

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux