[PATCH] Allow logging of {pre,post}remove scripts

Igor Pechtchanski pechtcha@cs.nyu.edu
Tue Mar 25 15:11:00 GMT 2003


Umm...  Ping?..  Do I need to regenerate this against HEAD once Max checks
in the postinstall thread patch?  It should apply with fuzz even then.
	Igor

On Fri, 21 Mar 2003, Igor Pechtchanski wrote:

> This patch extends logging support to preremove/postremove scripts.
>         Igor
> ==============================================================================
> 2003-03-18  Igor Pechtchanski <pechtcha@cs.nyu.edu>
>
>         * script.cc (try_run_script): Add optional to_log
>         boolean parameter.  Pass to_log to run_script.
>         * script.h (try_run_script): Add optional to_log
>         parameter.
>         * package_meta.cc (packagemeta::uninstall): Instruct
>         try_run_script() to log script output.

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune
-------------- next part --------------
Index: script.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/script.cc,v
retrieving revision 2.7
diff -u -p -r2.7 script.cc
--- script.cc	20 Mar 2003 10:02:51 -0000	2.7
+++ script.cc	21 Mar 2003 23:21:24 -0000
@@ -242,12 +242,12 @@ run_script (String const &dir, String co
 }
 
 void
-try_run_script (String const &dir, String const &fname)
+try_run_script (String const &dir, String const &fname, BOOL to_log)
 {
   if (io_stream::exists (String ("cygfile://")+ dir + fname + ".sh"))
-    run_script (dir.cstr_oneuse(), (fname + ".sh").cstr_oneuse());
+    run_script (dir.cstr_oneuse(), (fname + ".sh").cstr_oneuse(), to_log);
   if (io_stream::exists (String ("cygfile://")+ dir + fname + ".bat"))
-    run_script (dir.cstr_oneuse(), (fname + ".bat").cstr_oneuse());
+    run_script (dir.cstr_oneuse(), (fname + ".bat").cstr_oneuse(), to_log);
 }
 
 bool
Index: script.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/script.h,v
retrieving revision 2.4
diff -u -p -r2.4 script.h
--- script.h	20 Mar 2003 10:02:51 -0000	2.4
+++ script.h	21 Mar 2003 23:21:24 -0000
@@ -27,7 +27,7 @@ void run_script (String const &dir, Stri
 void init_run_script ();
 
 /* Run the scripts fname.sh and fname.bat, found in dir. */
-void try_run_script (String const &dir, String const &fname);
+void try_run_script (String const &dir, String const &fname, BOOL to_log = FALSE);
 
 class Script {
   public:
Index: package_meta.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/package_meta.cc,v
retrieving revision 2.36
diff -u -p -r2.36 package_meta.cc
--- package_meta.cc	20 Mar 2003 00:27:33 -0000	2.36
+++ package_meta.cc	21 Mar 2003 23:21:24 -0000
@@ -190,7 +190,7 @@ packagemeta::uninstall ()
       hash dirs;
       String line = installed.getfirstfile ();
 
-      try_run_script ("/etc/preremove/", name);
+      try_run_script ("/etc/preremove/", name, TRUE);
       while (line.size())
 	{
 	  dirs.add_subdirs (line);
@@ -227,7 +227,7 @@ packagemeta::uninstall ()
 	  if (RemoveDirectory (d.cstr_oneuse()))
 	    log (LOG_BABBLE) << "rmdir " << d << endLog;
 	}
-      try_run_script ("/etc/postremove/", name);
+      try_run_script ("/etc/postremove/", name, TRUE);
     }
   installed = packageversion();
 }


More information about the Cygwin-apps mailing list