Author: titmuss
Date: Wed Apr 30 04:06:19 2008
New Revision: 2394
URL: http://svn.slimdevices.com?rev=2394&root=Jive&view=rev
Log:
Bug: N/A
Description:
The firmware upgrade message always said an upgrade was available if the
current firmware version
was not equal to the version on the server. If you upgraded using an SD card to
a newer version,
this message was wrong. Now only display the upgrade message if the version on
the server is
newer.
Modified:
7.1/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
Modified:
7.1/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
URL:
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua?rev=2394&root=Jive&r1=2393&r2=2394&view=diff
==============================================================================
---
7.1/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
(original)
+++
7.1/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
Wed Apr 30 04:06:19 2008
@@ -11,6 +11,7 @@
local oo = require("loop.simple")
+local math = require("math")
local string = require("string")
local table = require("jive.utils.table")
local socket = require("socket")
@@ -73,6 +74,23 @@
end
+-- return 0 if version are same, +ive if upgrade, -ive if downgrade
+function _versionCompare(a, b)
+ if not a or not b then
+ return math.huge
+ end
+
+ local aMajor, aMinor = string.match(a, "(%d+) r(%d+)")
+ local bMajor, bMinor = string.match(b, "(%d+) r(%d+)")
+
+ if not aMajor or not bMajor or aMajor ~= bMajor then
+ return math.huge
+ end
+
+ return bMinor - aMinor
+end
+
+
function _makeUpgradeItems(self, window, menu, optional, url, urlHelp)
local help = Textarea("help", "")
@@ -85,7 +103,7 @@
self:_upgrade()
end,
focusGained = function()
- if version == JIVE_VERSION then
+ if _versionCompare(JIVE_VERSION, version) <= 0 then
help:setValue(self:string(urlHelp or
"UPDATE_BEGIN_REINSTALL", version or "?"))
else
help:setValue(self:string(urlHelp or
"UPDATE_BEGIN_UPGRADE", version or "?"))
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins