mirror of https://git.48k.eu/ogclient
utils: mount_mkdir success if target is a mountpoint
Returns true if target is already a mountpoint. Does not call mount. It's possible that another device might be mounted in the target mountpoint. A future check between the source and target for equal device major:minor must be added.more_events
parent
81ee4b02dd
commit
621d1b9147
|
@ -27,11 +27,17 @@ def find_mountpoint(path):
|
|||
def mount_mkdir(source, target):
|
||||
"""
|
||||
Mounts and creates the mountpoint directory if it's not present.
|
||||
|
||||
Return True if mount is sucessful or if target is already a mountpoint.
|
||||
"""
|
||||
if not os.path.exists(target):
|
||||
os.mkdir(target)
|
||||
|
||||
if not os.path.ismount(target):
|
||||
return mount(source, target)
|
||||
else:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue