mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-22 13:15:44 -05:00
image: create new module from {image,boot,fastboot,flash}.py
This commit is contained in:
parent
afca099ede
commit
50bcd0de63
9 changed files with 18 additions and 16 deletions
|
@ -28,7 +28,7 @@ def cmd_chroot(ctx: click.Context, type: str = 'build', name: str = None, enable
|
|||
raise Exception(f'Unknown chroot type: "{type}"')
|
||||
|
||||
if type == 'rootfs':
|
||||
from image import cmd_inspect
|
||||
from image.image import cmd_inspect
|
||||
assert isinstance(cmd_inspect, click.Command)
|
||||
ctx.invoke(cmd_inspect, profile=name, shell=True)
|
||||
return
|
||||
|
|
|
@ -8,12 +8,10 @@ only used to trigger builds of the submodule docs!
|
|||
:template: command.rst
|
||||
:recursive:
|
||||
|
||||
boot
|
||||
cache
|
||||
chroot
|
||||
config
|
||||
devices
|
||||
flash
|
||||
flavours
|
||||
image
|
||||
net
|
||||
|
|
0
image/__init__.py
Normal file
0
image/__init__.py
Normal file
|
@ -7,13 +7,14 @@ from typing import Optional
|
|||
from config.state import config
|
||||
from constants import FLASH_PARTS, FASTBOOT, JUMPDRIVE, JUMPDRIVE_VERSION
|
||||
from exec.file import makedir
|
||||
from fastboot import fastboot_boot, fastboot_erase_dtbo
|
||||
from image import get_device_name, losetup_rootfs_image, get_image_path, dump_aboot, dump_lk2nd
|
||||
from devices.device import get_profile_device
|
||||
from flavours.flavour import get_profile_flavour
|
||||
from flavours.cli import profile_option
|
||||
from wrapper import enforce_wrap
|
||||
|
||||
from .fastboot import fastboot_boot, fastboot_erase_dtbo
|
||||
from .image import get_device_name, losetup_rootfs_image, get_image_path, dump_aboot, dump_lk2nd
|
||||
|
||||
LK2ND = FLASH_PARTS['LK2ND']
|
||||
ABOOT = FLASH_PARTS['ABOOT']
|
||||
|
6
image/cli.py
Normal file
6
image/cli.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from .boot import cmd_boot
|
||||
from .flash import cmd_flash
|
||||
from .image import cmd_image
|
||||
|
||||
for cmd in [cmd_boot, cmd_flash]:
|
||||
cmd_image.add_command(cmd)
|
|
@ -7,13 +7,14 @@ from typing import Optional
|
|||
from constants import FLASH_PARTS, LOCATIONS
|
||||
from exec.cmd import run_root_cmd
|
||||
from exec.file import get_temp_dir
|
||||
from fastboot import fastboot_flash
|
||||
from image import dd_image, partprobe, shrink_fs, losetup_rootfs_image, losetup_destroy, dump_aboot, dump_lk2nd, dump_qhypstub, get_image_name, get_image_path
|
||||
from devices.device import get_profile_device
|
||||
from flavours.flavour import get_profile_flavour
|
||||
from flavours.cli import profile_option
|
||||
from wrapper import enforce_wrap
|
||||
|
||||
from .fastboot import fastboot_flash
|
||||
from .image import dd_image, partprobe, shrink_fs, losetup_rootfs_image, losetup_destroy, dump_aboot, dump_lk2nd, dump_qhypstub, get_image_name, get_image_path
|
||||
|
||||
ABOOT = FLASH_PARTS['ABOOT']
|
||||
LK2ND = FLASH_PARTS['LK2ND']
|
||||
QHYPSTUB = FLASH_PARTS['QHYPSTUB']
|
|
@ -9,16 +9,16 @@ from signal import pause
|
|||
from subprocess import CompletedProcess
|
||||
from typing import Optional, Union
|
||||
|
||||
from config.state import config, Profile
|
||||
from chroot.device import DeviceChroot, get_device_chroot
|
||||
from constants import Arch, BASE_LOCAL_PACKAGES, BASE_PACKAGES, POST_CMDS
|
||||
from config.state import config, Profile
|
||||
from distro.distro import get_base_distro, get_kupfer_https
|
||||
from devices.device import Device, get_profile_device
|
||||
from exec.cmd import run_root_cmd, generate_cmd_su
|
||||
from exec.file import root_write_file, root_makedir, makedir
|
||||
from packages.build import build_enable_qemu_binfmt, build_packages, filter_pkgbuilds
|
||||
from devices.device import Device, get_profile_device
|
||||
from flavours.flavour import Flavour, get_profile_flavour
|
||||
from net.ssh import copy_ssh_keys
|
||||
from packages.build import build_enable_qemu_binfmt, build_packages, filter_pkgbuilds
|
||||
from wrapper import enforce_wrap
|
||||
|
||||
# image files need to be slightly smaller than partitions to fit
|
||||
|
@ -338,7 +338,7 @@ def install_rootfs(
|
|||
|
||||
@click.group(name='image')
|
||||
def cmd_image():
|
||||
"""Build and manage device images"""
|
||||
"""Build, flash and boot device images"""
|
||||
|
||||
|
||||
@cmd_image.command(name='build')
|
6
main.py
6
main.py
|
@ -15,9 +15,7 @@ from devices.cli import cmd_devices
|
|||
from net.cli import cmd_net
|
||||
from chroot.cli import cmd_chroot
|
||||
from cache import cmd_cache
|
||||
from image import cmd_image
|
||||
from boot import cmd_boot
|
||||
from flash import cmd_flash
|
||||
from image.cli import cmd_image
|
||||
|
||||
|
||||
@click.group()
|
||||
|
@ -59,12 +57,10 @@ def main():
|
|||
exit(1)
|
||||
|
||||
|
||||
cli.add_command(cmd_boot)
|
||||
cli.add_command(cmd_cache)
|
||||
cli.add_command(cmd_chroot)
|
||||
cli.add_command(cmd_config)
|
||||
cli.add_command(cmd_devices)
|
||||
cli.add_command(cmd_flash)
|
||||
cli.add_command(cmd_flavours)
|
||||
cli.add_command(cmd_image)
|
||||
cli.add_command(cmd_net)
|
||||
|
|
Loading…
Add table
Reference in a new issue