I chose this way to get linux distro name:
ls /etc/*release
And now I have to parse it for name:
/etc/<name>-release
def checkDistro():
p = Popen('ls /etc/*release' , shell = True, stdout = PIPE)
distroRelease = p.stdout.read()
distroName = re.search( ur"\/etc\/(.*)\-release", distroRelease).group()
print distroName
But this prints the same string that is in distroRelease.
--help
and/or-a
to get a feel of how it works./etc/*release
won't work for all distros. But see serverfault.com/questions/3331/…