Advertisement
melzneni

TURTI2_INSTALLER

Jun 27th, 2025 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.21 KB | None | 0 0
  1. local args = { ... }
  2.  
  3. local TURTI_ROOT_FOLDER = "/TURTI_OS_2.0"
  4. local TEMP_GIT_API_FILE = "/temp_turti_installation_file"
  5.  
  6. if #args < 4 then
  7.     error("please provide the following arguments: <gitApi(Pastebin)> <git-user> <repo> <library> (optional: <token>)")
  8. end
  9.  
  10. local gitApiPastebinId = args[1]
  11. local gitUser = args[2]
  12. local gitRepo = args[3]
  13. local library = args[4]
  14. local token = args[5]
  15.  
  16. local function install()
  17.     shell.execute("pastebin", "get", gitApiPastebinId, TEMP_GIT_API_FILE)
  18.  
  19.     local gitApi = require(TEMP_GIT_API_FILE)
  20.  
  21.     if not fs.exists(TURTI_ROOT_FOLDER) then
  22.         fs.makeDir(TURTI_ROOT_FOLDER)
  23.     end
  24.  
  25.     gitApi.token = token
  26.     gitApi.checkoutLibrary(gitUser, gitRepo, library, TURTI_ROOT_FOLDER)
  27.  
  28.     if fs.exists(TURTI_ROOT_FOLDER .. "/setup.lua") then
  29.         shell.execute(TURTI_ROOT_FOLDER .. "/setup.lua")
  30.     end
  31. end
  32.  
  33. local status, err = xpcall(install, debug.traceback)
  34.  
  35. if not status then
  36.     print("Installation failed (see turti_err.log)")
  37.     local errFile = fs.open("turti_err.log", "w")
  38.     errFile.write(err)
  39.     errFile.close()
  40. else
  41.     print("Installation successful")
  42. end
  43. if fs.exists(TEMP_GIT_API_FILE) then
  44.     fs.delete(TEMP_GIT_API_FILE)
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement