Advertisement
MaximumFrank

recovery

Mar 25th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. function update()
  2. --for a later date
  3. end
  4.  
  5. function recoverAll()
  6. --delete all folders and files (except recovery, that is)
  7. fs.delete(funcPath)
  8. fs.delete(regPath)
  9. fs.delete(sysPath .. "main")
  10. fs.delete(sysPath .. "ui")
  11. fs.delete(usrPath)
  12. fs.delete(prgPath)
  13. fs.delete(rootPath .. "params")
  14. fs.delete(rootPath .. "startup")
  15. fs.delete(prgPath .. "calcPlus")
  16. fs.delete(prgPath .. "luaIDE")
  17. fs.delete(prgPath .. "ink")
  18.  
  19. --recreate the folder structure
  20. fs.makeDir(osFilesPath)
  21. fs.makeDir(sysPath)
  22. fs.makeDir(funcPath)
  23. fs.makeDir(regPath)
  24. fs.makeDir(usrPath)
  25. fs.makeDir(usrPath .. "Admin")
  26. fs.makeDir(prgPath)
  27. if not fs.exists(prgPath) then
  28. fs.makeDir(prgPath)
  29. end
  30.  
  31. --recreate the files
  32. fs.copy(restPath .. "cred", funcPath .. "cred")
  33. --fs.copy(restPath .. "debug", funcPath .. "debug")
  34. fs.copy(restPath .. "func", funcPath .. "func")
  35. fs.copy(restPath .. "periph", funcPath .. "periph")
  36. fs.copy(restPath .. "prg", regPath .. "prg")
  37. --fs.copy(restPath .. "settings", regPath .. "settings")
  38. fs.copy(restPath .. "usr", regPath .. "usr")
  39. fs.copy(restPath .. "main", sysPath .. "main")
  40. fs.copy(restPath .. "ui", sysPath .. "ui")
  41. fs.copy(restPath .. "Aset", usrPath .. "Admin/settings")
  42. fs.copy(restPath .. "startup", rootPath .. "startup")
  43. fs.copy(restPath .. "params", rootPath .. "params")
  44. fs.copy(restPath .. "luaIDE", prgPath .. "luaIDE")
  45. fs.copy(restPath .. "calcPlus", prgPath .. "calcPlus")
  46. fs.copy(restPath .. "ink", prgPath .. "ink")
  47.  
  48. os.reboot()
  49. end
  50.  
  51. function recoverSys()
  52. --delete system folders and files
  53. fs.delete(funcPath)
  54. fs.delete(regPath)
  55. fs.delete(sysPath .. "main")
  56. fs.delete(sysPath .. "ui")
  57. fs.delete(rootPath .. "startup")
  58. fs.delete(rootPath .. "params")
  59. fs.delete(prgPath .. "calcPlus")
  60. fs.delete(prgPath .. "luaIDE")
  61. fs.delete(prgPath .. "ink")
  62.  
  63. --recreate folder structure
  64. fs.makeDir(funcPath)
  65. fs.makeDir(regPath)
  66. if not fs.exists(prgPath) then
  67. fs.makeDir(prgPath)
  68. end
  69.  
  70. --recreate the files
  71. fs.copy(restPath .. "main", sysPath .. "main")
  72. fs.copy(restPath .. "ui", sysPath .. "ui")
  73. fs.copy(restPath .. "startup", rootPath .. "startup")
  74. fs.copy(restPath .. "params", rootPath .. "params")
  75. fs.copy(restPath .. "luaIDE", prgPath .. "luaIDE")
  76. fs.copy(restPath .. "calcPlus", prgPath .. "calcPlus")
  77. fs.copy(restPath .. "ink", prgPath .. "ink")
  78.  
  79. os.reboot()
  80. end
  81.  
  82. function recover(arg)
  83. if arg == 1 then
  84. recoverSys()
  85. elseif arg == 2 then
  86. recoverAll()
  87. end
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement