/usr/lib/s3ql/fsck_db.py is in s3ql 1.11.1-3+deb7u1.
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 | #! /usr/bin/python
'''
fsck_db.py - this file is part of S3QL (http://s3ql.googlecode.com)
Copyright (C) Nikolaus Rath <Nikolaus@rath.org>
This program can be distributed under the terms of the GNU GPLv3.
'''
from __future__ import division, print_function, absolute_import
from argparse import ArgumentTypeError
import logging
import os
import sys
# We are running from the S3QL source directory, make sure
# that we use modules from this directory
basedir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..'))
if (os.path.exists(os.path.join(basedir, 'setup.py')) and
os.path.exists(os.path.join(basedir, 'src', 's3ql', '__init__.py'))):
sys.path = [os.path.join(basedir, 'src')] + sys.path
from s3ql.common import setup_logging
from s3ql.fsck import ROFsck
from s3ql.parse_args import ArgumentParser
log = logging.getLogger("fsck")
def parse_args(args):
parser = ArgumentParser(
description="Checks S3QL file system metadata")
parser.add_log('~/.s3ql/fsck_db.log')
parser.add_debug_modules()
parser.add_quiet()
parser.add_version()
def db_path(s):
s = os.path.splitext(s)[0]
if not os.path.exists(s + '.db'):
raise ArgumentTypeError('Unable to read %s.db' % s)
if not os.path.exists(s + '.params'):
raise ArgumentTypeError('Unable to read %s.params' % s)
return s
parser.add_argument("path", metavar='<path>', type=db_path,
help='Database to be checked')
options = parser.parse_args(args)
return options
def main(args=None):
if args is None:
args = sys.argv[1:]
options = parse_args(args)
setup_logging(options)
fsck = ROFsck(options.path)
fsck.check()
if __name__ == '__main__':
main(sys.argv[1:])
|