From 5ae07ab0eaf388ce92517527e7ab3471f2a82b0b Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Sun, 9 Jul 2023 21:49:12 +0200 Subject: [PATCH] image/image: rename losetup_rootfs_image() to losetup_setup_image() --- image/boot.py | 4 ++-- image/cli.py | 6 +++--- image/flash.py | 6 +++--- image/image.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/image/boot.py b/image/boot.py index 33e1f8b..d60efb5 100644 --- a/image/boot.py +++ b/image/boot.py @@ -13,7 +13,7 @@ from flavours.cli import profile_option from wrapper import enforce_wrap from .fastboot import fastboot_boot, fastboot_erase -from .image import get_device_name, losetup_rootfs_image, get_image_path, dump_aboot, dump_lk2nd +from .image import get_device_name, losetup_setup_image, get_image_path, dump_aboot, dump_lk2nd LK2ND = FLASH_PARTS['LK2ND'] ABOOT = FLASH_PARTS['ABOOT'] @@ -61,7 +61,7 @@ def cmd_boot( if not os.path.exists(path): urllib.request.urlretrieve(f'https://github.com/dreemurrs-embedded/Jumpdrive/releases/download/{JUMPDRIVE_VERSION}/{file}', path) else: - loop_device = losetup_rootfs_image(image_path, sector_size) + loop_device = losetup_setup_image(image_path, sector_size) if type == LK2ND: path = dump_lk2nd(loop_device + 'p1') elif type == ABOOT: diff --git a/image/cli.py b/image/cli.py index 9cc106c..241f66b 100644 --- a/image/cli.py +++ b/image/cli.py @@ -25,7 +25,7 @@ from .image import ( get_device_chroot, get_image_path, install_rootfs, - losetup_rootfs_image, + losetup_setup_image, mount_chroot, partprobe, partition_device, @@ -154,7 +154,7 @@ def cmd_build( logging.info(f'Creating new file at {image_path}') create_img_file(image_path, f"{rootfs_size_mb + bootfs_size_mb}M") - loop_device = losetup_rootfs_image(image_path, sector_size or device.get_image_sectorsize_default()) + loop_device = losetup_setup_image(image_path, sector_size or device.get_image_sectorsize_default()) partition_device(loop_device, boot_partition_size=bootfs_size_str) partprobe(loop_device) @@ -239,7 +239,7 @@ def cmd_inspect( chroot = get_device_chroot(device.name, flavour, arch, packages=[], use_local_repos=use_local_repos) image_path = get_image_path(device, flavour) - loop_device = losetup_rootfs_image(image_path, sector_size) + loop_device = losetup_setup_image(image_path, sector_size) partprobe(loop_device) mount_chroot(loop_device + 'p2', loop_device + 'p1', chroot, password=profile_conf.encryption_password) diff --git a/image/flash.py b/image/flash.py index 9f11ed3..8fa2c90 100644 --- a/image/flash.py +++ b/image/flash.py @@ -15,7 +15,7 @@ from flavours.cli import profile_option from wrapper import enforce_wrap from .fastboot import fastboot_flash -from .image import dd_image, dump_aboot, dump_lk2nd, dump_qhypstub, get_image_path, losetup_destroy, losetup_rootfs_image, partprobe, shrink_fs +from .image import dd_image, dump_aboot, dump_lk2nd, dump_qhypstub, get_image_path, losetup_destroy, losetup_setup_image, partprobe, shrink_fs from .cryptsetup import encryption_option ABOOT = FLASH_PARTS['ABOOT'] @@ -55,7 +55,7 @@ def prepare_minimal_image(source_path: str, sector_size: int, encrypted: Optiona logging.info(f"Copying image {os.path.basename(source_path)} to {minimal_image_dir} for shrinking") shutil.copyfile(source_path, minimal_image_path) - loop_device = losetup_rootfs_image(minimal_image_path, sector_size) + loop_device = losetup_setup_image(minimal_image_path, sector_size) partprobe(loop_device) shrink_fs(loop_device, minimal_image_path, sector_size, encrypted, encryption_password) losetup_destroy(loop_device) @@ -145,7 +145,7 @@ def cmd_flash( else: if method and method != FASTBOOT: raise Exception(f'Flashing "{what}" with method "{method}" not supported, try no parameter or "{FASTBOOT}"') - loop_device = losetup_rootfs_image(device_image_path, sector_size) + loop_device = losetup_setup_image(device_image_path, sector_size) if what == ABOOT: path = dump_aboot(f'{loop_device}p1') fastboot_flash(location or 'boot', path, confirm=confirm) diff --git a/image/image.py b/image/image.py index 557b7fb..e43bb41 100644 --- a/image/image.py +++ b/image/image.py @@ -224,7 +224,7 @@ def get_image_path(device: Union[str, Device], flavour: Union[str, Flavour], img return os.path.join(config.get_path('images'), get_image_name(device, flavour, img_type)) -def losetup_rootfs_image(image_path: str, sector_size: int) -> str: +def losetup_setup_image(image_path: str, sector_size: int) -> str: logging.debug(f'Creating loop device for {image_path} with sector size {sector_size}') result = run_root_cmd([ 'losetup',