|
|
@ -90,14 +90,17 @@ function get_available_versions(satellite) |
|
|
|
return |
|
|
|
end |
|
|
|
|
|
|
|
io.write("\x1B[1K\r" .. satellite .. ": Downloading update file...") |
|
|
|
io.stderr:write("\x1B[1K\r") |
|
|
|
io.stderr:write(satellite .. ": Downloading update file...") |
|
|
|
local update_file = download(update_url) |
|
|
|
if not update_file then |
|
|
|
print("\x1B[1K\rWARNING: " .. satellite .. ": Failed to download " .. update_url) |
|
|
|
io.stderr:write("\x1B[1K\r") |
|
|
|
print("WARNING: " .. satellite .. ": Failed to download " .. update_url) |
|
|
|
return |
|
|
|
end |
|
|
|
|
|
|
|
io.write("\x1B[1K\r" .. satellite .. ": Getting available versions...") |
|
|
|
io.stderr:write("\x1B[1K\r") |
|
|
|
io.stderr:write(satellite .. ": Getting available versions...") |
|
|
|
-- Try getting variable update_names, get downloads otherwise. |
|
|
|
local update_names = astrohelp(satellite, "variable update_names") |
|
|
|
if not update_names then |
|
|
@ -130,11 +133,13 @@ function get_available_versions(satellite) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
io.stderr:write("\x1B[1K\r") |
|
|
|
|
|
|
|
if count < 1 then |
|
|
|
print("\x1B[1K\rWARNING: " .. satellite .. ": Couldn't retrieve any versions") |
|
|
|
print("WARNING: " .. satellite .. ": Couldn't retrieve any versions") |
|
|
|
return |
|
|
|
elseif not versions[version] then |
|
|
|
print("\x1B[1K\rWARNING: " .. satellite .. ": Current version isn't available") |
|
|
|
print("WARNING: " .. satellite .. ": Current version isn't available") |
|
|
|
end |
|
|
|
|
|
|
|
return versions, update_url |
|
|
@ -161,7 +166,7 @@ function check_new_versions(satellite, version_file_path) |
|
|
|
old_versions[version] = true |
|
|
|
end |
|
|
|
else |
|
|
|
print("\x1B[1K\r" .. satellite .. ": First check") |
|
|
|
print(satellite .. ": First check") |
|
|
|
version_file = io.open(version_file_path, "w") |
|
|
|
assert(version_file, "Failed to create " .. version_file_path) |
|
|
|
end |
|
|
@ -180,11 +185,11 @@ function check_new_versions(satellite, version_file_path) |
|
|
|
end |
|
|
|
|
|
|
|
if #new_versions > 0 then |
|
|
|
print("\x1B[1K\r" .. satellite .. ": From '" .. update_url .. "'") |
|
|
|
print(satellite .. ": From '" .. update_url .. "'") |
|
|
|
|
|
|
|
for _, version in ipairs(new_versions) do |
|
|
|
version_file:write(version .. "\n") |
|
|
|
print("\x1B[1K\r" .. satellite .. ": " .. version) |
|
|
|
print(satellite .. ": " .. version) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
@ -214,11 +219,11 @@ elseif arg[1] == "dir" then |
|
|
|
if cols then |
|
|
|
cols = tonumber(cols) |
|
|
|
local countstr = tostring(count) .. "/" .. tostring(total) |
|
|
|
io.write("\r") |
|
|
|
io.stderr:write("\r") |
|
|
|
for i = 1, cols - countstr:len() - 1 do |
|
|
|
io.write(" ") |
|
|
|
io.stderr:write(" ") |
|
|
|
end |
|
|
|
io.write(countstr .. "\r") |
|
|
|
io.stderr:write(countstr .. "\r") |
|
|
|
end |
|
|
|
|
|
|
|
local version_file = version_dir .. "/" .. satellite |
|
|
|