]> arthur.barton.de Git - bup.git/commitdiff
cleanup-mounts-under: skip if no /proc/mounts
authorRob Browning <rlb@defaultvalue.org>
Sun, 17 Jul 2016 16:46:25 +0000 (11:46 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 17 Jul 2016 16:46:57 +0000 (11:46 -0500)
Avoid "make clean" failures on "not Linux".

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
t/cleanup-mounts-under

index 88851e3ecf869c283e49f80f2ff8267816079d45..b43d9602d2209e9c9b1d3b2ff6b0d3f1fe7f80c6 100755 (executable)
@@ -4,6 +4,7 @@ bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
 exec "$bup_python" "$0" ${1+"$@"}
 """
 
+from sys import stderr
 import os.path, re, subprocess, sys
 
 def mntent_unescape(x):
@@ -18,10 +19,15 @@ def mntent_unescape(x):
     return re.sub(r'(\\\\|\\011|\\012|\\040)', replacement, x)
 
 targets = sys.argv[1:]
+
+if not os.path.exists('/proc/mounts'):
+    print >> stderr, 'No /proc/mounts; skipping mount cleanup in', repr(targets)
+    sys.exit(0)
+
 exit_status = 0
 for target in targets:
     if not os.path.isdir(target):
-        print >> sys.stderr, target, 'is not a directory'
+        print >> stderr, repr(target), 'is not a directory'
         exit_status = 1
         continue
     top = os.path.realpath(target)