Skip to content

Instantly share code, notes, and snippets.

@freretuc
Created January 11, 2015 19:04
Show Gist options
  • Save freretuc/38ecac976893b389cb14 to your computer and use it in GitHub Desktop.
Save freretuc/38ecac976893b389cb14 to your computer and use it in GitHub Desktop.
get distro
def getDistro():
os.system("cat /etc/*release > getdistro")
file = open("getdistro", "r")
content = ''.join(file.readlines())
file.close()
os.remove("getdistro")
_os = "undef"
_ver = "undef"
if (re.compile('\sID=(.*)\s').search(content)) is not None:
_os = re.compile('\sID=(.*)\s').search(content).group(1)
_ver = re.compile('\sVERSION_ID="(.*)"\s').search(content).group(1)
return (_os, _ver)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment