2015-08-05 22:22:06 +02:00
|
|
|
#!/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
|
|
|
|
|
2015-12-07 15:05:09 +01:00
|
|
|
local userver = "download.digital-devices.de/download/linux/beta"
|
2015-08-05 22:22:06 +02:00
|
|
|
|
|
|
|
if query == "set=beta" then
|
|
|
|
local file = io.open("/config/updateserver","w")
|
|
|
|
if file then
|
2015-12-07 15:05:09 +01:00
|
|
|
file:write(userver.."\n")
|
2015-08-05 22:22:06 +02:00
|
|
|
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("")
|