Detect Fedora Linux
This commit is contained in:
parent
7a3eac8db2
commit
c909bdb9aa
1 changed files with 10 additions and 0 deletions
10
check_kernel
10
check_kernel
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python
|
||||
from __future__ import division, print_function
|
||||
from distutils.version import LooseVersion
|
||||
import posixpath
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -22,7 +23,16 @@ def running_kernel_version():
|
|||
return version
|
||||
|
||||
|
||||
def is_fedora():
|
||||
return posixpath.exists('/etc/fedora-release')
|
||||
|
||||
|
||||
def installed_kernel_versions():
|
||||
if is_fedora():
|
||||
return installed_kernel_versions_fedora()
|
||||
|
||||
|
||||
def installed_kernel_versions_fedora():
|
||||
rpm_out = subprocess.check_output(
|
||||
['rpm', '--queryformat=%{VERSION}-%{RELEASE}\n', '-q', 'kernel'])
|
||||
rpm_out = rpm_out.strip()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue