diff options
author | VG <vg@devys.org> | 2016-11-06 17:32:20 +0100 |
---|---|---|
committer | VG <vg@devys.org> | 2016-11-06 17:32:20 +0100 |
commit | fb6fa99c0da96a45d458b2ffa0b9b2fe8890ac36 (patch) | |
tree | 9d8e9346cf193b9115e6d4f98fbbfb2acc412226 /qemu-headless/extract-kernel.py | |
parent | 4f11597d495853c4ef8d10d9cadd13c231b2bec3 (diff) | |
download | debootstrap-scripts-fb6fa99c0da96a45d458b2ffa0b9b2fe8890ac36.tar.gz debootstrap-scripts-fb6fa99c0da96a45d458b2ffa0b9b2fe8890ac36.tar.bz2 debootstrap-scripts-fb6fa99c0da96a45d458b2ffa0b9b2fe8890ac36.zip |
move to a subdir since this repo will have other debootstrap scripts
Diffstat (limited to 'qemu-headless/extract-kernel.py')
-rwxr-xr-x | qemu-headless/extract-kernel.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/qemu-headless/extract-kernel.py b/qemu-headless/extract-kernel.py new file mode 100755 index 0000000..71dde88 --- /dev/null +++ b/qemu-headless/extract-kernel.py @@ -0,0 +1,30 @@ +#!/usr/bin/python3 + + +import os +import shutil +import subprocess +import sys + +def get_vmlinuz_path(): + return os.path.join('mnt', os.readlink('mnt/vmlinuz').lstrip('/')) + +def get_initrd_path(): + return os.path.join('mnt', os.readlink('mnt/initrd.img').lstrip('/')) + +if not os.path.exists('mnt'): + os.mkdir('mnt') + +subprocess.run([ + 'guestmount', + '-a', 'unstable-armhf.qcow2', + '-m', '/dev/sda1', + '--ro', + 'mnt']) +print(get_vmlinuz_path()) +print(get_initrd_path()) + +shutil.copyfile(get_vmlinuz_path(), 'vmlinuz', follow_symlinks=True) +shutil.copyfile(get_initrd_path(), 'initrd.img', follow_symlinks=True) + +subprocess.run(['fusermount', '-u', 'mnt']) |