Left4Cake2

craftoidInstaller

Mar 18th, 2013
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. shell.run("clear")
  2. root = "http://www.lozengia.com/tmas/Downloads/Minecraft/craftoid/"
  3. print("Installing craftoid from:" .. root)
  4.  
  5. print("Defining Funtions")
  6. function setdir(directory)
  7.     if fs.exists(directory) == false then
  8.         fs.makeDir(directory)
  9.     end
  10. end
  11.  
  12. function downloadfile(file)
  13.     if fs.exists(file) then
  14.         fs.delete( file )
  15.     end
  16.    
  17.     local response = http.get(root .. file)
  18.     if response then
  19.         while response do
  20.             local sResponse = response.readAll()
  21.             response.close()
  22.             cache = shell.resolve( file )
  23.             local file = fs.open( cache, "w" )
  24.             file.write( sResponse )
  25.             file.close()
  26.             response = nil
  27.         end
  28.     end
  29. end
  30.  
  31. print("Defining files to install")
  32. directorys = { "installed" }
  33. files = { "startup", "craftoid.nfp", "lockscreen.ico", "installed/missingicon.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/gps", "installed/gps.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" }
  34.  
  35. i = 1
  36. while directorys[i] do
  37.     print("Creating directory:" .. directorys[i])
  38.     setdir(directorys[i])
  39.     i=i+1
  40. end
  41. i = 1
  42. while files[i] do
  43.     print("Downloading File:" .. files[i])
  44.     downloadfile(files[i])
  45.     i=i+1
  46. end
  47.  
  48. print("Rebooting")
  49. shell.run("reboot")
Advertisement
Add Comment
Please, Sign In to add comment