Advertisement
Guest User

osload.lua

a guest
Feb 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. if not term.isColor() then
  2.     error("PC doesn't support colors.")
  3. end
  4. local bootimg = "/sys/kernel/.bootimg"
  5. local w,h = term.getSize()
  6. local tLines = {}
  7. a = fs.open(bootimg,"r")
  8. repeat
  9.   sLine = a.readLine()
  10.   table.insert(tLines,sLine)
  11. until not sLine
  12. a.close()
  13. local x = nil
  14. local y = nil
  15. local tLengths = {}
  16. for i=1,#tLines do
  17.    slen = string.len(tLines[i])
  18.    table.insert(tLengths,slen)
  19.    table.sort(tLengths)
  20. end
  21. local xCenter = math.floor((w/2) - (tLengths[#tLengths]/2))
  22. local yCenter = math.floor((h/2) - (#tLengths/2))
  23. term.setBackgroundColor(colors.lightGray)
  24. term.setTextColor(colors.gray)
  25. term.clear()
  26. term.setCursorPos(xCenter,yCenter)
  27. local img = paintutils.loadImage(bootimg)
  28. x,y = term.getCursorPos()
  29. paintutils.drawImage(img,xCenter,y-1)
  30. x,y = term.getCursorPos()
  31. local ostxt1 = "Debian 1.0 Raspbian"
  32. local ostxt2 = "v.2018 CC Edition"
  33. term.setBackgroundColor(colors.lightGray)
  34. term.setCursorPos(math.floor((w/2) - (string.len(ostxt1)/2)), y+2)
  35. write(ostxt1)
  36. x,y = term.getCursorPos()
  37. term.setCursorPos(math.floor((w/2) - (string.len(ostxt2)/2)), y+1)
  38. write(ostxt2)
  39. x,y = term.getCursorPos()
  40. term.setCursorPos(1,y+1)
  41. sleep(3)
  42. term.setBackgroundColor(colors.black)
  43. term.setTextColor(colors.white)
  44. term.clear()
  45. term.setCursorPos(1, 1)
  46. shell.run("/sys/kernel/apiload")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement