3 import os.path, re, subprocess, sys
5 def mntent_unescape(x):
13 return unescapes.get(m.group(0))
14 return re.sub(r'(\\\\|\\011|\\012|\\040)', replacement, x)
16 targets = sys.argv[1:]
18 for target in targets:
19 if not os.path.isdir(target):
20 print >> sys.stderr, target, 'is not a directory'
23 top = os.path.realpath(target)
24 proc_mounts = open('/proc/mounts', 'r')
25 for line in proc_mounts:
26 _, point, fstype, _ = line.split(' ', 3)
27 point = mntent_unescape(point)
28 if top == point or os.path.commonprefix((top + '/', point)) == top + '/':
29 if fstype.startswith('fuse'):
30 if subprocess.call(['fusermount', '-uz', point]) != 0:
33 if subprocess.call(['umount', '-l', point]) != 0: