From: Olav Bakke Svendsen Date: Fri, 24 May 2024 18:45:51 +0000 (+0200) Subject: Download and install from live repo X-Git-Tag: skystone~6 X-Git-Url: http://git.olavbs.no/?a=commitdiff_plain;h=aa5012b6a172302f90215a343dd2b674c9a19e02;p=cc.git Download and install from live repo --- diff --git a/common/dl.lua b/common/dl.lua index e6b7f9f..93040ba 100644 --- a/common/dl.lua +++ b/common/dl.lua @@ -1,7 +1,8 @@ -- dl.lua -- download from git repo -- usage: --- dl repo[:tag] remote/path:local/path[:o] [remote/path:local/path[:o] ...] +-- dl repo[:tag] remote/path:local/path[:o] [remote/path:local/path[:o] ...] -- downloads from git repo +-- dl live remote/path:local/path[:o] [remote/path:local/path[:o] ...] -- downloads from live repo local args = {...} local repo = "" @@ -20,7 +21,11 @@ do end for _, file in pairs(files) do - local url = "https://git.olavbs.no/?p="..repo..".git;a=blob_plain;f="..file.from..";hb="..tag + if repo = "live" then + local url = "https://cc.olavbs.no/live/"..file.from + else + local url = "https://git.olavbs.no/?p="..repo..".git;a=blob_plain;f="..file.from..";hb="..tag + end if fs.exists(file.to) and file.overwrite then local tmp = textutils.serialize(math.random(100000,999999)) local ok = shell.run("wget "..url.." "..tmp) diff --git a/common/install.lua b/common/install.lua index 08934f1..0e0af59 100644 --- a/common/install.lua +++ b/common/install.lua @@ -1,12 +1,24 @@ -- install.lua --- looks for package-file in git repo and runs dl.lua on every line +-- looks for package-file in repo and runs dl.lua on every line -- usage: --- install repo:[tag] remote/path +-- install repo:[tag] remote/path install package from git repo +-- install live remote/path install package from live repo + local args = {...} + +local repo = args[1] +local path = args[2] + +local live = repo == "live" + local tmp = textutils.serialize(math.random(100000,999999)) -shell.run("dl "..args[1].." "..args[2].."/package:"..tmp) +shell.run("dl "..repo.." "..path.."/package:"..tmp) local file = fs.open(tmp, "r") for line in file.readLine do - shell.run("dl "..line) + if live then + shell.run("dl "..string.gsub(line, "^.-%s+", "live ")) + else + shell.run("dl "..line) + end end fs.delete(tmp)