Initialize modular ATM10 CC control system

This commit is contained in:
2026-07-13 02:46:11 +02:00
commit 5362d31036
28 changed files with 331 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
local BASE_URL = "https://git.peli-server.de/Dystroyer8/ATM10_CC_Codes/raw/branch/main/"
local function fail(message)
printError(message)
error(message, 0)
end
local function fetch(path)
local response, reason = http.get(BASE_URL .. path)
if not response then fail("Download fehlgeschlagen: " .. path .. " (" .. tostring(reason) .. ")") end
local body = response.readAll()
response.close()
return body
end
local function writeFile(path, content)
local directory = fs.getDir(path)
if directory ~= "" and not fs.exists(directory) then fs.makeDir(directory) end
local temporary = path .. ".tmp"
local handle = assert(fs.open(temporary, "w"))
handle.write(content)
handle.close()
if fs.exists(path) then fs.delete(path) end
fs.move(temporary, path)
end
print("ATM10 Control bootstrap")
local manifestText = fetch("manifest.lua")
local manifestFn, loadError = load(manifestText, "manifest", "t", {})
if not manifestFn then fail("Manifest ungueltig: " .. tostring(loadError)) end
local manifest = manifestFn()
for index, path in ipairs(manifest.files) do
write(("[%d/%d] %s"):format(index, #manifest.files, path))
writeFile(path, fetch(path))
print(" OK")
end
if not fs.exists("config/local.lua") then
writeFile("config/local.lua", fetch("config/example.lua"))
end
writeFile(".atm10-version", manifest.version .. "\n")
print("Installation abgeschlossen. Konfiguriere config/local.lua und starte neu.")