Detect Fedora Linux

master
Mike Gerber 10 years ago
parent 7a3eac8db2
commit c909bdb9aa

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
from __future__ import division, print_function from __future__ import division, print_function
from distutils.version import LooseVersion from distutils.version import LooseVersion
import posixpath
import re import re
import subprocess import subprocess
import sys import sys
@ -22,7 +23,16 @@ def running_kernel_version():
return version return version
def is_fedora():
return posixpath.exists('/etc/fedora-release')
def installed_kernel_versions(): def installed_kernel_versions():
if is_fedora():
return installed_kernel_versions_fedora()
def installed_kernel_versions_fedora():
rpm_out = subprocess.check_output( rpm_out = subprocess.check_output(
['rpm', '--queryformat=%{VERSION}-%{RELEASE}\n', '-q', 'kernel']) ['rpm', '--queryformat=%{VERSION}-%{RELEASE}\n', '-q', 'kernel'])
rpm_out = rpm_out.strip() rpm_out = rpm_out.strip()

Loading…
Cancel
Save