]> arthur.barton.de Git - bup.git/blobdiff - t/cleanup-mounts-under
web: for unix://path, listen on filesystem socket
[bup.git] / t / cleanup-mounts-under
index 6d5cb873e5c704a5d497df75236a53bcece53244..88851e3ecf869c283e49f80f2ff8267816079d45 100755 (executable)
@@ -1,4 +1,8 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
 
 import os.path, re, subprocess, sys
 
@@ -23,10 +27,14 @@ for target in targets:
     top = os.path.realpath(target)
     proc_mounts = open('/proc/mounts', 'r')
     for line in proc_mounts:
-        _, point, _ = line.split(' ', 2)
+        _, point, fstype, _ = line.split(' ', 3)
         point = mntent_unescape(point)
         if top == point or os.path.commonprefix((top + '/', point)) == top + '/':
-            if subprocess.call(['umount', point]) != 0:
-                exit_status = 1
+            if fstype.startswith('fuse'):
+                if subprocess.call(['fusermount', '-uz', point]) != 0:
+                    exit_status = 1
+            else:
+                if subprocess.call(['umount', '-l', point]) != 0:
+                    exit_status = 1
 
 sys.exit(exit_status)