mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-25 19:21:35 +01:00
36 lines
1.2 KiB
Python
Executable File
36 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import zipfile
|
|
|
|
import common
|
|
|
|
class Main(common.LkmcCliFunction):
|
|
def __init__(self):
|
|
super().__init__(
|
|
description='''\
|
|
https://github.com/cirosantilli/linux-kernel-module-cheat#release-zip
|
|
''',
|
|
defaults = {
|
|
'print_time': False,
|
|
}
|
|
)
|
|
self.qcow2s_linux_images = []
|
|
|
|
def timed_main(self):
|
|
self.qcow2s_linux_images.append((self.env['qcow2_file'], self.env['linux_image']))
|
|
|
|
def teardown(self):
|
|
os.makedirs(self.env['release_dir'], exist_ok=True)
|
|
self.sh.rmrf(self.env['release_zip_file'])
|
|
self.log_info('Creating zip: ' + self.env['release_zip_file'])
|
|
with zipfile.ZipFile(self.env['release_zip_file'], 'w', zipfile.ZIP_DEFLATED) as zipf:
|
|
for qcow2, linux_image in self.qcow2s_linux_images:
|
|
self.log_info('Adding file: ' + qcow2)
|
|
zipf.write(qcow2, arcname=os.path.relpath(qcow2, self.env['root_dir']))
|
|
self.log_info('Adding file: ' + linux_image)
|
|
zipf.write(linux_image, arcname=os.path.relpath(linux_image, self.env['root_dir']))
|
|
|
|
if __name__ == '__main__':
|
|
Main().cli()
|