diff options
Diffstat (limited to 'morphlib/builder2.py')
-rw-r--r-- | morphlib/builder2.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py index 83f5ae84..5820dc44 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -550,6 +550,25 @@ class SystemKindBuilder(BuilderBase): # pragma: no cover f.write('sysfs /sys sysfs defaults 0 0\n') f.write('/dev/sda1 / btrfs defaults,rw,noatime 0 1\n') + def copy_kernel_into_artifact_cache(self, path): + '''Copy the installed kernel image into the local artifact cache. + + The kernel image will be a separate artifact from the root + filesystem/disk image/whatever. This is sometimes useful with + funky bootloaders or virtualisation. + + ''' + + name = self.artifact.source.morphology['name']+'-kernel' + a = self.new_artifact(name) + with self.local_artifact_cache.put(a) as dest: + for basename in ['zImage', 'vmlinuz']: + installed_path = os.path.join(path, 'boot', basename) + if os.path.exists(installed_path): + with open(installed_path) as kernel: + shutil.copyfileobj(kernel, dest) + break + class SystemKindBuilderFactory(object): # pragma: no cover |