Added mount and unmount sections

This commit is contained in:
2Shirt 2019-04-15 22:38:54 -07:00
parent 7ee04060d8
commit 26aca0df9f
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 20 additions and 5 deletions

View file

@ -56,9 +56,13 @@ if __name__ == '__main__':
if not args['--update']:
prep_device(ufd_dev, UFD_LABEL, use_mbr=args['--use-mbr'])
# TODO: DELETEME
print_success("It's go-time!")
exit_script()
# Mount UFD
try_and_print(
message='Mounting UFD...',
function=mount,
mount_source=ufd_dev,
mount_point='/mnt/UFD',
)
# Copy sources
@ -68,8 +72,6 @@ if __name__ == '__main__':
# Hide items
# Unmount sources
# Done
if not args['--force']:
print_standard('\nDone.')

View file

@ -125,6 +125,19 @@ def is_valid_path(path_obj, path_type):
return valid_path
def mount(mount_source, mount_point):
"""Mount mount_source on mount_point."""
os.makedirs(mount_point, exist_ok=True)
cmd = ['mount', mount_source, mount_point]
run_program(cmd)
def unmount(mount_point):
"""Unmount mount_point."""
cmd = ['umount', mount_point]
run_program(cmd)
def prep_device(dev_path, label, use_mbr=False):
"""Format device in preparation for applying the WizardKit components