3 bup_python="$(dirname "$0")/../config/bin/python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
8 import os.path, re, subprocess, sys
10 def mntent_unescape(x):
18 return unescapes.get(m.group(0))
19 return re.sub(r'(\\\\|\\011|\\012|\\040)', replacement, x)
21 targets = sys.argv[1:]
23 if not os.path.exists('/proc/mounts'):
24 print >> stderr, 'No /proc/mounts; skipping mount cleanup in', repr(targets)
28 for target in targets:
29 if not os.path.isdir(target):
30 print >> stderr, repr(target), 'is not a directory'
33 top = os.path.realpath(target)
34 proc_mounts = open('/proc/mounts', 'r')
35 for line in proc_mounts:
36 _, point, fstype, _ = line.split(' ', 3)
37 point = mntent_unescape(point)
38 if top == point or os.path.commonprefix((top + '/', point)) == top + '/':
39 if fstype.startswith('fuse'):
40 if subprocess.call(['fusermount', '-uz', point]) != 0:
43 if subprocess.call(['umount', '-l', point]) != 0: