SYNOPSIS

 usage: ucfq [options] (file|package)[file|package  ...]

OPTIONS

--help h Print out a usage message.
--debug -d Turn on debugging mode.
--verbose -v Make the script more verbose..
--with-colons -w

Normally, the script presents the information in a human readable tabular format, but that may be harder for a machine to parse. With this option, the output is a compact, colon separated line, with no dividers, headers, or footer.

--state-dr dir

Set the state directory to /path/to/dir instead of the default /var/lib/ucf. Used mostly for testing.

DESCRIPTION

This script takes a set of arguments, each of which is a package or a path to a configuration file, and outputs the associated package, if any, if the file exists on disk, and whether it has been modfied by te user. The output is either a human readable tabular form, or a compact colon-separated machine friendly format.

This script can potentially be used in package postinst scripts during purge to query the system for configuration files that may still exist on the system, and whether these files have been locally modified by the user -- assuming that the package registered all the configuration files with ucf using ucfr.

INTERNALS

Class Methods

All class methods mediate access to class variables. All class methods can be invoked with zero or one parameters. When invoked with the optional parameter, the class method sets the value of the underlying class data. In either case, the value of the underlying variable is returned.

Class ucf

This is a combination view and controller class that mediates between the user and the internal model classes.

new

This is the constructor for the class. It takes a number of optional parameters. If the parameter Colons is present, then the output will be compact. The parameters DEBUG and VERBOSE turn on additional diagnostics from the script.

validate

This routine is responsible for ensuring that the parameters passed in (presumably from the command line) are given preference.

get_config_ref

This routine returns a reference to the configuration hash

dump_config

This routine returns a Data::Dumper for debugging purposes

process

This routine is the work horse routine -- it parses the command line arguments, and queries the on disk databases, determines of the files exist, and have been modified.

report

This routine generates a nicely formatted report based on the information gathered during the processing. There are two kinds of reports, the first being a user friendly tabular form, the second (turned on by the -w option) a easily parseable colon separated report.

Class registry

This moel class encapsulates the package-configuration file associations registry. It parses the data in the registry, and provides methods to query the registry based either on package name, or the full path of the configuration file.

new

This is the constructor for the class. It takes a required parameter StateDir, and based on that, proceeds toparse the registry and populate internal data structures.

list_files

This routine queries the registry and lists all configuration files associated with the given package. Takes the package name as a required parameter.

find_pkg

This routine queries the registry for the package associated with the given file. Takes the path of the configuration file as a required parameter.

Class hashfile

This moel class encapsulates the configuration file hash database. It parses the data in the database, and provides methods to query the hash of the configuration file.

hash

This routine queries the database for the hash associated with the developers version of the given file. Takes the path of the configuration file as a required parameter.

class conffile

This is the encapsulation of a configuration file metadata.

new

This is the constructor for the class. It takes a number of optional parameters. If the parameter Colons is present, then the output will be compact. The parameters DEBUG and VERBOSE turn on additional diagnostics from the script.

conffile_package

This routine is the accessor method of the internal attribute that holds package name associated with the file. If an optional value is present, updates the value of the attribute.

conffile_exists

This routine is the accessor method of the internal attribute that holds the information whether the file exists on disk or not.

conffile_modified

This routine is the accessor method of the internal attribute that holds the information whether the file exists on disk or not. If an optional value is present, updates the value of the attribute.

conffile_hash

This routine is the accessor method of the internal attribute that holds the hash for the developers version of the file. If an optional value is present, updates the value of the attribute. It also notes whether or not the file is modified from the developers version.

CLASS PKG

This is an encapsulation of package metadata. Packages may be associated with configuration files.

new

This is the constructor for the class. It takes a number of optional parameters. If the parameter Colons is present, then the output will be compact. The parameters DEBUG and VERBOSE turn on additional diagnostics from the script.

CLASS object_list

This is a clas which holds lists of object names, either packages or configuration file object names. It provides methods to add, access, and remove objects, as well as an option to list all elements in the list.

new

This is the constructor for the class. It takes no arguments.

element

This is an accessor method for elements of the list. If an optional value argument exists, it creates or updates the element associtated with the vaslue. Takes in a required name, which is used as a kay, and an optional value argument. The value is returned.

remove

Removes elements from the list. Take in an required name, which is used as the key for the element to delete.

list

This routine lists all the elements in the list. It does not take any options.

CAVEATS

This is very inchoate, at the moment, and needs testing.

BUGS

None Known so far.

AUTHOR

Manoj Srivastava <srivasta\@debian.org>

COPYRIGHT AND LICENSE

This script is a part of the Ucf package, and is

Copyright (c) 2006 Manoj Srivastava <srivasta\@debian.org>

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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA