Guest User

Untitled

a guest
May 25th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. Dir[ "/var/db/pkg/*/*/" ].each do |filepath|
  4.  
  5. puts "checking #{filepath}"
  6.  
  7. next unless File.read("#{filepath}/environment.bz2") =~ /^GCC_SPECS=(.*)/
  8. value = $1 # the match from the regex above
  9.  
  10. puts "checking for value in variable"
  11.  
  12. next if (val = value.split("=")[1]).empty?
  13.  
  14. puts "shortening value for display"
  15.  
  16. pkgname = filepath.slice( 12, filepath.length ).sub(/\/$/,":")
  17.  
  18. val = val.split("hardened")[1].sub(/.specs$/,"")
  19.  
  20. puts "#{pkgname} #{val}"
  21.  
  22. end
Add Comment
Please, Sign In to add comment