From 43ec3c569ec67489ab3dd648db982d187c76c69a Mon Sep 17 00:00:00 2001 From: Bruno Tavares Date: Sun, 2 Mar 2014 20:17:47 -0300 Subject: [PATCH] Use release files to identify distro Docker can run a different distro from the host. For example, Ubuntu host with CentOS docker image. The container uses the same kernel as the host tho. On a CentOS container under Ubuntu, `uname -a` will report it to be an Ubuntu kernel. Linux distros comes with configuration files under `/etc` that helps identify the family it is. An example of configuration files to help identify is on http://linuxmafia.com/faq/Admin/release-files.html --- kickstart/recipes/kickstart/os.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kickstart/recipes/kickstart/os.sh b/kickstart/recipes/kickstart/os.sh index 31cf4e4..4591177 100644 --- a/kickstart/recipes/kickstart/os.sh +++ b/kickstart/recipes/kickstart/os.sh @@ -1,5 +1,6 @@ kickstart.os() { - uname -a | kickstart.stream.contains Ubuntu && echo "Ubuntu" + [ -f /etc/lsb-release ] && echo "Ubuntu" + [ -f /etc/redhat-release ] && echo "RHEL" uname -a | kickstart.stream.contains Darwin && echo "Mac" }