:: Re: [devuan-dev] bug#881: invoke-rc…
Forside
Slet denne besked
Besvar denne besked
Skribent: Simon Richter
Dato:  
Til: devuan-dev
Emne: Re: [devuan-dev] bug#881: invoke-rc.d: Policy layer may override runlevel constraint
Hi,

On 4/3/25 20:16, Opty wrote:

> modify invoke-rc.d or rather policy-rc.d to check
> $DPKG_MAINTSCRIPT_NAME (to detect preinst, postinst, prerm or postrm
> script), crosscheck $DPKG_MAINTSCRIPT_PACKAGE vs. $INITSCRIPTID
> (substring of each other) to allow calling other scripts and
> eventually do nothing, maybe ask the administrator.


The policy-rc.d check is there specifically for the administrator to
define policy.

This interface is managed through the alternatives system, so if you
provide your own as a package, you need to give it a different name and
symlink it through update-alternatives, this allows debootstrap to
provide a high-priority script for the initial install run.

You can get the name of the init script and the action from the
arguments to policy-rc.d, no need to check environment variables except
if these are needed as part of the decision.

E.g. if you want something time-based, write a policy script that checks
an override mechanism for yourself (e.g. an environment variable you set
in your root shell) and the current time, and then either performs the
action or sends an email that you should do that later.

A good resource is the original spec:

https://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt

    Simon