Package list ohcount / 85d5c3b4-c1f3-4d55-a24f-4c231b8d4c21/main ruby / print_arch
85d5c3b4-c1f3-4d55-a24f-4c231b8d4c21/main

Tree @85d5c3b4-c1f3-4d55-a24f-4c231b8d4c21/main (Download .tar.gz)

print_arch @85d5c3b4-c1f3-4d55-a24f-4c231b8d4c21/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("_")