cdeploy
—
deploy a set of configuration files to a target file
system
cdeploy |
[-chnvDSX ] [-b
backup-dir] [-d
destdir] [-u
user] [-g
group] [-m
mode] [-x
pattern] |
The cdeploy
script was written to deploy configuration
files (or any other kind of files) from a local directory tree (“source
tree”) to another directory tree (“target tree”, by
default the root of the file system).
cdeploy
sticks to the layout of the source
tree. Missing directories in the target tree will be created (if permission
is granted to do so); already existing files will be replaced by the version
from the source tree. Source files replacing existing target files will be
deployed with owner, group and permission of the original target file.
cdeploy
creates a backup of the original
file before replacing it. These backups are stored as freshly created source
tree. In case of trouble with the deployed files, the backup can be restored
by simply deploying it like any other source tree.
The following options are available:
-b
backup-dir
- Specify a location where the backup will be created. By default,
cdeploy
uses ~/.cdeploy to
store backups.
-c
- Only deploy files if the source file differs from the target file. Equity
of source and target file are tested by comparing their MD5 fingerprint
generated by OpenSSL
dgst(1)
-D
- Do not invoke
cap_mkdb(1)
after having deployed a database template file. This is the default
behaviour on all systems except FreeBSD.
-d
destdir
- Set destdir as root directory for the deployment
target. The complete source directory tree will be deployed into the given
target directory.
cdeploy
uses
/ as default deployment target.
-g
group
- Deploy files with group group if automatic detection
fails (e. g. if there is not yet a target file to replace)
-h
- Print a help message including a short usage summary and exit.
-l
loglevel
- Set log level to loglevel. Valid log levels are
DEBUG, INFO,
WARN and ERROR. This option
controls the amount of information dumped to
stdout(4).
By default, the log level is set to WARN.
-m
mode
- Deploy files with mode mode if automatic detection
fails (e. g. if there is not yet a target file to replace)
-n
- This option suppresses any escape sequences in the output generated by
cdeploy
. It is particularly useful when working on
a terminal which cannot process color escape sequences, or when the output
of cdeploy
gets redirected to a file.
Please note: This option should be specified as early
as possible since before it has been processed, any output will still
contain escape sequences.
-S
- This flag causes
cdeploy
to run in simulation
mode. In simulation mode, no modifications to the target directory
structure will be made. However, cdeploy
will test
whether all necessary modifications could be made.
-u
user
- Deploy files with owner user if automatic detection
fails (e. g. if there is not yet a target file to replace)
-v
- Print version information and exit.
-X
- Ignore the exclusion pattern. By default,
cdeploy
excludes files and directories originating from common version control
systems like CVS, Subversion, Mercurial and Git. This option turns off
exclusion completely.
-x
pattern
- Exclude all files matching pattern from being
deployed. pattern may be a regular expression;
extended regular expressions are also supported, as long as they are
understood by
grep(1).
The default exclusion pattern is
.svn|.hg|.cvs|.git
The cdeploy
utility exits 0 on success, and >0 if an
error occurs.
To deploy the content of ~/config
, one would use:
cd ~/config
cdeploy
To test which files would be replaced, one would use:
cdeploy -c -S
To skip the creation of backups (which is actually a bad idea),
one would set the backup directory to /dev/null:
cdeploy -b /dev/null
Compatibility has been tested with the FreeBSD
sh(1) command
interpreter (FreeBSD 7 and 8) and the GNU
bash(1)
(Bourne-Again SHell), version 4.1.5
Hopefully none. In case you encounter one, please contact the author.
Jesco Freund <aihal@users.sourceforge.net>