mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 19:51:35 +01:00
zip-img: factor out for main() python calling
This commit is contained in:
22
zip-img
22
zip-img
@@ -6,12 +6,16 @@ import zipfile
|
||||
|
||||
import common
|
||||
|
||||
outfile = os.path.join(common.out_dir, 'lkmc-{}.zip'.format(common.sha))
|
||||
if os.path.exists(outfile):
|
||||
os.unlink(outfile)
|
||||
zipf = zipfile.ZipFile(outfile, 'w', zipfile.ZIP_DEFLATED)
|
||||
for arch in common.arches:
|
||||
common.setup(common.get_argparse(default_args={'arch': arch}))
|
||||
zipf.write(common.qcow2_file, arcname=os.path.relpath(common.qcow2_file, common.root_dir))
|
||||
zipf.write(common.linux_image, arcname=os.path.relpath(common.linux_image, common.root_dir))
|
||||
zipf.close()
|
||||
def main():
|
||||
outfile = os.path.join(common.out_dir, 'lkmc-{}.zip'.format(common.sha))
|
||||
if os.path.exists(outfile):
|
||||
os.unlink(outfile)
|
||||
zipf = zipfile.ZipFile(outfile, 'w', zipfile.ZIP_DEFLATED)
|
||||
for arch in common.arches:
|
||||
common.setup(common.get_argparse(default_args={'arch': arch}))
|
||||
zipf.write(common.qcow2_file, arcname=os.path.relpath(common.qcow2_file, common.root_dir))
|
||||
zipf.write(common.linux_image, arcname=os.path.relpath(common.linux_image, common.root_dir))
|
||||
zipf.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user