Timendainum

install

Nov 27th, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. -- install
  2. -- by Timendainum
  3. ---------------------------------------------------
  4.  
  5. ---------------------------------------------------
  6. -- functions
  7. ---------------------------------------------------
  8. local function fsProtect(file)
  9.     -- make sure path exists
  10.     local path = string.gsub(file, fs.getName(file), "")
  11.     if string.len(path) > 0 and not fs.isDir(path) then
  12.             fs.makeDir(path)
  13.     else
  14.         -- if file exists delete it
  15.         if fs.exists(file) then
  16.             fs.delete(file)
  17.         end
  18.     end
  19. end
  20.  
  21. local function installPre(file, path)
  22.     print("Installing prerequisite: " .. file)
  23.     fsProtect(file)
  24.     shell.run("github", path, file)
  25. end
  26.  
  27. local function installPreAPI(file, path)
  28.     print("Installing prerequisite API: " .. file)
  29.     installPre(file, path)
  30.     print("Loading " .. file)
  31.     os.loadAPI(file)
  32. end
  33.    
  34. ---------------------------------------------------
  35. -- main
  36. ---------------------------------------------------
  37. print("Installing base system...")
  38.  
  39. ---------------------------------------------------
  40. print("Installing installer perequisites...")
  41.  
  42. print("Installing github...")
  43. local file = "github"
  44. local code = "knix7nQp"
  45. fsProtect(file)
  46. shell.run("pastebin", "get", code, file)
  47.  
  48. installPreAPI("opt/lib/txt", "Timendainum/Wintermute/master/opt/lib/txt.lua")
  49. installPreAPI("opt/lib/config", "Timendainum/Wintermute/master/opt/lib/config.lua")
  50.  
  51. ---------------------------------------------------
  52. file = "opt/installer"
  53. code = "Timendainum/Wintermute/master/opt/installer.lua"
  54. installPre(file, code)
  55.  
  56. ---------------------------------------------------
  57. --Executing installer
  58. shell.run(file)
Advertisement
Add Comment
Please, Sign In to add comment