Files
ccde/installer.lua
2025-10-23 21:27:36 -07:00

50 lines
2.8 KiB
Lua

local expect = require "cc.expect".expect
local function download_to(url,path)
expect(1, url, "string")
expect(2, path, "string")
term.write(path)
if not http.checkURL(url) then error("URL is not valid" ,2) end
local data = http.get(url).readAll()
fs.makeDir(fs.getDir(path))
local file = fs.open(path,"w")
if not file then error("Failed to open file", 2) end
file.write(data)
file.close()
print(" OK")
end
write("Do you want to setup netmount?\n(Y/n) ")
local netmount = read():sub(1,1):lower() ~= "n"
if netmount then
write("URL: ")
settings.set("netmount.url", read())
write("Username: ")
settings.set("netmount.username", read())
write("Password: ")
settings.set("netmount.password", read("\7"))
settings.save()
end
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/startup.lua","startup.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/modules/interactions.lua","modules/interactions.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/modules/keybinds.lua","modules/keybinds.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/modules/launcher.lua","modules/launcher.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/modules/entrypointclient.lua","modules/entrypointclient.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/libs/keybinds.lua","libs/keybinds.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/libs/compat.lua","libs/compat.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/libs/threading.lua","libs/threading.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/libs/window.lua","libs/window.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/apps/adventure.lua","apps/adventure.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/apps/shell.lua","apps/shell.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/apps/worm.lua","apps/worm.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/apps/launcher.lua","apps/launcher.lua")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/.apps/adventure.app",".apps/adventure.app")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/.apps/shell.app",".apps/shell.app")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/.apps/worm.app",".apps/worm.app")
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/.wallpaper.nfp",".wallpaper.nfp")
if netmount then
download_to("https://github.com/cadenthecreator/ccde/raw/refs/heads/main/modules/netmount.lua","modules/netmount.lua")
end