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

Igor Pechtchanski pechtcha@cs.nyu.edu
Mon Mar 31 16:43:00 GMT 2003


Ping...
	Igor

On Tue, 25 Mar 2003, Igor Pechtchanski wrote:

> On 26 Mar 2003, Robert Collins wrote:
>
> > On Wed, 2003-03-26 at 02:11, Igor Pechtchanski wrote:
> > > Do I need to regenerate this against HEAD once Max checks
> > > in the postinstall thread patch?
> >
> > Yes, and I'll review it then.
> > Rob
>
> Ok, here you go.
>         Igor
> ==============================================================================
> ChangeLog:
> 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!

Knowledge is an unending adventure at the edge of uncertainty.
  -- Leto II
-------------- next part --------------
Index: script.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/script.cc,v
retrieving revision 2.8
diff -u -p -r2.8 script.cc
--- script.cc	25 Mar 2003 20:57:13 -0000	2.8
+++ script.cc	25 Mar 2003 22:01:32 -0000
@@ -237,12 +237,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);
 }
 
 char const Script::ETCPostinstall[] = "/etc/postinstall/";
Index: script.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/script.h,v
retrieving revision 2.5
diff -u -p -r2.5 script.h
--- script.h	25 Mar 2003 20:57:13 -0000	2.5
+++ script.h	25 Mar 2003 22:01:32 -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	25 Mar 2003 22:01:32 -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