/usr/bin/0store is in zeroinstall-injector 2.3.3-1.
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #! /usr/bin/python
from __future__ import print_function
import locale
from logging import warn
try:
locale.setlocale(locale.LC_ALL, '')
except locale.Error:
warn('Error setting locale (eg. Invalid locale)')
import os, sys
## PATH ##
from optparse import OptionParser
import logging
from zeroinstall import SafeException
from zeroinstall.zerostore import cli, BadDigest
parser = OptionParser(usage="usage: %prog " +
'\n %prog '.join([c.__doc__ for c in cli.commands]))
parser.add_option("-v", "--verbose", help="more verbose output", action='count')
parser.add_option("-V", "--version", help="display version information", action='store_true')
parser.disable_interspersed_args()
(options, args) = parser.parse_args()
if options.verbose:
logger = logging.getLogger()
if options.verbose == 1:
logger.setLevel(logging.INFO)
else:
logger.setLevel(logging.DEBUG)
hdlr = logging.StreamHandler()
fmt = logging.Formatter("%(levelname)s:%(message)s")
hdlr.setFormatter(fmt)
logger.addHandler(hdlr)
if options.version:
import zeroinstall
print("0store (zero-install) " + zeroinstall.version)
print("Copyright (C) 2009 Thomas Leonard")
print("This program comes with ABSOLUTELY NO WARRANTY,")
print("to the extent permitted by law.")
print("You may redistribute copies of this program")
print("under the terms of the GNU Lesser General Public License.")
print("For more information about these matters, see the file named COPYING.")
sys.exit(0)
if len(args) < 1:
parser.print_help()
sys.exit(1)
try:
cli.init_stores()
pattern = args[0].lower()
matches = [c for c in cli.commands if c.__name__[3:].startswith(pattern)]
if len(matches) == 0:
parser.print_help()
sys.exit(1)
if len(matches) > 1:
raise SafeException("What do you mean by '%s'?\n%s" %
(pattern, '\n'.join(['- ' + x.__name__[3:] for x in matches])))
matches[0](args[1:])
except KeyboardInterrupt as ex:
print("Interrupted", file=sys.stderr)
sys.exit(1)
except OSError as ex:
if options.verbose: raise
print(str(ex), file=sys.stderr)
sys.exit(1)
except IOError as ex:
if options.verbose: raise
print(str(ex), file=sys.stderr)
sys.exit(1)
except cli.UsageError as ex:
print(str(ex), file=sys.stderr)
print("usage: " + sys.argv[0] + " " + matches[0].__doc__, file=sys.stderr)
sys.exit(1)
except SafeException as ex:
if options.verbose: raise
print(str(ex), file=sys.stderr)
sys.exit(1)
|