0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 19:13:49 +01:00

Rename upmgr to um.

This commit is contained in:
Wouter R 2014-02-20 10:04:21 +01:00
parent f152c6e3e3
commit cdb7a12050

View File

@ -16,7 +16,7 @@ local lfs = require('lfs') -- assume this exists since it's required by penlight
local argStash = arg local argStash = arg
arg = nil arg = nil
local upmgr = require('d3d-update-mgr') -- arg must be nil for the update manager to load as module local um = require('d3d-update-mgr') -- arg must be nil for the update manager to load as module
arg = argStash arg = argStash
@ -103,7 +103,7 @@ end
local function constructImageName(version, devType, sysupOrFactory) local function constructImageName(version, devType, sysupOrFactory)
return IMAGE_BASENAME .. '-' .. upmgr.formatVersion(version) .. '-' .. devType .. '-' .. sysupOrFactory .. '.bin' return IMAGE_BASENAME .. '-' .. um.formatVersion(version) .. '-' .. devType .. '-' .. sysupOrFactory .. '.bin'
end end
@ -168,7 +168,7 @@ local function collectLocalInfo()
info.factoryImgPath = pl.path.join(paths.wrt, 'bin/ar71xx/openwrt-ar71xx-generic-' .. deviceType .. '-v1-squashfs-factory.bin') info.factoryImgPath = pl.path.join(paths.wrt, 'bin/ar71xx/openwrt-ar71xx-generic-' .. deviceType .. '-v1-squashfs-factory.bin')
info.sysupgradeImgPath = pl.path.join(paths.wrt, 'bin/ar71xx/openwrt-ar71xx-generic-' .. deviceType .. '-v1-squashfs-sysupgrade.bin') info.sysupgradeImgPath = pl.path.join(paths.wrt, 'bin/ar71xx/openwrt-ar71xx-generic-' .. deviceType .. '-v1-squashfs-sysupgrade.bin')
info.version = upmgr.parseVersion(pl.file.read(pl.path.join(paths.firmware, 'src/FIRMWARE-VERSION'))) info.version = um.parseVersion(pl.file.read(pl.path.join(paths.firmware, 'src/FIRMWARE-VERSION')))
if not info.version then return nil,"could not determine current firmware version" end if not info.version then return nil,"could not determine current firmware version" end
info.factoryFileSize = pl.path.getsize(info.factoryImgPath) info.factoryFileSize = pl.path.getsize(info.factoryImgPath)
@ -191,20 +191,20 @@ end
local function fetchVersionInfo() local function fetchVersionInfo()
local msg,stables,betas = nil,nil,nil local msg,stables,betas = nil,nil,nil
stables,msg = upmgr.getAvailableVersions('stables') stables,msg = um.getAvailableVersions('stables')
if not stables then return nil,msg end if not stables then return nil,msg end
betas,msg = upmgr.getAvailableVersions('betas') betas,msg = um.getAvailableVersions('betas')
if not betas then return nil,msg end if not betas then return nil,msg end
return stables, betas return stables, betas
end end
local function generateIndex(newVersion, versionTable, isStable) local function generateIndex(newVersion, versionTable, isStable)
local indexFilename = isStable and upmgr.IMAGE_STABLE_INDEX_FILE or upmgr.IMAGE_BETA_INDEX_FILE local indexFilename = isStable and um.IMAGE_STABLE_INDEX_FILE or um.IMAGE_BETA_INDEX_FILE
local sortedVers = pl.List(versionTable) local sortedVers = pl.List(versionTable)
sortedVers:sort(function(a, b) sortedVers:sort(function(a, b)
return upmgr.compareVersions(a.version, b.version, a.timestamp, b.timestamp) < 0 return um.compareVersions(a.version, b.version, a.timestamp, b.timestamp) < 0
end) end)
local indexPath = pl.path.join(paths.cache, indexFilename) local indexPath = pl.path.join(paths.cache, indexFilename)
@ -213,11 +213,11 @@ local function generateIndex(newVersion, versionTable, isStable)
if not idxFile then return nil,"could not open index file for writing" end if not idxFile then return nil,"could not open index file for writing" end
sortedVers:foreach(function(el) sortedVers:foreach(function(el)
idxFile:write("Version: " .. upmgr.formatVersion(el.version) .. "\n") idxFile:write("Version: " .. um.formatVersion(el.version) .. "\n")
idxFile:write("Files: " .. el.sysupgradeFilename .. "; " .. el.factoryFilename .. "\n") idxFile:write("Files: " .. el.sysupgradeFilename .. "; " .. el.factoryFilename .. "\n")
idxFile:write("FileSize: " .. el.sysupgradeFileSize .. "; " .. el.factoryFileSize .. "\n") idxFile:write("FileSize: " .. el.sysupgradeFileSize .. "; " .. el.factoryFileSize .. "\n")
idxFile:write("MD5: " .. el.sysupgradeMD5 .. "; " .. el.factoryMD5 .. "\n") idxFile:write("MD5: " .. el.sysupgradeMD5 .. "; " .. el.factoryMD5 .. "\n")
idxFile:write("ReleaseDate: " .. upmgr.formatDate(el.timestamp) .. "\n") idxFile:write("ReleaseDate: " .. um.formatDate(el.timestamp) .. "\n")
end) end)
idxFile:close() idxFile:close()
@ -259,9 +259,9 @@ local function main()
if not prepare() then quit(1) end if not prepare() then quit(1) end
-- initialize update manager script -- initialize update manager script
upmgr.setUseCache(false) um.setUseCache(false)
upmgr.setVerbosity(1) um.setVerbosity(1)
upmgr.setCachePath(paths.cache) um.setCachePath(paths.cache)
local newVersion,msg = collectLocalInfo() local newVersion,msg = collectLocalInfo()
if not newVersion then if not newVersion then
@ -276,10 +276,10 @@ local function main()
end end
local isStable = (newVersion.version.suffix == nil) local isStable = (newVersion.version.suffix == nil)
print("Rolling release for firmware version " .. upmgr.formatVersion(newVersion.version) .. " (type: " .. (isStable and "stable" or "beta") .. ").") print("Rolling release for firmware version " .. um.formatVersion(newVersion.version) .. " (type: " .. (isStable and "stable" or "beta") .. ").")
if upmgr.findVersion(newVersion.version, stables) or upmgr.findVersion(newVersion.version, betas) then if um.findVersion(newVersion.version, stables) or um.findVersion(newVersion.version, betas) then
print("Error: firmware version " .. upmgr.formatVersion(newVersion.version) .. " already exists") print("Error: firmware version " .. um.formatVersion(newVersion.version) .. " already exists")
quit(3) quit(3)
end end