/usr/bin/fsck-larch is in python-larch 1.20151025-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 | #! /usr/bin/python
# Copyright 2010, 2011 Lars Wirzenius
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# To debug, one can create a tracing logfile by adding arguments like:
# --trace=fsck --log=fsck.logfile
import cliapp
import logging
import sys
import tracing
import ttystatus
import larch.fsck
class Fsck(cliapp.Application):
def add_settings(self):
self.settings.string_list(['trace'], 'add PATTERN to trace patterns',
metavar='PATTERN')
self.settings.boolean(['fix'], 'fix problems found?')
def process_args(self, args):
for pattern in self.settings['trace']:
tracing.trace_add_pattern(pattern)
at_least_one_error = False
for dirname in args:
self.errors = False
forest = larch.open_forest(
allow_writes=self.settings['fix'], dirname=dirname)
self.ts = ttystatus.TerminalStatus(period=0.1)
self.ts['item'] = None
self.ts['items'] = 0
self.ts['last_id'] = forest.last_id
self.ts.format(
'Checking %Counter(item)/%Integer(last_id): %String(item)')
self.ts.notify('fsck-larch for %s' % dirname)
fsck = larch.fsck.Fsck(forest, self.warning, self.error,
self.settings['fix'])
fsck.run_fsck( ts = self.ts )
self.ts.finish()
if self.errors:
at_least_one_error = True
else:
print 'fsck-larch for %s: No errors found' % dirname
if self.errors:
sys.exit(1)
def error(self, msg):
self.errors = True
self.ts.notify(msg)
logging.error(msg)
def warning(self, msg):
self.ts.notify(msg)
logging.warning(msg)
if __name__ == '__main__':
Fsck().run()
|