mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#145 removed unneeded references to config.lua files + some minification
This commit is contained in:
parent
a330249c7e
commit
76f21e925b
29
ccmsi.lua
29
ccmsi.lua
@ -18,7 +18,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.12b"
|
local CCMSI_VERSION = "v1.13"
|
||||||
|
|
||||||
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/"
|
||||||
@ -159,7 +159,7 @@ local function _clean_dir(dir, tree)
|
|||||||
if fs.isDir(path) then
|
if fs.isDir(path) then
|
||||||
_clean_dir(path, tree[val])
|
_clean_dir(path, tree[val])
|
||||||
if #fs.list(path) == 0 then fs.delete(path);println("deleted "..path) end
|
if #fs.list(path) == 0 then fs.delete(path);println("deleted "..path) end
|
||||||
elseif (not _in_array(val, tree)) and (val ~= "config.lua" ) then ---@fixme remove condition after migration to settings files
|
elseif (not _in_array(val, tree)) and (val ~= "config.lua" ) then
|
||||||
fs.delete(path)
|
fs.delete(path)
|
||||||
println("deleted "..path)
|
println("deleted "..path)
|
||||||
end
|
end
|
||||||
@ -202,8 +202,8 @@ if #opts == 0 or opts[1] == "help" then
|
|||||||
yellow()
|
yellow()
|
||||||
println(" ccmsi check <branch> for target")
|
println(" ccmsi check <branch> for target")
|
||||||
lgray()
|
lgray()
|
||||||
println(" install - fresh install, overwrites config.lua")
|
println(" install - fresh install")
|
||||||
println(" update - update files EXCEPT for config.lua")
|
println(" update - update files")
|
||||||
println(" uninstall - delete files INCLUDING config/logs")
|
println(" uninstall - delete files INCLUDING config/logs")
|
||||||
white();println("<app>");lgray()
|
white();println("<app>");lgray()
|
||||||
println(" reactor-plc - reactor PLC firmware")
|
println(" reactor-plc - reactor PLC firmware")
|
||||||
@ -342,13 +342,8 @@ elseif mode == "install" or mode == "update" then
|
|||||||
ver.lockbox.v_remote = manifest.versions.lockbox
|
ver.lockbox.v_remote = manifest.versions.lockbox
|
||||||
|
|
||||||
green()
|
green()
|
||||||
if mode == "install" then
|
if mode == "install" then println("Installing ") else println("Updating ") end
|
||||||
println("Installing " .. app .. " files...")
|
println(app.." files...");white()
|
||||||
elseif mode == "update" then
|
|
||||||
if app == "pocket" then println("Updating " .. app .. " files... (keeping old config.lua)")
|
|
||||||
else println("Updating " .. app .. " files...") end
|
|
||||||
end
|
|
||||||
white()
|
|
||||||
|
|
||||||
ver.boot.changed = show_pkg_change("bootldr", ver.boot)
|
ver.boot.changed = show_pkg_change("bootldr", ver.boot)
|
||||||
ver.common.changed = show_pkg_change("common", ver.common)
|
ver.common.changed = show_pkg_change("common", ver.common)
|
||||||
@ -374,7 +369,6 @@ elseif mode == "install" or mode == "update" then
|
|||||||
local file_list = manifest.files
|
local file_list = manifest.files
|
||||||
local size_list = manifest.sizes
|
local size_list = manifest.sizes
|
||||||
local dependencies = manifest.depends[app]
|
local dependencies = manifest.depends[app]
|
||||||
local config_file = app .. "/config.lua"
|
|
||||||
|
|
||||||
table.insert(dependencies, app)
|
table.insert(dependencies, app)
|
||||||
|
|
||||||
@ -448,7 +442,6 @@ elseif mode == "install" or mode == "update" then
|
|||||||
|
|
||||||
local files = file_list[dependency]
|
local files = file_list[dependency]
|
||||||
for _, file in pairs(files) do
|
for _, file in pairs(files) do
|
||||||
if mode == "install" or file ~= config_file then
|
|
||||||
local temp_file = install_dir.."/"..file
|
local temp_file = install_dir.."/"..file
|
||||||
if fs.exists(file) then fs.delete(file) end
|
if fs.exists(file) then fs.delete(file) end
|
||||||
fs.move(temp_file, file)
|
fs.move(temp_file, file)
|
||||||
@ -456,7 +449,6 @@ elseif mode == "install" or mode == "update" then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
fs.delete(install_dir)
|
fs.delete(install_dir)
|
||||||
|
|
||||||
@ -485,7 +477,6 @@ elseif mode == "install" or mode == "update" then
|
|||||||
|
|
||||||
local files = file_list[dependency]
|
local files = file_list[dependency]
|
||||||
for _, file in pairs(files) do
|
for _, file in pairs(files) do
|
||||||
if mode == "install" or file ~= config_file then
|
|
||||||
println("GET "..file)
|
println("GET "..file)
|
||||||
local dl, err = http.get(repo_path..file)
|
local dl, err = http.get(repo_path..file)
|
||||||
|
|
||||||
@ -501,7 +492,6 @@ elseif mode == "install" or mode == "update" then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if success then
|
if success then
|
||||||
write_install_manifest(manifest, dependencies)
|
write_install_manifest(manifest, dependencies)
|
||||||
@ -592,9 +582,12 @@ elseif mode == "uninstall" then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if fs.exists(legacy_config_file) then
|
||||||
|
fs.delete(legacy_config_file);println("deleted "..legacy_config_file)
|
||||||
|
end
|
||||||
|
|
||||||
if fs.exists(settings_file) then
|
if fs.exists(settings_file) then
|
||||||
fs.delete(settings_file)
|
fs.delete(settings_file);println("deleted "..settings_file)
|
||||||
println("deleted " .. settings_file)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
fs.delete("install_manifest.json")
|
fs.delete("install_manifest.json")
|
||||||
|
Loading…
Reference in New Issue
Block a user