-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path__main__.py
More file actions
36 lines (27 loc) · 950 Bytes
/
__main__.py
File metadata and controls
36 lines (27 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""A fuse filesystem that hides symlinks."""
import sys
import fuse
import hide_symlinks
def main():
"""Start the FUSE filesystem"""
if len(sys.argv) < 3:
print('usage: {} <root> <mountpoint>'.format(sys.argv[0]))
sys.exit(1)
# Find the filesystem options (the things following "-o")
options = ''
for i in range(len(sys.argv)):
if sys.argv[i] == "-o" and len(sys.argv) > i+1:
options = sys.argv[i+1]
# Turn them into a format fuse.FUSE can handle (kwargs)
fuse_args = {}
for option in options.split(","):
option_parts = option.split("=")
if len(option_parts) == 1:
fuse_args[option_parts[0]] = True
else:
fuse_args[option_parts[0]] = option_parts[1]
# Start the FUSE FS
fuse.FUSE(hide_symlinks.HideSymlinks(sys.argv[1]), sys.argv[2],
foreground=False, **fuse_args)
if __name__ == '__main__':
main()