mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 05:35:44 -05:00
flash.py,boot.py: use packages.flavours.get_profile_flavour(), add --profile option
This commit is contained in:
parent
c0b3b15260
commit
42d7a701fb
3 changed files with 18 additions and 8 deletions
12
boot.py
12
boot.py
|
@ -2,12 +2,15 @@ import os
|
|||
import urllib.request
|
||||
import click
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from config import config
|
||||
from constants import BOOT_STRATEGIES, FLASH_PARTS, FASTBOOT, JUMPDRIVE, JUMPDRIVE_VERSION
|
||||
from exec.file import makedir
|
||||
from fastboot import fastboot_boot, fastboot_erase_dtbo
|
||||
from image import get_flavour, get_device_name, losetup_rootfs_image, get_image_path, dump_aboot, dump_lk2nd
|
||||
from image import get_device_name, losetup_rootfs_image, get_image_path, dump_aboot, dump_lk2nd
|
||||
from packages.device import get_profile_device
|
||||
from packages.flavour import get_profile_flavour, profile_option
|
||||
from wrapper import enforce_wrap
|
||||
|
||||
LK2ND = FLASH_PARTS['LK2ND']
|
||||
|
@ -17,12 +20,13 @@ TYPES = [LK2ND, JUMPDRIVE, ABOOT]
|
|||
|
||||
|
||||
@click.command(name='boot')
|
||||
@profile_option
|
||||
@click.argument('type', required=False, default=ABOOT, type=click.Choice(TYPES))
|
||||
def cmd_boot(type):
|
||||
def cmd_boot(type: str, profile: Optional[str] = None):
|
||||
"""Boot JumpDrive or the Kupfer aboot image. Erases Android DTBO in the process."""
|
||||
enforce_wrap()
|
||||
device = get_profile_device()
|
||||
flavour = get_flavour()
|
||||
device = get_profile_device(profile)
|
||||
flavour = get_profile_flavour(profile).name
|
||||
deviceinfo = device.parse_deviceinfo()
|
||||
sector_size = deviceinfo.flash_pagesize
|
||||
if not sector_size:
|
||||
|
|
12
flash.py
12
flash.py
|
@ -2,12 +2,15 @@ import shutil
|
|||
import os
|
||||
import click
|
||||
|
||||
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_flavour, get_image_name, get_image_path
|
||||
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 packages.device import get_profile_device
|
||||
from packages.flavour import get_profile_flavour, profile_option
|
||||
from wrapper import enforce_wrap
|
||||
|
||||
ABOOT = FLASH_PARTS['ABOOT']
|
||||
|
@ -17,13 +20,14 @@ ROOTFS = FLASH_PARTS['ROOTFS']
|
|||
|
||||
|
||||
@click.command(name='flash')
|
||||
@profile_option
|
||||
@click.argument('what', type=click.Choice(list(FLASH_PARTS.values())))
|
||||
@click.argument('location', type=str, required=False)
|
||||
def cmd_flash(what: str, location: str):
|
||||
def cmd_flash(what: str, location: str, profile: Optional[str] = None):
|
||||
"""Flash a partition onto a device. `location` takes either a path to a block device or one of emmc, sdcard"""
|
||||
enforce_wrap()
|
||||
device = get_profile_device()
|
||||
flavour = get_flavour()
|
||||
device = get_profile_device(profile)
|
||||
flavour = get_profile_flavour(profile).name
|
||||
device_image_name = get_image_name(device, flavour)
|
||||
device_image_path = get_image_path(device, flavour)
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ from config import config
|
|||
|
||||
from .pkgbuild import discover_pkgbuilds, get_pkgbuild_by_name, init_pkgbuilds, Pkgbuild
|
||||
|
||||
profile_option = click.option('-p', '--profile', help="name of the profile to use", required=False, default=None)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Flavour:
|
||||
|
|
Loading…
Add table
Reference in a new issue