Codebase list ohcount / d62f219c-a984-415f-b69c-f521b00b8f15/main ruby / print_arch
d62f219c-a984-415f-b69c-f521b00b8f15/main

Tree @d62f219c-a984-415f-b69c-f521b00b8f15/main (Download .tar.gz)

print_arch @d62f219c-a984-415f-b69c-f521b00b8f15/main

8e3aae6
 
 
 
 
a9d19c7
8e3aae6
a9d19c7
8e3aae6
 
a9d19c7
 
8e3aae6
 
 
 
#!/usr/bin/env ruby
require 'mkmf'

arch = RbConfig::expand(CONFIG["arch"])

distro = if File.exist?("/etc/os-release")
  # this is "", "CentOS" or "Ubuntu"
  `egrep "^ID=.*" /etc/os-release`.split("=")[1].downcase
end

unless %w[centos ubuntu fedora].include?(distro.to_s.chomp)
	STDERR.puts "unhandled /etc/os-release result: #{distro}"
end

# either <arch> or <arch>_<distro> if distro is non-null
puts [arch, distro].compact.join("_")