Russ Allbery > Software > Scripts | distribrc Changes > |
(Maintain configuration files in multiple locations)
distribrc [-fhnv] [-l location] [file ...]
distribrc is intended to maintain a set of configuration files in a wide variety of locations from a single source directory. For example, I use this program to maintain my dotfiles (.cshrc, .xsession, and the like) so that I can automatically copy the new versions to all of my accounts when they change. It's designed so that you only have to make a modification once in the source skeleton directory and then run distribrc, and the updated version will be copied into every additional location.
distribrc uses a database of locations, file sets, and copying commands to determine which files to copy where and how, and a separate database of times used to store the last time when a given file was copied to a given location. The former database consists of a line of the form:
> location file_set command
for every different location, where location is whatever name you want
to assign to the location (it can be arbitrary), file_set is the name
of a file set to copy to that location (see below), and command is the
command used to copy files there. The first *
in file_set will be
replaced by the path to the source file and the second *
will be
replaced by the path to the destination file. So, for example, the
following would be a reasonable location definition:
> cyclone build rcp * eagle@cyclone.Stanford.EDU:~/*
This would copy all files in the file set build to the machine cyclone.Stanford.EDU using rcp.
A file set is defined by a label, followed by a list of source and destination file pairs, followed by a blank line. So, for example, this could be a file set:
build: cshrc .cshrc emacs-small .emacs login .login
This would copy the file cshrc in the skeleton directory to .cshrc at the location, emacs-small to .emacs, and so forth.
By default, all files are copied to all locations, unless a given file hasn't been modified since it was last copied to a given location. If files are specifically listed on the command line, only those files will be copied. If you want to update one location only, see the -l flag below.
Print out this documentation (which is done simply by feeding the script
to perldoc -t
.
Print out the version of distribrc and exit.
Ignore the stored timestamp information and copy all files regardless of whether they were changed or not. This is best used with a list of configuration files on the command line or the -l option below (or both).
Update only location rather than updating all locations in the database.
Print out the commands which would have been run but don't actually do
anything. Think make -n
.
Used to locate the skeleton directory (which is $HOME/skel by default)
and used to expand ~
in source file names in the database.
The directory to use as a skeleton directory, where the database and times files are found and the default directory to search for configuration files. If not set, this defaults to $HOME/skel.
Located in the skeleton directory, this is the database of locations and file sets as described above.
A Berkeley DB file listing the last time a given configuration file was copied to a given location.
Currently, if you want to change the default skeleton directory or the names of the database and times files, you need to modify the beginning of this script.
The current version of this script is available from Russ Allbery's script page at <http://www.eyrie.org/~eagle/software/scripts/>.
Russ Allbery <rra@stanford.edu>
Copyright 1996, 1997, 2013 Russ Allbery <rra@stanford.edu>
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
Russ Allbery > Software > Scripts | distribrc Changes > |