meta: rename
This commit is contained in:
39
tools/mango.mkrescue
Executable file
39
tools/mango.mkrescue
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
# vim: ft=python
|
||||
# -*- mode: python -*-
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
|
||||
kernel_src_path = os.path.join('build', 'mango_kernel')
|
||||
grub_cfg_src_path = os.path.join('tools', 'boot-image', 'grub.cfg')
|
||||
iso_build_dir = os.path.join('build', 'mango-kernel.iso-build')
|
||||
iso_path = os.path.join('build', 'mango-kernel.iso')
|
||||
|
||||
|
||||
def in_source_tree():
|
||||
return os.path.isfile('tools/mango.sync')
|
||||
|
||||
|
||||
if not in_source_tree():
|
||||
print('This script must be executed from the root of the Mango source tree')
|
||||
exit(-1)
|
||||
|
||||
if not os.path.isdir('build'):
|
||||
print('Please build the Mango kernel before using this tool')
|
||||
exit(-1)
|
||||
|
||||
if os.path.isdir(iso_build_dir):
|
||||
shutil.rmtree(iso_build_dir)
|
||||
|
||||
os.mkdir(iso_build_dir)
|
||||
|
||||
os.mkdir(os.path.join(iso_build_dir, 'boot'))
|
||||
os.mkdir(os.path.join(iso_build_dir, 'boot', 'grub'))
|
||||
|
||||
shutil.copyfile(kernel_src_path, os.path.join(iso_build_dir, 'boot', 'mango_kernel'))
|
||||
shutil.copyfile(grub_cfg_src_path, os.path.join(iso_build_dir, 'boot', 'grub', 'grub.cfg'))
|
||||
|
||||
subprocess.run(['grub-mkrescue', '-o', iso_path, iso_build_dir])
|
||||
Reference in New Issue
Block a user