Added copy_source()
This commit is contained in:
parent
26aca0df9f
commit
fc9de61269
2 changed files with 19 additions and 0 deletions
|
|
@ -65,6 +65,14 @@ if __name__ == '__main__':
|
||||||
)
|
)
|
||||||
|
|
||||||
# Copy sources
|
# Copy sources
|
||||||
|
for s_label, s_path in sources.items():
|
||||||
|
try_and_print(
|
||||||
|
message='Copying {} files...'.format(s_label),
|
||||||
|
function=copy_source,
|
||||||
|
source=s_path,
|
||||||
|
items=ITEMS[s_label],
|
||||||
|
overwrite=True,
|
||||||
|
)
|
||||||
|
|
||||||
# Update boot entries
|
# Update boot entries
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,17 @@ def confirm_selections(args):
|
||||||
print_standard(' ')
|
print_standard(' ')
|
||||||
|
|
||||||
|
|
||||||
|
def copy_source(source, items, overwrite=False):
|
||||||
|
"""Mount source and copy items to /mnt/UFD."""
|
||||||
|
os.makedirs('/mnt/Source', exist_ok=True)
|
||||||
|
mount(source, '/mnt/Source')
|
||||||
|
for i_source, i_dest in items:
|
||||||
|
i_source = '/mnt/Source{}'.format(i_source)
|
||||||
|
i_dest = '/mnt/UFD{}'.format(i_dest)
|
||||||
|
recursive_copy(i_source, i_dest, overwrite=overwrite)
|
||||||
|
unmount('/mnt/Source')
|
||||||
|
|
||||||
|
|
||||||
def find_path(path):
|
def find_path(path):
|
||||||
"""Find path case-insensitively, returns pathlib.Path obj."""
|
"""Find path case-insensitively, returns pathlib.Path obj."""
|
||||||
path_obj = pathlib.Path(path).resolve()
|
path_obj = pathlib.Path(path).resolve()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue