Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- local booColor = false -- Create variable local to only the function
- if term.isColor ~= nil then -- Test to see if term.isColor even exists within ComputerCraft
- booColor = term.isColor() -- If it is then set the booColor to either true or false
- if booColor == false then
- print("derekseitz's code detects this is a normal computer and installation will not start.") -- This will trigger if on a Stone Computer of the latest version
- else
- print("derekseitz's code detects this is a color computer and installation will start.") -- This will trigger if on a Advanced Computer of the latest version
- os.pullEvent()
- term.setBackgroundColor(colors.blue)
- term.clear()
- root = "http://www.lozengia.com/tmas/Downloads/Minecraft/craftoid2/1.1/"
- print("Installing craftoid from:" .. root)
- print("Defining Funtions")
- function setdir(directory)
- if fs.exists(directory) == false then
- fs.makeDir(directory)
- end
- end
- function downloadfile(file)
- if fs.exists(file) then
- fs.delete( file )
- end
- local response = http.get(root .. file)
- if response then
- while response do
- local sResponse = response.readAll()
- response.close()
- cache = shell.resolve( file )
- local file = fs.open( cache, "w" )
- file.write( sResponse )
- file.close()
- response = nil
- end
- end
- end
- print("Defining files to install")
- directorys = { "installed", "sdcard", "sdcard/downloads" }
- files = { "startup", "craftoid.nfp", "craftoidOS", "dateAPI", "lockscreen.ico", "lockscreen.nfp", "settingscreen.nfp", "installed/missingicon.ico", "installed/adventure", "installed/adventure.ico", "installed/appstore", "installed/appstore.ico", "installed/ccTube", "installed/ccTube.ico", "installed/dj", "installed/dj.ico", "installed/edit", "installed/edit.ico", "installed/firebox", "installed/firebox.ico", "installed/html", "installed/html.ico", "installed/gps", "installed/gps.ico", "installed/html", "installed/html.ico", "installed/id", "installed/id.ico", "installed/paint", "installed/paint.ico", "installed/pastebin", "installed/pastebin.ico", "installed/shell", "installed/shell.ico", "installed/time", "installed/time.ico", "installed/worm", "installed/worm.ico" }
- i = 1
- while directorys[i] do
- print("Creating directory:" .. directorys[i])
- setdir(directorys[i])
- i=i+1
- end
- i = 1
- while files[i] do
- print("Downloading File:" .. files[i])
- downloadfile(files[i])
- i=i+1
- end
- print("Rebooting")
- shell.run("reboot")
- end
- else
- print("derekseitz's code detects this is a older version and installation will not start.") -- This will trigger if on a Stone Computer of the latest version
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement