-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdl.lua
More file actions
22 lines (19 loc) · 664 Bytes
/
dl.lua
File metadata and controls
22 lines (19 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local arg = { ... }
local file = arg[1]
local url = "https://raw.githubusercontent.com/mmseng/ocscripts/master/" .. file
local path = "/home/" .. file
-- If path exists, get length of file
-- TODO: change this to getting the whole file as a string and compare actual content (i.e. diff)
--local exists =
--local length = 0
--if exists then
-- length =
--end
-- Download file and overwrite
local shell = require("shell")
shell.execute("wget -f " .. url .. " " .. file)
-- Check length of new file and warn if length hasn't changed
--local newLength =
--if length == newLength then
--io.write("Warning: new file is the same length as overwritten file."
--end