mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-01-18 04:57:38 +00:00
70bf5512d9
Import kernel-config infrastructure from BLFS and use it for kernel configuration. Note that kernel-config.py is slightly different from BLFS: we need role="nodump" for <screen> here.
28 lines
752 B
Python
Executable File
28 lines
752 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
def kernel_version(path):
|
|
version = None
|
|
patchlevel = None
|
|
sublevel = None
|
|
|
|
with open(path + 'Makefile') as f:
|
|
for line in f:
|
|
if line.startswith('VERSION ='):
|
|
version = line[len('VERSION ='):].strip()
|
|
elif line.startswith('PATCHLEVEL ='):
|
|
patchlevel = line[len('PATCHLEVEL ='):].strip()
|
|
elif line.startswith('SUBLEVEL ='):
|
|
sublevel = line[len('SUBLEVEL ='):].strip()
|
|
|
|
assert(version and patchlevel and sublevel)
|
|
return '.'.join([version, patchlevel, sublevel])
|
|
|
|
if __name__ == '__main__':
|
|
from sys import argv
|
|
|
|
path = argv[1]
|
|
if path[:-1] != '/':
|
|
path += '/'
|
|
|
|
print(kernel_version(path))
|