mirror of
https://github.com/erpalma/throttled.git
synced 2026-01-06 00:30:15 +01:00
try to load configs modules + decode gzip output (see #67)
This commit is contained in:
parent
0189170a40
commit
5a96b88944
|
|
@ -477,13 +477,16 @@ def check_kernel():
|
|||
|
||||
kernel_config = None
|
||||
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()
|
||||
except IOError:
|
||||
config_gz_path = os.path.join('/proc', 'config.gz')
|
||||
try:
|
||||
with gzip.open(os.path.join('/proc', 'config.gz')) as f:
|
||||
kernel_config = f.read()
|
||||
except IOError:
|
||||
if not os.path.isfile(config_gz_path):
|
||||
subprocess.check_call(('modprobe', 'configs'))
|
||||
with gzip.open(config_gz_path) as f:
|
||||
kernel_config = f.read().decode()
|
||||
except (subprocess.CalledProcessError, IOError):
|
||||
pass
|
||||
if kernel_config is None:
|
||||
print('[W] Unable to obtain and validate kernel config.')
|
||||
|
|
|
|||
Loading…
Reference in a new issue