optimussnorr

Linear OS Installer

Oct 11th, 2014
503
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function centerPrint(msg)
  2.  msgLen = string.len(msg)
  3.  screenWidth,_ = term.getSize()
  4.  xCoords = tonumber(math.ceil((screenWidth / 2) - (msgLen / 2)))
  5.  _,termY = term.getCursorPos()
  6.  term.setCursorPos(xCoords,termY)
  7.  print(msg)
  8.  return xCoords
  9. end
  10. function clear(x,y)
  11.  term.clear()
  12.  term.setCursorPos(x,y)
  13. end
  14. function pos(x,y)
  15.  term.setCursorPos(x,y)
  16. end
  17. function tCol(color)
  18.  term.setTextColor(color)
  19. end
  20. function bCol(color)
  21.  term.setBackgroundColor(color)
  22. end
  23. function cLine()
  24.  term.clearLine()
  25. end
  26. tCol(colors.black)
  27. bCol(colors.white)
  28. clear(1,8)
  29. centerPrint("Installing LinearOS")
  30.  
  31.  
  32.  
  33. local k1 = 0
  34. function get(repo,saveTo)
  35.  local response = http.get("https://raw.githubusercontent.com/mrdawgza/linearos/master/1.5.1/"..repo)
  36.  local carry = response.readAll()
  37.  response.close()
  38.  local file = fs.open(saveTo,"w")
  39.  file.write(carry)
  40.  file.close()
  41.  clear(1,1)
  42.  pos(1,8)
  43.  
  44.  clear(1,1)
  45.  pos(1,8)
  46.  local k2 = k1+6.25
  47.  k1 = k2
  48.  centerPrint(k1.."%")
  49.  centerPrint("completed")
  50.  sleep(0.5)
  51. end
  52.  
  53. fs.makeDir("linear/system/apis")
  54. fs.makeDir("linear/userFolders")
  55. fs.makeDir("linear/programs")
  56. fs.makeDir("linear/system/imgs")
  57.  
  58. get("startup","startup")
  59. get("linear/system/appStore.ls","linear/system/appStore.ls")
  60. get("linear/system/bootLinear.ls","linear/system/bootLinear.ls")
  61. get("linear/system/desktop.ls","linear/system/desktop.ls")
  62. get("linear/system/fileBrowser.ls","linear/system/fileBrowser.ls")
  63. get("linear/system/loados.ls","linear/system/loados.ls")
  64. get("linear/system/programManager.ls","linear/system/programManager.ls")
  65. get("linear/system/settings.ls","linear/system/settings.ls")
  66. get("linear/system/userScreen.ls","linear/system/userScreen.ls")
  67.  
  68. get("linear/system/apis/centerPrint.ls","linear/system/apis/centerPrint.ls")
  69. get("linear/system/apis/sha256.ls","linear/system/apis/sha256.ls")
  70. get("linear/system/apis/term.ls","linear/system/apis/term.ls")
  71. get("linear/system/apis/user.ls","linear/system/apis/user.ls")
  72.  
  73. get("linear/system/imgs/bootScreen.lsg","linear/system/imgs/bootScreen.lsg")
  74. get("linear/system/imgs/defaultBg.lsg","linear/system/imgs/defaultBg.lsg")
  75. get("linear/system/imgs/logo.lsg","linear/system/imgs/logo.lsg")
  76.  
  77. sleep(1.5)
  78.  
  79. clear(1,7)
  80. centerPrint("Installation complete")
  81. centerPrint("Press any key to reboot.")
  82. os.pullEvent("key")
  83.  
  84. os.reboot()
RAW Paste Data