From 88ed42f3db3c64307484ab521c5cbfd6f1037237 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 19 Oct 2012 12:07:14 +0100 Subject: [PATCH] Don't ignore `/etc/lsb-release` if it exists. --- bootstrap-salt-minion.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bootstrap-salt-minion.sh b/bootstrap-salt-minion.sh index 6815007..ec18d86 100755 --- a/bootstrap-salt-minion.sh +++ b/bootstrap-salt-minion.sh @@ -118,6 +118,19 @@ __gather_os_info # DESCRIPTION: Discover Linux system information #------------------------------------------------------------------------------- __gather_linux_system_info() { + DISTRO_NAME="" + DISTRO_VERSION="" + + if [ -f /etc/lsb-release ]; then + DISTRO_NAME=$(grep DISTRIB_ID /etc/lsb-release | sed -e 's/.*=//') + DISTRO_VERSION=$(grep DISTRIB_RELEASE /etc/lsb-release | sed -e 's/.*=//') + fi + + if [ "x$DISTRO_NAME" != "x" -a "x$DISTRO_VERSION" != "x" ]; then + # We already have the distribution name and version + return + fi + for rsource in $( cd /etc && /bin/ls *[_-]release *[_-]version 2>/dev/null | env -i sort | \ sed -e '/^redhat-release$/d' -e '/^lsb-release$/d'; \