[mojosetup] [6/13] Don't skip updating the uninstaller and its related scripts on upgrades.

Francois Gouget fgouget at codeweavers.com
Mon May 21 14:01:23 EDT 2012


---

Using an outdated uninstaller and uninstallation scripts usually causes 
uninstallation errors.

This patch depends on the content of the old manifest and thus depends 
on patch 2.

 scripts/mojosetup_mainline.lua |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/scripts/mojosetup_mainline.lua b/scripts/mojosetup_mainline.lua
index b51fa11..e60bdb6 100644
--- a/scripts/mojosetup_mainline.lua
+++ b/scripts/mojosetup_mainline.lua
@@ -527,19 +527,22 @@ local function backup_file(path)
 end
 
 
-local function permit_write(dest, entinfo, file)
+local function permit_write(dest, filename, type, file)
     local allowoverwrite = true
     if MojoSetup.platform.exists(dest) then
-        if entinfo.type == "dir" then
+        if type == "dir" then
             allowoverwrite = true
         else
-            if MojoSetup.oldfiles[entinfo.filename] ~= nil then
+            if MojoSetup.oldfiles[filename] ~= nil then
                 allowoverwrite = true
             elseif MojoSetup.forceoverwrite ~= nil then
                 allowoverwrite = MojoSetup.forceoverwrite
             else
                 -- !!! FIXME: option/package-wide overwrite?
-                allowoverwrite = file.allowoverwrite
+                allowoverwrite = false
+                if file ~= nil then
+                    allowoverwrite = file.allowoverwrite
+                end
                 if not allowoverwrite then
                     MojoSetup.loginfo("File '" .. dest .. "' already exists.")
                     local text = MojoSetup.format(_("File '%0' already exists! Replace?"), dest)
@@ -613,7 +616,7 @@ local function install_archive_entry(archive, ent, file, option)
 
     if dest ~= nil then  -- Only install if file wasn't filtered out
         dest = MojoSetup.destination .. "/" .. dest
-        if permit_write(dest, ent, file) then
+        if permit_write(dest, ent.filename, ent.type, file) then
             local desc = option.description
             install_archive_entity(dest, ent, archive, desc, desc, perms)
         end
@@ -1004,8 +1007,7 @@ local function install_control_app(desc, key)
 
         if should_write then
             dst = MojoSetup.controldir .. "/" .. ent.filename
-            -- don't overwrite preexisting stuff.
-            if not MojoSetup.platform.exists(dst) then
+            if permit_write(dst, MojoSetup.metadatadirname .. "/" .. ent.filename, ent.type, nil) then
                 install_archive_entity(dst, ent, base, desc, key, perms)
             end
         end
-- 
1.7.10


More information about the mojosetup mailing list