partially add config.file['paths']['images'] (mostly taken from c5c8104a60
)
Co-authored-by: jld3103 <jld3103yt@gmail.com> Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
This commit is contained in:
parent
9258cbf76d
commit
ee4f899254
4 changed files with 13 additions and 7 deletions
16
boot.py
16
boot.py
|
@ -1,9 +1,11 @@
|
|||
import os
|
||||
import urllib.request
|
||||
from image import get_device_and_flavour, get_image_name, dump_bootimg, dump_lk2nd
|
||||
from fastboot import fastboot_boot, fastboot_erase_dtbo
|
||||
from constants import BOOT_STRATEGIES, FLASH_PARTS, FASTBOOT, JUMPDRIVE, JUMPDRIVE_VERSION
|
||||
import click
|
||||
|
||||
from config import config
|
||||
from constants import BOOT_STRATEGIES, FLASH_PARTS, FASTBOOT, JUMPDRIVE, JUMPDRIVE_VERSION
|
||||
from fastboot import fastboot_boot, fastboot_erase_dtbo
|
||||
from image import get_device_and_flavour, get_image_name, dump_bootimg, dump_lk2nd
|
||||
from wrapper import enforce_wrap
|
||||
|
||||
LK2ND = FLASH_PARTS['LK2ND']
|
||||
|
@ -19,18 +21,20 @@ def cmd_boot(type):
|
|||
enforce_wrap()
|
||||
device, flavour = get_device_and_flavour()
|
||||
image_name = get_image_name(device, flavour)
|
||||
image_path = os.path.join(config.get_path('images'), image_name)
|
||||
strategy = BOOT_STRATEGIES[device]
|
||||
|
||||
if strategy == FASTBOOT:
|
||||
if type == JUMPDRIVE:
|
||||
file = f'boot-{device}.img'
|
||||
path = os.path.join('/var/cache/jumpdrive', file)
|
||||
path = os.path.join(config.get_path('jumpdrive'), file)
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
if not os.path.exists(path):
|
||||
urllib.request.urlretrieve(f'https://github.com/dreemurrs-embedded/Jumpdrive/releases/download/{JUMPDRIVE_VERSION}/{file}', path)
|
||||
elif type == LK2ND:
|
||||
path = dump_lk2nd(image_name)
|
||||
path = dump_lk2nd(image_path)
|
||||
elif type == BOOTIMG:
|
||||
path = dump_bootimg(image_name)
|
||||
path = dump_bootimg(image_path)
|
||||
else:
|
||||
raise Exception(f'Unknown boot image type {type}')
|
||||
fastboot_erase_dtbo()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue