Mount UFD sources read-only

This commit is contained in:
2Shirt 2019-05-24 15:39:19 -06:00
parent 16f0b1dc2a
commit 9318e97400
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 10 additions and 3 deletions

View file

@ -1,6 +1,6 @@
#!/bin/env python3 #!/bin/env python3
# #
# pylint: disable=no-name-in-module,wildcard-import # pylint: disable=no-name-in-module,wildcard-import,wrong-import-position
# vim: sts=2 sw=2 ts=2 # vim: sts=2 sw=2 ts=2
"""Wizard Kit: UFD build tool""" """Wizard Kit: UFD build tool"""
@ -73,6 +73,7 @@ if __name__ == '__main__':
function=mount, function=mount,
mount_source=find_first_partition(ufd_dev), mount_source=find_first_partition(ufd_dev),
mount_point='/mnt/UFD', mount_point='/mnt/UFD',
read_write=True,
) )
# Copy sources # Copy sources

View file

@ -209,10 +209,16 @@ def is_valid_path(path_obj, path_type):
return valid_path return valid_path
def mount(mount_source, mount_point): def mount(mount_source, mount_point, read_write=False):
"""Mount mount_source on mount_point.""" """Mount mount_source on mount_point."""
os.makedirs(mount_point, exist_ok=True) os.makedirs(mount_point, exist_ok=True)
cmd = ['mount', mount_source, mount_point] cmd = [
'mount',
mount_source,
mount_point,
'-o',
'rw' if read_write else 'ro',
]
run_program(cmd) run_program(cmd)