try to load configs modules + decode gzip output (see #67)

This commit is contained in:
erpalma
2018-11-07 16:21:54 +01:00
parent 0189170a40
commit 5a96b88944

View File

@@ -477,13 +477,16 @@ def check_kernel():
kernel_config = None kernel_config = None
try: try:
with open(os.path.join('/boot', 'config-{:s}'.format(uname()[2]))) as f: with open(os.path.join('/boot', 'coanfig-{:s}'.format(uname()[2]))) as f:
kernel_config = f.read() kernel_config = f.read()
except IOError: except IOError:
config_gz_path = os.path.join('/proc', 'config.gz')
try: try:
with gzip.open(os.path.join('/proc', 'config.gz')) as f: if not os.path.isfile(config_gz_path):
kernel_config = f.read() subprocess.check_call(('modprobe', 'configs'))
except IOError: with gzip.open(config_gz_path) as f:
kernel_config = f.read().decode()
except (subprocess.CalledProcessError, IOError):
pass pass
if kernel_config is None: if kernel_config is None:
print('[W] Unable to obtain and validate kernel config.') print('[W] Unable to obtain and validate kernel config.')