UCFR(1)

UCFR(1) ๐Ÿ’– Debian GNU/Linux manual

okay so bestie, welcome to ucfr โœจ it's from the Debian GNU/Linux manual and it's literally the lil go-between that matches up packages with their config files. let's get into it ๐ŸŽ€


โœจ NAME โœจ

ucfr โ€” Update Configuration File Registry: associate packages with configuration files ๐Ÿซถ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

ucfr [options] <Package> <Path to configuration file>

๐Ÿ’… DESCRIPTION ๐Ÿ’…

So <Package> is the package that's associated with the configuration file โ€” like, in some sense it's the owner of it ๐Ÿ‘‘ โ€” and Path to configuration file is the full path to where that config file actually lives (usually under /etc), the one that the end user might go in and mess with. ๐Ÿ› ๏ธ

Heads up bestie: usually this means we register actual files, not symbolic links to files. ucfr will follow symbolic links and register the real file, not the symlink. no cap. ๐Ÿฆ‹

This script keeps up an association between configuration files and packages, and the whole point is to help provide the kinda facilities that dpkg gives you via conffiles โ€” except for configuration files that aren't shipped in a Debian package but are handled by ucf in the postinst instead. ๐Ÿ’–

This script is idempotent โ€” associating a package to a file multiple times is not an error, we don't do drama here. ๐Ÿ˜Œ But it's normally an error to try to associate a file that's already associated with another packageโ€ฆ though you can override that with the --force option. ๐Ÿ’€


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -h, --help โ€” prints a short usage message. tiny lil helper, we love her ๐ŸŒธ
  • -n, --no-action โ€” dry run!! prints the actions that would be taken if the script is invoked, but takes no action. all vibes, zero consequences โœจ
  • -d [n], --debug [n] โ€” sets the debug level to the (optional) level n (n defaults to 1). this turns on copious debugging information. like, so much info. ๐Ÿ˜ญ
  • -p, --purge โ€” removes all vestiges of the association between the named package and the configuration file from the registry. the association must already exist; if the configuration file is associated with some other package, an error happens โ€” unless the option --force is also given. in that case, any associations for the configuration file are removed from the registry, whether or not the package name matches. ๐Ÿ‘‘

this action is idempotent, so asking for an association to be purged multiple times does not result in an error, since attempting to remove a non-existent association is silently ignored โ€” unless the --verbose option is used, in which case it just issues a diagnostic. ๐Ÿซถ

  • --root /path/to/chroot โ€” sets the root directory. defaults to the value of the DPKG_ROOT environment variable if it is exported non-empty, and "/" otherwise. the path passed as Path to configuration file will be prefixed with the path given by this option. the default state directory path /var/lib/ucf will be prefixed with the path from this option. passing the state directory path explicitly via --state-dir or the UCF_STATE_DIR environment variable will not receive this prefix. lastly, with this option set, configuration settings will be read from /etc/ucf.conf in the given chroot path. ๐Ÿงš
  • -v, --verbose โ€” makes the script be very verbose about setting internal variables. she's a talker fr fr ๐Ÿ’ฌ
  • -f, --force โ€” this option forces operations requested even if the configuration file in consideration is owned by another package. this allows a package to hijack a configuration file from another package, or to purge the association between the file and some other package in the registry. ๐Ÿ˜ณ yes, "hijack" is the actual word, she's dramatic like that
  • --state-dir /path/to/dir โ€” sets the state directory to /path/to/dir instead of the default /var/lib/ucf. used mostly for testing. ๐Ÿงช

๐ŸŒˆ USAGE ๐ŸŒˆ

The most common case usage is pretty simple, bestie: a single line invocation in the postinst on configure, and another single line in the postrm to tell ucfr to forget about the association with the configuration file on purge (using the --purge option) โ€” that's all that is needed (assuming ucfr is still on the system). two lines. that's it. iconic. โœจ


๐Ÿฆ‹ ENVIRONMENT VARIABLES ๐Ÿฆ‹

When the DPKG_ROOT variable is set and not empty, ucfr will operate on the chroot in the path provided by this environment variable. see the --root option for details. ๐Ÿ‘€


๐Ÿ“ FILES ๐Ÿ“

/var/lib/ucf/registry, and /var/lib/ucf/registry.X, where X is a small integer, where previous versions of the registry are stored.

/etc/ucf.conf


๐Ÿ’œ EXAMPLES ๐Ÿ’œ

If the package foo wants to use ucfr to associate itself with a configuration file foo.conf, a simple invocation of ucfr in the postinst file is all that is needed:

ucfr foo /etc/foo.conf

On purge, one should tell ucf to forget about the file (see detailed examples in /usr/share/doc/ucf/examples):

ucfr --purge foo /etc/foo.conf

If you want to remove all the conf files for a given package foo, the simplest way is to use ucfq. For example:

ucfq -w foo | cut -d : -f 1 | while read cfile ; do ucfr -v $cfile ; done

โญ SEE ALSO โญ

ucf(1), ucf.conf(5).


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

This manual page was written by Manoj Srivastava <srivasta@debian.org>, for the Debian GNU/Linux system. ๐Ÿซถ


and that's the whole page bestie!! ๐Ÿ’– this one's from Debian, dated Feb 16 2018 โ€” go forth and register those config files, you absolute main character ๐ŸŒŸ๐Ÿ’…๐ŸŽ€

๐Ÿ“ฆ where this page comes from