Sirshark10

Untitled

Jun 24th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. local libbb = ld.dlopen("/lib/libbitbucket.lua")
  2.  
  3.  
  4. local function mkdirs(user, repo, branch, path)
  5.  
  6.  
  7. local nPath = path:sub(path:find("/"))
  8.  
  9. if nPath:sub(1,1) ~= "/" then
  10. nPath = "/"..nPath
  11. end
  12.  
  13. local ret = libbb.get_dirs(user, repo, branch, path);
  14. local files = {}
  15. for k, v in pairs(ret) do
  16. if not syscall.exists(v) then
  17. syscall.mkdir(nPath.."/"..v);
  18. end
  19. files = libbb.get_files(user,repo,branch,path)
  20. for x,y in pairs(files) do
  21. if not syscall.exists(y) and y ~= "" then
  22. local file = fs.open(nPath.."/"..y,"w")
  23. local contents = libbb.read_file(user,repo,branch,y)
  24. file.write(contents)
  25. file.flush()
  26. file.close()
  27. end
  28. end
  29. if ret[1] == "" then
  30. return
  31. end
  32. mkdirs(user, repo, branch, path.."/"..v);
  33. end
  34. end
  35.  
  36.  
  37. local function install(user,repo,branch,path)
  38. mkdirs(user,repo,branch,path)
  39. end
  40.  
  41.  
  42. install("scoopta","scaptos2-repo","default","brainfuck")
Advertisement
Add Comment
Please, Sign In to add comment