diff options
author | Marcos Paulo de Souza <marcos.souza.org@gmail.com> | 2019-09-21 09:07:06 -0300 |
---|---|---|
committer | Marcos Paulo de Souza <marcos.souza.org@gmail.com> | 2019-09-21 09:33:35 -0300 |
commit | b17810c2a7263bee7413d0985d49b27c4bab6267 (patch) | |
tree | cdc4b8c38363b3963c01bbb20f4b3ea7a82dbb90 | |
parent | f4cd13a9c6328633f8af729d777ad9490e7cf585 (diff) | |
download | virtme-b17810c2a7263bee7413d0985d49b27c4bab6267.tar.gz |
commands/configkernel.py: Check KBUILD_OUTPUT environment variable
If KBUILD_OUTPUT is defined, and if it's a directory, write the .config file in location defined.
Fixes: #24
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
-rw-r--r-- | virtme/commands/configkernel.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/virtme/commands/configkernel.py b/virtme/commands/configkernel.py index 0da6fab..bd3d42f 100644 --- a/virtme/commands/configkernel.py +++ b/virtme/commands/configkernel.py @@ -121,7 +121,14 @@ def main(): if maketarget: subprocess.check_call(['make', 'ARCH=%s' % arch.linuxname, maketarget]) - with open('.config', 'ab') as conffile: + config = '.config' + + # Check if KBUILD_OUTPUT is defined and if it's a directory + config_dir = os.environ.get('KBUILD_OUTPUT', '') + if config_dir and os.path.isdir(config_dir): + config = os.path.join(config_dir, config) + + with open(config, 'ab') as conffile: conffile.write('\n'.join(conf).encode('utf-8')) subprocess.check_call(['make', 'ARCH=%s' % arch.linuxname, updatetarget]) |