diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2022-05-09 13:43:52 +0200 |
---|---|---|
committer | Jose M. Guisado <jguisado@soleta.eu> | 2022-06-01 11:48:30 +0200 |
commit | 621d1b9147a0b52cb133fe856b3a13b67711ea57 (patch) | |
tree | 2ce990172d8346d610f01dc6aa91c8d3ed5ed63d /src/utils | |
parent | 81ee4b02dd8ac8adde7755aaff965a16edbf3ab9 (diff) |
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.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/fs.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils/fs.py b/src/utils/fs.py index 7500ebd..191fb86 100644 --- a/src/utils/fs.py +++ b/src/utils/fs.py @@ -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 |