Added copy_source()

This commit is contained in:
2Shirt 2019-04-15 22:40:20 -07:00
parent 26aca0df9f
commit fc9de61269
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 19 additions and 0 deletions

View file

@ -65,6 +65,14 @@ if __name__ == '__main__':
)
# 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

View file

@ -58,6 +58,17 @@ def confirm_selections(args):
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):
"""Find path case-insensitively, returns pathlib.Path obj."""
path_obj = pathlib.Path(path).resolve()