diff options
author | Rob Austein <sra@hactrn.net> | 2013-05-07 12:58:18 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2013-05-07 12:58:18 +0000 |
commit | e326a1ada63e27e3c2797adec084aa4102de4cca (patch) | |
tree | 82e073ee8408e7e7a40c07f165a3c06dccb77251 | |
parent | 0ef7488f047fd15d4383e8d8642a164cb25391c9 (diff) |
Use Python's platform library instead of parsing /etc/issue.
svn path=/trunk/; revision=5328
-rwxr-xr-x | rpkid/portal-gui/scripts/rpkigui-apache-conf-gen | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/rpkid/portal-gui/scripts/rpkigui-apache-conf-gen b/rpkid/portal-gui/scripts/rpkigui-apache-conf-gen index 582a88c6..e0868bee 100755 --- a/rpkid/portal-gui/scripts/rpkigui-apache-conf-gen +++ b/rpkid/portal-gui/scripts/rpkigui-apache-conf-gen @@ -86,20 +86,17 @@ def Guess(args): Guess what platform this is and dispatch to platform constructor. """ - if sys.platform.startswith("freebsd"): + import platform + system = platform.system() + if system == "FreeBSD": return FreeBSD(args) - if sys.platform.startswith("darwin"): + if system == "Darwin": return Darwin(args) - if sys.platform.startswith("linux"): - issue = None - try: - with open("/etc/issue", "r") as f: - issue = f.read().split()[0] - except: - pass - if issue in ("Debian", "Ubunutu"): + if system == "Linux": + distro = platform.linux_distribution()[0].downcase() + if distro in ("debian", "ubunutu"): return Debian(args) - if issue in ("Fedora", "CentOS"): + if distro in ("fedora", "centos"): return Redhat(args) raise NotImplementedError("Can't guess what platform this is, sorry") |