[PATCH setup] Add perpetual support for preremove scripts

Christian Franke Christian.Franke@t-online.de
Wed Jun 29 15:09:24 GMT 2022


Jon Turney wrote:
> On 26/06/2022 17:33, Christian Franke wrote:
>> Use case: I ITP etckeeper (https://etckeeper.branchable.com/) which I 
>> frequently use on Debian. For fully automatic operation, it requires 
>> pre-install and post-install hooks, e.g:
>>
>> /etc/preremove/0p_000_etckeeper_pre-install.sh
>> /etc/postinstall/zp_zzz_etckeeper_post-install.sh
>>
>> This patch adds the missing functionality to run the pre-install 
>> hook. It is limited to /etc/preremove/0p_* because there is possibly 
>> no use case for /etc/preremove/zp_*.
>
> Thanks.
>
> I'm not sure what you mean by 'there is possibly no use case': That 
> you don't have one currently, or that you've reasoned that there can't 
> be one?
>

I don't have one currently and found none which is useful in practice, 
but cannot prove that there is none. If desired, I could provide a patch 
which adds 'zp_*' support.


>> 'class Perpetual0RemoveFindVisitor' is borrowed from postinstall.cc 
>> and modified. It still uses the ugly pre-C++11 hack to disable 
>> copy-ctor and operator=. Possible refactoring like merging all 3 
>> mostly similar visitors into one (or if C++11 is now allowed, use 
>> lambda functions instead) are left for later.
>
> Yeah, some refactoring would make this simpler and easier to 
> understand. :)
>
> I applied this patch.
>

Thanks. I found a minor GUI issue during testing: Script filename 
display persists during package remove phase. Fixed with attached patch.


> 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.

-- 
Regards,
Christian

-------------- next part --------------
From dd31653b99c3a970fd145d2ffbad5809de7e0273 Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.franke@t-online.de>
Date: Wed, 29 Jun 2022 16:51:47 +0200
Subject: [PATCH] Clear filename on GUI after running perpetual preremove
 scripts

---
 install.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/install.cc b/install.cc
index 6689a08..0ceb05f 100644
--- a/install.cc
+++ b/install.cc
@@ -192,6 +192,7 @@ Installer::preremovePerpetual0 ()
     Progress.SetText3 (i->fullName ().c_str());
     i->run();
   }
+  Progress.SetText3 ("");
 }
 
 void
-- 
2.36.1



More information about the Cygwin-apps mailing list