Codebase list ohcount / 85104d5a-b71d-4620-9315-33d4daf34104/main ruby / print_arch
85104d5a-b71d-4620-9315-33d4daf34104/main

Tree @85104d5a-b71d-4620-9315-33d4daf34104/main (Download .tar.gz)

print_arch @85104d5a-b71d-4620-9315-33d4daf34104/mainraw · history · blame

#!/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("_")