3 # https://sourceware.org/bugzilla/show_bug.cgi?id=26034
4 export "BUP_ARGV_0"="$0"
7 export "BUP_ARGV_${arg_i}"="$arg"
11 # Here to end of preamble replaced during install
12 bup_python="$(dirname "$0")/../../../config/bin/python" || exit $?
13 exec "$bup_python" "$0"
17 from __future__ import absolute_import
19 # Intentionally replace the dirname "$0" that python prepends
21 sys.path[0] = os.path.dirname(os.path.realpath(__file__)) + '/../..'
23 from bup import compat, options, _helpers
24 from bup.helpers import handle_ctrl_c, log, parse_num
28 bup random [-S seed] <numbytes>
30 S,seed= optional random number seed [1]
31 f,force print random data to stdout even if it's a tty
32 v,verbose print byte counter to stderr
34 o = options.Options(optspec)
35 (opt, flags, extra) = o.parse(compat.argv[1:])
38 o.fatal("exactly one argument expected")
40 total = parse_num(extra[0])
44 if opt.force or (not os.isatty(1) and
45 not int(os.environ.get('BUP_FORCE_TTY', 0)) & 1):
46 _helpers.write_random(sys.stdout.fileno(), total, opt.seed,
47 opt.verbose and 1 or 0)
49 log('error: not writing binary data to a terminal. Use -f to force.\n')