#258 more installer fixes

This commit is contained in:
Mikayla Fischler 2023-06-18 01:19:00 -04:00
parent d42327a20d
commit aef8281ad6
2 changed files with 16 additions and 11 deletions

View File

@ -20,7 +20,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
local function println(message) print(tostring(message)) end local function println(message) print(tostring(message)) end
local function print(message) term.write(tostring(message)) end local function print(message) term.write(tostring(message)) end
local CCMSI_VERSION = "v1.4b" local CCMSI_VERSION = "v1.4c"
local install_dir = "/.install-cache" local install_dir = "/.install-cache"
local manifest_path = "https://mikaylafischler.github.io/cc-mek-scada/manifests/" local manifest_path = "https://mikaylafischler.github.io/cc-mek-scada/manifests/"
@ -410,6 +410,17 @@ elseif mode == "install" or mode == "update" then
local success = true local success = true
-- helper function to check if a dependency is unchanged
---@nodiscard
---@param dependency string
---@return boolean
local function unchanged(dependency)
if dependency == "system" then return not ver.boot.changed
elseif dependency == "graphics" then return not ver.graphics.changed
elseif dependency == app then return not ver.app.changed
else return true end
end
if not single_file_mode then if not single_file_mode then
if fs.exists(install_dir) then if fs.exists(install_dir) then
fs.delete(install_dir) fs.delete(install_dir)
@ -418,9 +429,7 @@ elseif mode == "install" or mode == "update" then
-- download all dependencies -- download all dependencies
for _, dependency in pairs(dependencies) do for _, dependency in pairs(dependencies) do
if mode == "update" and ((dependency == "system" and not ver.boot.changed) or if mode == "update" and unchanged(dependency) then
(dependency == "graphics" and not ver.graphics.changed) or
(not ver.app.changed)) then
pkg_message("skipping download of unchanged package", dependency) pkg_message("skipping download of unchanged package", dependency)
else else
pkg_message("downloading package", dependency) pkg_message("downloading package", dependency)
@ -448,9 +457,7 @@ elseif mode == "install" or mode == "update" then
-- copy in downloaded files (installation) -- copy in downloaded files (installation)
if success then if success then
for _, dependency in pairs(dependencies) do for _, dependency in pairs(dependencies) do
if mode == "update" and ((dependency == "system" and not ver.boot.changed) or if mode == "update" and unchanged(dependency) then
(dependency == "graphics" and not ver.graphics.changed) or
(not ver.app.changed)) then
pkg_message("skipping install of unchanged package", dependency) pkg_message("skipping install of unchanged package", dependency)
else else
pkg_message("installing package", dependency) pkg_message("installing package", dependency)
@ -492,9 +499,7 @@ elseif mode == "install" or mode == "update" then
else else
-- go through all files and replace one by one -- go through all files and replace one by one
for _, dependency in pairs(dependencies) do for _, dependency in pairs(dependencies) do
if mode == "update" and ((dependency == "system" and not ver.boot.changed) or if mode == "update" and unchanged(dependency) then
(dependency == "graphics" and not ver.graphics.changed) or
(not ver.app.changed)) then
pkg_message("skipping install of unchanged package", dependency) pkg_message("skipping install of unchanged package", dependency)
else else
pkg_message("installing package", dependency) pkg_message("installing package", dependency)

View File

@ -7,7 +7,7 @@ local flasher = require("graphics.flasher")
local core = {} local core = {}
core.version = "1.0.0-test2" core.version = "1.0.0-test3"
core.flasher = flasher core.flasher = flasher
core.events = events core.events = events