From b8225603a5d66760445c04ec14861764deb1489f Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Fri, 1 Jul 2022 18:52:17 +0200 Subject: [PATCH] Add perpetual pre-remove scripts --- packaging-package-files.html | 40 +++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/packaging-package-files.html b/packaging-package-files.html index 446e62db..5b214f53 100755 --- a/packaging-package-files.html +++ b/packaging-package-files.html @@ -223,27 +223,35 @@ etc... after it is installed.

-

Perpetual post-install scripts

+

Perpetual post-install and pre-remove scripts

- In addition to the ordinary ("run-once") post-install scripts described above, - the setup program supports "perpetual" post-install scripts. These are run on - every invocation of setup, as long as the package is still installed. - Perpetual post-install scripts are distinguished from run-once scripts by + In addition to the ordinary ("run-once") scripts described above, + the setup program supports "perpetual" post-install and pre-remove scripts. + These are run on every invocation of setup, as long as the package is still + installed. Perpetual scripts are distinguished from run-once scripts by having names that start with "0p_" or "zp_". Those that start with "0p_" are - run before the run-once scripts, and those that start with "zp_" are run after - the run-once scripts. Examples include - 0p_000_autorebase.dash (provided by the _autorebase package) - and 0p_update-info-dir.dash (provided by the info package). + run before the run-once scripts, and those that start with "zp_" are run + after the run-once scripts. Examples include + postinstall/0p_000_autorebase.dash (provided by the + _autorebase package), + postinstall/0p_update-info-dir.dash (provided by the + info package), + postinstall/zp_zzz_etckeeper_post-install.sh and + preremove/0p_000_etckeeper_pre-install.sh (provided by the + etckeeper package).

For those package maintainers wanting to employ perpetual scripts, the first - thing to keep in mind is to only use this feature for things that really can't - be done with run-once scripting. Any perpetual script should minimize the - resources used (use dash instead of bash for instance) and exit at the - earliest possible moment if no action is required. Scripts of type "0p_" must - be able to run with the Base packages installed but the post-install scripts - not yet executed; in practical terms that rules out using bash scripts. This - limitation does not apply to scripts of type "zp_". + thing to keep in mind is to only use this feature for things that really + can't be done with run-once scripting. Any perpetual script should minimize + the resources used (use dash instead of bash for instance) and exit at the + earliest possible moment if no action is required. Post-install scripts of + type "0p_" must be able to run with the Base packages installed but the + remaining post-install scripts not yet executed; in practical terms that + rules out using bash scripts. Pre-remove scripts of type "zp_" must be able + to run with the other pre-remove scripts already executed. These limitations + do not apply to post-install scripts of type "zp_" and pre-remove scripts of + type "0p_".

See this -- 2.36.1