mirror of
https://github.com/DigitalDevices/octonet.git
synced 2023-10-10 13:36:52 +02:00
32 lines
727 B
Lua
32 lines
727 B
Lua
#!/usr/bin/lua
|
|
|
|
local host = os.getenv("HTTP_HOST")
|
|
local proto = os.getenv("SERVER_PROTOCOL")
|
|
local query = os.getenv("QUERY_STRING")
|
|
|
|
function http_print(s)
|
|
if s then
|
|
io.stdout:write(tostring(s).."\r\n")
|
|
else
|
|
io.stdout:write("\r\n")
|
|
end
|
|
end
|
|
|
|
local userver = "download.digital-devices.de/download/linux/beta"
|
|
|
|
if query == "set=beta" then
|
|
local file = io.open("/config/updateserver","w")
|
|
if file then
|
|
file:write(userver.."\n")
|
|
file:close()
|
|
end
|
|
elseif query == "set=std" then
|
|
os.remove("/config/updateserver")
|
|
os.execute("rm -f /config/octonet.*.img")
|
|
os.execute("rm -f /config/octonet.*.sha")
|
|
end
|
|
|
|
http_print(proto.." 303")
|
|
http_print("Location: http://"..host.."/update.html")
|
|
http_print("")
|