Advertisement
Guest User

package manager wrapper

a guest
Oct 8th, 2015
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.66 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require_relative 'which'
  4. require_relative 'managers'
  5. require_relative 'pacman'
  6. require_relative 'apt-get'
  7.  
  8.  
  9. args=ARGV
  10. argsShift=[]
  11.  
  12. for i in args do
  13.   argsShift.push(i)
  14. end
  15.  
  16. argsShift.shift
  17.  
  18. for i in argsShift do
  19.   pkgArgs = "#{pkgArgs} #{i}"
  20. end
  21.  
  22. #package managers to check for
  23. pkgMgrs = ["#{$debianBased}",
  24.             "#{$archLinux}",
  25.             "#{$voidLinux}"]
  26.  
  27. #iterate over list of package managers
  28. #pass this to which(), take result and set it to pkgMgr
  29. for i in pkgMgrs do
  30.   if which(i) then
  31.     pkgMgr=i
  32.     break
  33.   end
  34. end
  35.  
  36.  
  37. #load file based on which package manager is found
  38. pkgMgr(args[0], pkgArgs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement