]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
2010-08-29 Jon TURNEY <jon.turney@dronecode.org.uk>
authorJon TURNEY <jon.turney@dronecode.org.uk>
Sun, 29 Aug 2010 10:08:34 +0000 (10:08 +0000)
committerJon TURNEY <jon.turney@dronecode.org.uk>
Sun, 29 Aug 2010 10:08:34 +0000 (10:08 +0000)
* postinstall.cc (do_postinstall_thread): Don't run postinstall
scripts belonging to a just installed package twice.

postinstall.cc

index aaa9b20bf0431d9e9f51d743bbc7160240943c86..21fc12956f7eab75beb233688ba17c88ab68a07c 100644 (file)
@@ -161,13 +161,29 @@ do_postinstall_thread (HINSTANCE h, HWND owner)
       Progress.SetBar2 (k, numpkg);
     }
 
-  // Look for any scripts in /etc/postinstall which haven't been renamed .done,
-  // and try to run them...
+  // Look for any scripts in /etc/postinstall which haven't been renamed .done
   std::string postinst = cygpath ("/etc/postinstall");
   vector<Script> scripts;
   RunFindVisitor myVisitor (&scripts);
   Find (postinst).accept (myVisitor);
 
+  // Remove anything which we just tried to run (so we don't try twice)
+  for (i = packages.begin (); i != packages.end (); ++i)
+    {
+       packagemeta & pkg = **i;
+       for (std::vector<Script>::const_iterator j = pkg.installed.scripts().begin();
+            j != pkg.installed.scripts().end();
+            j++)
+         {
+           std::vector<Script>::iterator p = find(scripts.begin(), scripts.end(), *j);
+           if (p != scripts.end())
+             {
+               scripts.erase(p);
+             }
+         }
+    }
+
+  // and try to run what's left...
   {
     RunScript scriptRunner("No package", scripts);
     scriptRunner.run_all(s);
This page took 0.033425 seconds and 5 git commands to generate.