[mojosetup] [1/13] Warn about rollback errors only once.

Francois Gouget fgouget at codeweavers.com
Mon May 21 13:46:56 EDT 2012


Followup warnings don't provide further information and each require a click which quickly becomes impractical.
---

The goal of this patch series is to make it possible to upgrade existing 
installations using the standard application installer. That is, one 
should be able to run './install-myapp-1.1.bin' both for a first-time 
install and to upgrade from a previous 1.0 install (as long as it was 
done through MojoSetup).

A few of these patches are not strictly related to that goal but fix 
other issues I found while working on this. This one is a typical 
example.

I opted to leave them in as removing them may require reworking some of 
the later patches. In any case I'm willing to rework the patches to get 
them accepted so this includes reordering if deemed necessary. This 
submission will at least serve to show where I'm going with all this.


 scripts/mojosetup_mainline.lua |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/mojosetup_mainline.lua b/scripts/mojosetup_mainline.lua
index 2cafbc2..1cd8ed9 100644
--- a/scripts/mojosetup_mainline.lua
+++ b/scripts/mojosetup_mainline.lua
@@ -205,14 +205,16 @@ local function do_rollbacks()
         return
     end
 
+    local warned = false
     local max = #MojoSetup.rollbacks
     for id = max,1,-1 do
         local src = MojoSetup.rollbackdir .. "/" .. id
         local dest = MojoSetup.rollbacks[id]
-        if not MojoSetup.movefile(src, dest) then
+        if not MojoSetup.movefile(src, dest) and not warned then
             -- we're already in fatal(), so we can only throw up a msgbox...
             MojoSetup.msgbox(_("Serious problem"),
                              _("Couldn't restore some files. Your existing installation is likely damaged."))
+            warned = true
         end
         MojoSetup.loginfo("Restored rollback #" .. id .. ": '" .. src .. "' -> '" .. dest .. "'")
     end
-- 
1.7.10


More information about the mojosetup mailing list