[PATCH setup] Add perpetual support for preremove scripts

Christian Franke Christian.Franke@t-online.de
Fri Jul 1 17:03:07 GMT 2022


Christian Franke wrote:
> Jon Turney wrote:
> ...
>> Can you please also write a patch for [1] (source in [2]) to document 
>> this?
>>
>> [1] https://cygwin.com/packaging-package-files.html#postinstall
>> [2] 
>> https://cygwin.com/git/?p=cygwin-htdocs.git;a=blob;f=packaging-package-files.html
>>
>
> Of course. I will possibly wait until my ITP of etckeeper is accepted 
> to have a real world example for the doc.
>

Patch attached. Written under the assumption that "[PATCH] Also run 
stratum 'z' perpetual preremove scripts" and "[ITP] etckeeper 1.18.17-1" 
will eventually be accepted :-)

-------------- next part --------------
From b8225603a5d66760445c04ec14861764deb1489f Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.franke@t-online.de>
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.
 </p>
 
-<h3>Perpetual post-install scripts</h3>
+<h3>Perpetual post-install and pre-remove scripts</h3>
 <p>
-  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
-  <code>0p_000_autorebase.dash</code> (provided by the <code>_autorebase</code> package)
-  and <code>0p_update-info-dir.dash</code> (provided by the <code>info</code> package).
+  run before the run-once scripts, and those that start with "zp_" are run
+  after the run-once scripts.  Examples include
+  <code>postinstall/0p_000_autorebase.dash</code> (provided by the
+  <code>_autorebase</code> package),
+  <code>postinstall/0p_update-info-dir.dash</code> (provided by the
+  <code>info</code> package),
+  <code>postinstall/zp_zzz_etckeeper_post-install.sh</code> and
+  <code>preremove/0p_000_etckeeper_pre-install.sh</code> (provided by the
+  <code>etckeeper</code> package).
 </p>
 <p>
   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_".
 </p>
 <p>
   See <a href="https://cygwin.com/ml/cygwin-apps/2014-12/msg00148.html">this
-- 
2.36.1



More information about the Cygwin-apps mailing list