Skip to content

Instantly share code, notes, and snippets.

@Alee14
Last active March 13, 2023 01:50
Show Gist options
  • Save Alee14/b9c0228ef165f51dd00e9af7a59ee86a to your computer and use it in GitHub Desktop.
Save Alee14/b9c0228ef165f51dd00e9af7a59ee86a to your computer and use it in GitHub Desktop.
[ComputerCraft UI] bits-UI Installer
-- bits-UI Installer: Version 0.2. Licensed with GPL-3.0 and created by Alee14
term.clear()
term.setCursorPos(1,1)
if term.isColor() then
if fs.exists("/System/bits-UI.exists") then
print("Starting the bits-UI Updater...")
else
print("Starting the bits-UI Installer...")
end
print("Are you sure you want to install/update this computer? [y/n]")
local input = read()
if input == "y" then
if fs.exists("/startup.lua") then
shell.run("mv", "startup.lua", "startup.old")
end
--GitGet API by apemanzilla
term.setCursorPos(1,2)
local username = "Alee14"
local repo = "bits-UI"
function hte()
shell.run("pastebin", "get", "W5ZkVYSi", "gitget")
shell.run("gitget", username, repo)
end
if http then
hte()
else
print("[ERROR] HTTP not enabled. App will not continue.")
end
if fs.exists ("installer.lua") then
fs.delete("installer.lua")
else
print("[INFO] Failed attempting to delete installer.lua. Skipping")
end
if fs.exists ("json") then
fs.delete("json")
else
print("[INFO] Failed attempting to delete json. Skipping")
end
if fs.exists ("gitget") then
fs.delete("gitget")
else
print("[INFO] Failed attempting to delete gitget. Skipping")
end
if fs.exists (".gitignore") then
fs.delete(".gitignore")
else
print("[INFO] Failed attempting to delete .gitignore. Skipping")
end
print("[INFO] System will now reboot!")
sleep(2)
os.reboot()
elseif input == "n" then
if fs.exists("/startup") then
shell.run("startup")
else
os.reboot()
return
end
end
else
print("[ERROR] This is a basic computer, setup will not continue...")
sleep(3)
os.shutdown()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment