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
This commit is contained in:
Bruno Tavares 2014-03-02 20:17:47 -03:00
parent e0ef543f92
commit 43ec3c569e

View File

@ -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"
}