Linux "ucfr" Command Line Options and Examples
Update Configuration File Registry: associate packages with configuration files

Where Package is the package associated with the configuration file (and, in some sense, its owner), and Path to configuration file is the full path to the location (usually under /etc) where the configuration file lives, and is potentially modified by the end user. Please note that usually this means that we register actual files, and not symbolic links to files.


Usage:

ucfr [options]






Command Line Options:

-h
Print a short usage message
ucfr -h ...
-n
Dry run. Print the actions that would be taken if the script is invoked, but take no action.
ucfr -n ...
-d
Set the debug level to the (optional) level n (n defaults to 1). This turns on copious debugging infor‐mation.
ucfr -d ...
-p
Removes all vestiges of the association between the named package and the configuration file from theregistry. The association must already exist; if the configuration file is associated with some otherpackage, an error happens, unless the option --force is also given. In that case, the any associationsfor the configuration file are removed from the registry, whether or not the package name matches. Thisaction is idempotent, asking for an association to be purged multiple times does not result in anerror, since attempting to remove an non-existent association is silently ignored unless the --verboseoption is used (in which case it just issues a diagnostic).
ucfr -p ...
-v
Make the script be very verbose about setting internal variables.
ucfr -v ...
-f
This option forces operations requested even if the configuration file in consideration is owned byanother package. This allows a package to hijack a configuration file from another package, or to purgethe association between the file and some other package in the registry.
ucfr -f ...
--state-dir
Set the state directory to /path/to/dir instead of the default /var/lib/ucf. Used mostly for testing.USAGEThe most common case usage is pretty simple: a single line invocation in the postinst on configure, andanother single line in the postrm to tell ucfr to forget about the association with the configuration file onpurge (using the --purge option) is all that is needed (assuming ucfr is still on the system).FILES/var/lib/ucf/registry, and /var/lib/ucf/registry.X, where X is a small integer, where previous versions of theregistry are stored./etc/ucf.confEXAMPLESIf the package foo wants to use ucfr to associate itself with a configuration file foo.conf, a simple invoca‐tion of ucfr in the postinst file is all that is needed:ucfr foo /etc/foo.confOn purge, one should tell ucf to forget about the file (see detailed examples in /usr/share/doc/ucf/examples):ucfr --purge foo /etc/foo.confIf you want to remove all the conf files for a given package foo, the simplest way is to use ucfq. For exam‐pleucfq -w foo | cut -d : -f 1 | while read cfile ; do ucfr -v $cfile ; done
ucfr --state-dir ...