/usr/lib/bup/cmd/bup-random is in bup 0.29-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #!/usr/bin/python2.7
import os, sys
from bup import options, _helpers
from bup.helpers import atoi, handle_ctrl_c, log, parse_num
optspec = """
bup random [-S seed] <numbytes>
--
S,seed= optional random number seed [1]
f,force print random data to stdout even if it's a tty
v,verbose print byte counter to stderr
"""
o = options.Options(optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])
if len(extra) != 1:
o.fatal("exactly one argument expected")
total = parse_num(extra[0])
handle_ctrl_c()
if opt.force or (not os.isatty(1) and
not atoi(os.environ.get('BUP_FORCE_TTY')) & 1):
_helpers.write_random(sys.stdout.fileno(), total, opt.seed,
opt.verbose and 1 or 0)
else:
log('error: not writing binary data to a terminal. Use -f to force.\n')
sys.exit(1)
|