]> arthur.barton.de Git - bup.git/blob - lib/cmd/features-cmd.py
Add bup-features to report status; drop ACL warnings
[bup.git] / lib / cmd / features-cmd.py
1 #!/bin/sh
2 """": # -*-python-*-
3 # https://sourceware.org/bugzilla/show_bug.cgi?id=26034
4 export "BUP_ARGV_0"="$0"
5 arg_i=1
6 for arg in "$@"; do
7     export "BUP_ARGV_${arg_i}"="$arg"
8     shift
9     arg_i=$((arg_i + 1))
10 done
11 # Here to end of preamble replaced during install
12 bup_python="$(dirname "$0")/../../config/bin/python" || exit $?
13 exec "$bup_python" "$0"
14 """
15 # end of bup preamble
16
17 from __future__ import absolute_import, print_function
18 import os.path, sys
19
20 sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..']
21
22 from bup import _helpers, compat, metadata, options, version
23 from bup.io import byte_stream
24
25 out = None
26
27 def show_support(out, bool_opt, what):
28     out.write(b'    %s: %s\n' % (what, b'yes' if bool_opt else b'no'))
29
30 optspec = """
31 bup features
32 """
33 o = options.Options(optspec)
34 opt, flags, extra = o.parse(compat.argv[1:])
35
36 sys.stdout.flush()
37 out = byte_stream(sys.stdout)
38
39 out.write(b'bup %s\n' % version.version)
40 out.write(b'Source %s %s\n' % (version.commit, version.date))
41
42 have_readline = getattr(_helpers, 'readline', None)
43 have_libacl = getattr(_helpers, 'read_acl', None)
44 have_xattr = metadata.xattr
45
46 show_support(out, have_readline, b'Command line editing (e.g. bup ftp)')
47 show_support(out, have_libacl, b'Saving and restoring POSIX ACLs')
48 show_support(out, have_xattr, b'Saving and restoring extended attributes (xattrs)')