From e288918e582af25365904e9f12efda95bd56fe56 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Sun, 8 May 2022 17:27:58 +0200 Subject: [PATCH] image.py: make device paths work with cmd_flash() again, add dd debug output --- flash.py | 6 +++--- image.py | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/flash.py b/flash.py index 0db175a..a39fb88 100644 --- a/flash.py +++ b/flash.py @@ -18,9 +18,9 @@ ROOTFS = FLASH_PARTS['ROOTFS'] @click.command(name='flash') @click.argument('what', type=click.Choice(list(FLASH_PARTS.values()))) -@click.argument('location', required=False, type=click.Choice(LOCATIONS)) -def cmd_flash(what, location): - """Flash a partition onto a device""" +@click.argument('location', type=str, required=False) +def cmd_flash(what: str, location: str): + """Flash a partition onto a device. `location` takes either a path to a block device or one of emmc, sdcard""" enforce_wrap() device, flavour = get_device_and_flavour() device_image_name = get_image_name(device, flavour) diff --git a/image.py b/image.py index fe01a5a..e39bf7b 100644 --- a/image.py +++ b/image.py @@ -23,7 +23,7 @@ IMG_FILE_BOOT_DEFAULT_SIZE = "90M" def dd_image(input: str, output: str, blocksize='1M') -> CompletedProcess: - return subprocess.run([ + cmd = [ 'dd', f'if={input}', f'of={output}', @@ -32,7 +32,9 @@ def dd_image(input: str, output: str, blocksize='1M') -> CompletedProcess: 'oflag=direct', 'status=progress', 'conv=sync,noerror', - ]) + ] + logging.debug(f'running dd cmd: {cmd}') + return subprocess.run(cmd) def partprobe(device: str):