Advertisement
Guest User

Computercraft: UBUNOS file: startup

a guest
Jul 31st, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. end
  2. end
  3. shell.run('clear')
  4. while true do
  5. print('UbunOS v1\n>')
  6. local cmd=read()
  7. if cmd=='network' then
  8. print('Wifi options\n{1} Open\n{2} Close\n{3} Use\n{4} Exit')
  9. local choice=read()
  10. if choice=='1' then
  11. print('Enter modem direction { bottom/top/left/right/front/back }')
  12. rednet.open(read())
  13. elseif choice=='2' then
  14. print('Enter modem direction { bottom/top/left/rigth/front/back }')
  15. local side=read()
  16. if rednet.isOpen(side) then
  17. rednet.close(side)
  18. else
  19. print('No modem in this direction')
  20. end
  21. elseif choice=='3' then
  22. print('Enter modem direction { bottom/top/left/right/front/back }')
  23. wifi(read())
  24. elseif choice=='4' then
  25. UbunOS()
  26. end
  27. elseif cmd=='shutdown' then
  28. os.shutdown()
  29. elseif cmd=='reboot' then
  30. os.reboot()
  31. else
  32. print('Bad command !')
  33. end
  34. end
  35. end
  36. function startOs()
  37. term.clear()
  38. term.setCursorPos(2, 1)
  39. print('\n{1} Run UbunOS\n{2} Shutdown computer')
  40. local choice=read()
  41. if choice=='1' then
  42. UbunOS()
  43. elseif choice=="2" then
  44. print('Shutdown...')
  45. sleep(2)
  46. os.shutdown()
  47. end
  48. end
  49. print('\n{1} CraftOs\n{2} UbunOS')
  50. local choice=read()
  51. if choice=="1" then
  52. shell.run('clear')
  53. shell.run('shell')
  54. elseif choice=="2" then
  55. if fs.exists('/ubunos/') then
  56. startOs()
  57. else
  58. shell.run('/disk/install/')
  59. startOs()
  60. end
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement