[mojosetup] [8/13] Run the post installation script after deleting obsolete files.

Francois Gouget fgouget at codeweavers.com
Mon May 21 14:05:40 EDT 2012


Leaving obsolete files around (e.g. libraries) can break things badly. So they must be removed first.
But run the post installation script before updating the manifest as that cannot be rolled back (the script does not need the manifest anyway).
---
 scripts/mojosetup_mainline.lua |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/scripts/mojosetup_mainline.lua b/scripts/mojosetup_mainline.lua
index 95163b0..163f545 100644
--- a/scripts/mojosetup_mainline.lua
+++ b/scripts/mojosetup_mainline.lua
@@ -1842,14 +1842,10 @@ local function do_install(install)
 
         install_product_keys(MojoSetup.productkeys)
 
-        run_config_defined_hook(install.postinstall, install)
-
-        if install.write_manifest then
-            install_control_app(MojoSetup.metadatadesc, MojoSetup.metadatakey)
-            install_manifests(MojoSetup.metadatadesc, MojoSetup.metadatakey)
-        end
-
         -- Move away obsolete files so they get deleted
+        --  Note that this will obsolete the control app and the manifests but
+        --  that's ok because we will recreate them if the installation
+        --  succeeds, and restore them if it fails.
         for path,file in pairs(MojoSetup.oldfiles) do
             if file.seen == nil and file.type == 'file' then
                 MojoSetup.loginfo("Obsoleting file '" .. path .. "'")
@@ -1857,6 +1853,13 @@ local function do_install(install)
             end
         end
 
+        run_config_defined_hook(install.postinstall, install)
+
+        if install.write_manifest then
+            install_control_app(MojoSetup.metadatadesc, MojoSetup.metadatakey)
+            install_manifests(MojoSetup.metadatadesc, MojoSetup.metadatakey)
+        end
+
         return 1   -- go to next stage.
     end
 
-- 
1.7.10


More information about the mojosetup mailing list