mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
Adapted release script to new buildroot system
This commit is contained in:
parent
fd167ee11e
commit
6038eac72a
@ -13,6 +13,7 @@
|
|||||||
-- setenv LUA_CPATH /opt/local/share/luarocks/lib/lua/5.2/?.so
|
-- setenv LUA_CPATH /opt/local/share/luarocks/lib/lua/5.2/?.so
|
||||||
-- setenv LUA_PATH /opt/local/share/luarocks/share/lua/5.2/?.lua
|
-- setenv LUA_PATH /opt/local/share/luarocks/share/lua/5.2/?.lua
|
||||||
-- Reboot
|
-- Reboot
|
||||||
|
-- Also see: https://github.com/keplerproject/luarocks/wiki/Using-LuaRocks#rocks-trees-and-the-lua-libraries-path
|
||||||
--
|
--
|
||||||
-- This script will automatically locate the Doodle3D repo's.
|
-- This script will automatically locate the Doodle3D repo's.
|
||||||
-- Index files are fetched from the online repository.
|
-- Index files are fetched from the online repository.
|
||||||
@ -66,8 +67,11 @@ end
|
|||||||
pl = pl()
|
pl = pl()
|
||||||
local um --- update manager module, will be loaded later through @{loadUpdateManager}
|
local um --- update manager module, will be loaded later through @{loadUpdateManager}
|
||||||
|
|
||||||
local lfs = require('lfs') -- assume this exists since it's required by penlight as well
|
local ok, lfs = pcall(require, 'lfs')
|
||||||
|
if not ok then
|
||||||
|
ERR('This script requires the LuaFileSystem library')
|
||||||
|
os.exit(2)
|
||||||
|
end
|
||||||
|
|
||||||
-----------------------------
|
-----------------------------
|
||||||
-- CONSTANTS AND VARIABLES --
|
-- CONSTANTS AND VARIABLES --
|
||||||
@ -148,13 +152,17 @@ local function findInFile(needle, file)
|
|||||||
return not not t:find(needle, 1, true)
|
return not not t:find(needle, 1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function detectOpenWrtRoot()
|
local function fileExists(path)
|
||||||
local f = io.open('Makefile', 'r')
|
local attr = lfs.attributes (path)
|
||||||
local line = f and f:read('*line')
|
return attr ~= nil
|
||||||
local rv = (line and line:find('# Makefile for OpenWrt') == 1) and true or false
|
end
|
||||||
|
|
||||||
if f then f:close() end
|
local function detectBuildroot()
|
||||||
return rv
|
if not fileExists("customfeeds") or not fileExists("bin") then
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- returns uri (file path) of the wifibox feed, nil if not found or nil+msg on error
|
-- returns uri (file path) of the wifibox feed, nil if not found or nil+msg on error
|
||||||
@ -244,24 +252,15 @@ end
|
|||||||
local function prepare()
|
local function prepare()
|
||||||
local msg = nil
|
local msg = nil
|
||||||
|
|
||||||
io.write("* Checking if working directory is the OpenWrt root... ")
|
|
||||||
local isOpenWrtRoot = detectOpenWrtRoot()
|
|
||||||
if isOpenWrtRoot then
|
|
||||||
paths.wrt = pl.path.currentdir()
|
|
||||||
print("found " .. paths.wrt)
|
|
||||||
else
|
|
||||||
print("unrecognized directory, try changing directories or using -wrt-root")
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
io.write("* Looking for Doodle3D feed path... ")
|
io.write("* Looking for Doodle3D feed path... ")
|
||||||
local d3dFeed,msg = getWifiboxFeedRoot('feeds.conf')
|
-- local d3dFeed,msg = getWifiboxFeedRoot('feeds.conf')
|
||||||
if d3dFeed then
|
-- if d3dFeed then
|
||||||
print("found " .. d3dFeed)
|
-- print("found " .. d3dFeed)
|
||||||
else
|
-- else
|
||||||
if msg then print("not found: " .. msg) else print("not found.") end
|
-- if msg then print("not found: " .. msg) else print("not found.") end
|
||||||
return nil
|
-- return nil
|
||||||
end
|
-- end
|
||||||
|
local d3dFeed = "customfeeds"
|
||||||
|
|
||||||
paths.firmware = pl.path.join(d3dFeed, D3D_REPO_FIRMWARE_NAME)
|
paths.firmware = pl.path.join(d3dFeed, D3D_REPO_FIRMWARE_NAME)
|
||||||
paths.client = pl.path.join(d3dFeed, D3D_REPO_CLIENT_NAME)
|
paths.client = pl.path.join(d3dFeed, D3D_REPO_CLIENT_NAME)
|
||||||
@ -315,8 +314,8 @@ local function collectLocalInfo()
|
|||||||
local info = {}
|
local info = {}
|
||||||
|
|
||||||
-- temporary fields required for copying image files
|
-- temporary fields required for copying image files
|
||||||
info.factoryImgPath = pl.path.join(paths.wrt, 'bin/ar71xx/openwrt-ar71xx-generic-' .. deviceType .. '-v1-squashfs-factory.bin')
|
info.factoryImgPath = pl.path.join(paths.root, '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.root, 'bin/ar71xx/openwrt-ar71xx-generic-' .. deviceType .. '-v1-squashfs-sysupgrade.bin')
|
||||||
|
|
||||||
info.version = um.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
|
||||||
@ -410,7 +409,7 @@ end
|
|||||||
-- TODO: the packages are not really used and the openwrt script to generate the
|
-- TODO: the packages are not really used and the openwrt script to generate the
|
||||||
-- package index requires all packages to be present so this has been skipped for now
|
-- package index requires all packages to be present so this has been skipped for now
|
||||||
local function buildFeedDir()
|
local function buildFeedDir()
|
||||||
local scriptPath = pl.path.join(paths.wrt, 'scripts/ipkg-make-index.sh')
|
local scriptPath = pl.path.join(paths.root, 'scripts/ipkg-make-index.sh')
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@ -424,26 +423,6 @@ local function uploadFiles()
|
|||||||
return rv and true or nil,("rsync failed, exit status: " .. ev)
|
return rv and true or nil,("rsync failed, exit status: " .. ev)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function checkWrtConfig()
|
|
||||||
local goodConfigPath = pl.path.join(paths.firmware, "extra/openwrt-build/openwrt-diffconfig-extramini")
|
|
||||||
local wrtConfigPath = pl.path.tmpname()
|
|
||||||
--print("diffonfig output file: " .. wrtConfigPath)
|
|
||||||
|
|
||||||
local rv,ev = pl.utils.execute('./scripts/diffconfig.sh > "' .. wrtConfigPath .. '" 2> /dev/null')
|
|
||||||
if not rv then return nil,"could not run diffconfig script (exit status: " .. ev .. ")" end
|
|
||||||
|
|
||||||
local _,rv,output = pl.utils.executeex('diff "' .. wrtConfigPath .. '" "' .. goodConfigPath .. '"')
|
|
||||||
|
|
||||||
if rv == 0 then
|
|
||||||
return true
|
|
||||||
elseif rv == 1 then
|
|
||||||
print("configurations differ:\n-----------------------\n" .. output .. "\n-----------------------")
|
|
||||||
--ask for confirmation?
|
|
||||||
else
|
|
||||||
return nil,"unexpected exit status from diff (" .. rv .. ")"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function main()
|
local function main()
|
||||||
print("\nDoodle3D release script")
|
print("\nDoodle3D release script")
|
||||||
if detectRootPrivileges() then
|
if detectRootPrivileges() then
|
||||||
@ -457,6 +436,16 @@ local function main()
|
|||||||
-- if opts['cache-dir'] then paths.cache = opts['cache-dir'] end
|
-- if opts['cache-dir'] then paths.cache = opts['cache-dir'] end
|
||||||
-- more options: clear cache, rebuild (download all and generate index from actual files), dry-run, force
|
-- more options: clear cache, rebuild (download all and generate index from actual files), dry-run, force
|
||||||
|
|
||||||
|
io.write("* Checking if working directory is the Buildroot... ")
|
||||||
|
local isBuildroot = detectBuildroot()
|
||||||
|
if isBuildroot then
|
||||||
|
paths.root = pl.path.currentdir()
|
||||||
|
print("found " .. paths.root)
|
||||||
|
else
|
||||||
|
print("unrecognized directory, try changing directories or using -wrt-root")
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
if not prepare() then quit(1) end
|
if not prepare() then quit(1) end
|
||||||
|
|
||||||
|
|
||||||
@ -465,7 +454,7 @@ local function main()
|
|||||||
print("Error: could not collect local version information (" .. msg .. ")")
|
print("Error: could not collect local version information (" .. msg .. ")")
|
||||||
quit(3)
|
quit(3)
|
||||||
end
|
end
|
||||||
|
|
||||||
local stables,betas = fetchVersionInfo()
|
local stables,betas = fetchVersionInfo()
|
||||||
if not stables then
|
if not stables then
|
||||||
print("Error: could not get version information (" .. betas .. ")")
|
print("Error: could not get version information (" .. betas .. ")")
|
||||||
@ -474,7 +463,6 @@ local function main()
|
|||||||
|
|
||||||
--TODO: if requested, fetch images and packages (i.e., mirror whole directory)
|
--TODO: if requested, fetch images and packages (i.e., mirror whole directory)
|
||||||
|
|
||||||
|
|
||||||
-- pl.pretty.dump(newVersion)
|
-- pl.pretty.dump(newVersion)
|
||||||
-- print("stables: "); pl.pretty.dump(stables)
|
-- print("stables: "); pl.pretty.dump(stables)
|
||||||
-- print("===========================");
|
-- print("===========================");
|
||||||
@ -488,8 +476,6 @@ local function main()
|
|||||||
return not (um.findVersion(newVersion.version, nil, stables) or um.findVersion(newVersion.version, nil, betas)) and true or nil
|
return not (um.findVersion(newVersion.version, nil, stables) or um.findVersion(newVersion.version, nil, betas)) and true or nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
runAction("Checking OpenWrt config", "failed", 3, checkWrtConfig)
|
|
||||||
|
|
||||||
--TODO: check git repos (`git log -n 1 --pretty=format:%ct` gives commit date of last commit (not author date))
|
--TODO: check git repos (`git log -n 1 --pretty=format:%ct` gives commit date of last commit (not author date))
|
||||||
|
|
||||||
local isStable = (newVersion.version.suffix == nil)
|
local isStable = (newVersion.version.suffix == nil)
|
||||||
@ -516,8 +502,7 @@ local function main()
|
|||||||
print("skipped - not implemented")
|
print("skipped - not implemented")
|
||||||
-- runAction("Building package feed directory", "failed", 5, buildFeedDir)
|
-- runAction("Building package feed directory", "failed", 5, buildFeedDir)
|
||||||
|
|
||||||
|
local answer = getYesNo("? Are you SURE you want to publish? (y/n) ")
|
||||||
local answer = getYesNo("? Local updates cache will be synced to remote server, proceed? (y/n) ")
|
|
||||||
if answer ~= true then
|
if answer ~= true then
|
||||||
print("Did not get green light, quitting.")
|
print("Did not get green light, quitting.")
|
||||||
quit(5)
|
quit(5)
|
||||||
@ -525,7 +510,7 @@ local function main()
|
|||||||
|
|
||||||
runAction("About to sync files to server", "could not upload files", 6, uploadFiles)
|
runAction("About to sync files to server", "could not upload files", 6, uploadFiles)
|
||||||
|
|
||||||
print("Done.")
|
print("Released version " .. um.formatVersion(newVersion.version) .. "!")
|
||||||
quit()
|
quit()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user