Created
January 11, 2015 19:04
-
-
Save freretuc/38ecac976893b389cb14 to your computer and use it in GitHub Desktop.
get distro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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