Fixes
authorOlav Bakke Svendsen <mail@olavbs.no>
Tue, 17 Oct 2023 22:04:31 +0000 (00:04 +0200)
committerOlav Bakke Svendsen <mail@olavbs.no>
Tue, 17 Oct 2023 22:04:31 +0000 (00:04 +0200)
common/dl.lua

index 5eb2e8169e218ad6c091f6f3375a0d8e8486dc09..e6b7f9f413f2880c69b6282cce8dabaa75f560c2 100644 (file)
@@ -3,13 +3,13 @@
 -- usage:
 -- dl repo[:tag] remote/path:local/path[:o] [remote/path:local/path[:o] ...]
 
-local args = table.unpack({...})
+local args = {...}
 local repo = ""
 local tag = ""
 local files = {}
 do
   local repotag = table.remove(args, 1)
-  repo, tag = string.match(args[1], "^([^:]+):?(.*)$")
+  repo, tag = string.match(repotag, "^([^:]+):?(.*)$")
   if tag == "" then tag = "HEAD" end
   for _, file in pairs(args) do
     local from, rest = string.match(file, "^/?([^:%s]+):?(.*)$")
@@ -20,16 +20,16 @@ do
 end
 
 for _, file in pairs(files) do
-  local url = "https://git.olavbs.no/?p="..repo..".git;a=blob_plain;f="..from..";hb="..tag
+  local url = "https://git.olavbs.no/?p="..repo..".git;a=blob_plain;f="..file.from..";hb="..tag
   if fs.exists(file.to) and file.overwrite then
     local tmp = textutils.serialize(math.random(100000,999999))
-    local ok = shell.run("wget "..file.from.." "..tmp)
+    local ok = shell.run("wget "..url.." "..tmp)
     if ok then
       print("Overwriting "..file.to)
       fs.delete(file.to)
       fs.move(tmp,file.to)
     end
   else
-    shell.run("wget "..file.from.." "..file.to)
+    shell.run("wget "..url.." "..file.to)
   end
 end