From 3aff533c4d87ecfb1bb78ce9d8a7f692251d4359 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sat, 30 Mar 2024 23:04:08 -0700 Subject: [PATCH 1/2] Reduce size to zero-out Most tools will use a 1MiB offset for the first partition --- scripts/wk/kit/ufd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/wk/kit/ufd.py b/scripts/wk/kit/ufd.py index fc774bdd..eb739457 100644 --- a/scripts/wk/kit/ufd.py +++ b/scripts/wk/kit/ufd.py @@ -123,7 +123,7 @@ def build_ufd() -> None: if not args['--update']: ui.print_info('Prep UFD') try_print.run( - message='Zeroing first 64MiB...', + message='Zeroing first 1MiB...', function=zero_device, dev_path=ufd_dev, ) @@ -671,12 +671,12 @@ def verify_ufd(dev_path) -> pathlib.Path: def zero_device(dev_path) -> None: - """Zero-out first 64MB of device.""" + """Zero-out first 1MB of device.""" cmd = [ 'sudo', 'dd', - 'bs=4M', - 'count=16', + 'bs=1M', + 'count=1', 'if=/dev/zero', f'of={dev_path}', ] From ee7c7c244870bbabc4c780037d3fe1e0d52717ca Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sat, 30 Mar 2024 23:04:49 -0700 Subject: [PATCH 2/2] Allow using the live CD/DVD/etc as a source --- scripts/wk/kit/ufd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/wk/kit/ufd.py b/scripts/wk/kit/ufd.py index eb739457..76ed2520 100644 --- a/scripts/wk/kit/ufd.py +++ b/scripts/wk/kit/ufd.py @@ -5,6 +5,7 @@ import logging import math import os import pathlib +import re import shutil from subprocess import CalledProcessError @@ -287,7 +288,7 @@ def confirm_selections(update=False) -> None: def copy_source(source, items, from_live=False, overwrite=False) -> None: """Copy source items to /mnt/UFD.""" - is_image = not from_live and source.is_file() + is_image = not from_live and (source.is_file() or source.is_block_device()) items_not_found = False # Mount source if necessary @@ -472,6 +473,7 @@ def is_valid_path(path_obj, path_type) -> bool: valid_path = path_obj.is_file() and path_obj.suffix.lower() == '.img' elif path_type == 'ISO': valid_path = path_obj.is_file() and path_obj.suffix.lower() == '.iso' + valid_path = valid_path or re.match(r'^/dev/sr\d+$', str(path_obj)) elif path_type == 'UFD': valid_path = path_obj.is_block_device()