From 406d745f50c08fd30face617e1aadfe9a1d5801d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Mon, 8 Sep 2014 22:58:05 -0700 Subject: [PATCH] Peruse `/etc/os-release` among others when detecting system info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Fedora, this results in a nice "Fedora 19" identifier and doesn't show the codename "Schrödinger’s Cat" which is otherwise contained in `/etc/fedora-release`. On Arch, this shows "Arch Linux" where previously we had no info for it (for some reason, `/etc/arch-release` is empty). http://www.freedesktop.org/software/systemd/man/os-release.html --- bin/ruby-build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/ruby-build b/bin/ruby-build index 9f701c54..e86f1b5b 100755 --- a/bin/ruby-build +++ b/bin/ruby-build @@ -76,6 +76,9 @@ os_information() { lsb_release -sir | xargs echo elif type -p sw_vers >/dev/null; then echo "OS X $(sw_vers -productVersion)" + elif [ -r /etc/os-release ]; then + source /etc/os-release + echo "$NAME" $VERSION_ID else local os="$(cat /etc/{centos,redhat,fedora,system}-release /etc/debian_version 2>/dev/null | head -1)" echo "${os:-$(uname -sr)}"