Handle non-ISO source items
This commit is contained in:
parent
731a281805
commit
a83dcdd06a
1 changed files with 16 additions and 4 deletions
|
|
@ -59,17 +59,29 @@ def confirm_selections(args):
|
||||||
|
|
||||||
|
|
||||||
def copy_source(source, items, overwrite=False):
|
def copy_source(source, items, overwrite=False):
|
||||||
"""Mount source and copy items to /mnt/UFD."""
|
"""Copy source items to /mnt/UFD."""
|
||||||
mount(source, '/mnt/Source')
|
is_iso = source.name.lower().endswith('.iso')
|
||||||
|
|
||||||
|
# Mount source if necessary
|
||||||
|
if is_iso:
|
||||||
|
mount(source, '/mnt/Source')
|
||||||
|
|
||||||
|
# Copy items
|
||||||
for i_source, i_dest in items:
|
for i_source, i_dest in items:
|
||||||
i_source = '/mnt/Source{}'.format(i_source)
|
i_source = '{}{}'.format(
|
||||||
|
'/mnt/Source' if is_iso else source,
|
||||||
|
i_source,
|
||||||
|
)
|
||||||
i_dest = '/mnt/UFD{}'.format(i_dest)
|
i_dest = '/mnt/UFD{}'.format(i_dest)
|
||||||
try:
|
try:
|
||||||
recursive_copy(i_source, i_dest, overwrite=overwrite)
|
recursive_copy(i_source, i_dest, overwrite=overwrite)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
# Going to assume (hope) that this is fine
|
# Going to assume (hope) that this is fine
|
||||||
pass
|
pass
|
||||||
unmount('/mnt/Source')
|
|
||||||
|
# Unmount source if necessary
|
||||||
|
if is_iso:
|
||||||
|
unmount('/mnt/Source')
|
||||||
|
|
||||||
|
|
||||||
def find_first_partition(dev_path):
|
def find_first_partition(dev_path):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue