cme - Edit data of configuration managed by Config::Model
# general synopsis cme [ global_options ] command application [ options ] [ file ] [ ~~ ] [ modification_instructions ] # edit dpkg config with GUI (requires Config::Model::Dpkg) cme edit dpkg # force usage of simple shell like interface cme edit dpkg-copyright --ui shell # read data from arbitrary file cme check dpkg-copyright path/to/file # edit /etc/sshd_config (requires Config::Model::OpenSsh) sudo cme edit sshd # edit ~/.ssh/config (requires Config::Model::OpenSsh) cme edit ssh # just check the validity of a file cme check multistrap file.conf # check dpkg files, update deprecated parameters and save cme migrate dpkg # like migrate, but also apply all suggested fixes cme fix dpkg # modify configuration with command line cme modify dpkg source 'format="quilt (3.0)"' # likewise with an application that accepts file override cme modify dpkg-copyright ~~ 'Comment="Modified with cme"' # edit a file (file name specification is mandatory here) cme edit multistrap my.conf # map conf data to a fuse file system cme fusefs multistrap my.conf -d fuse_dir # likewise for dpkg data cme fusefs dpkg -d fuse_dir # list all available applications (depends on your installation) cme list
Depending on the commmand described below,
cme program will use Config::Model configuration descriptions to check or modify or fix configuration files.
The 3rd parameter specify the application you want to work on. Most of the time, the relevant configuration file(s) will be found by cme. This is the most simple case. For instance:
sudo cme check popcon
Some application like
multistrap have no constraint on the configuration file name and will require you to specify your configuration file name:
cme check multistrap raspbian.conf
The configuration of an application can take different forms. Either several files (like debian packages), a single file with a predefined file (popcon), or a single file with an arbitrary file name (multistrap).
When needed the configuration file name is specified as the 3rd command argument, i.e.
cme command application file_name. This applies if the application requires a configuration file name (like multistrap), or if the application allows configuration file override.
When the overridden file is
- (a single dash), the configuration is read from STDIN. The resulting file may be written on STDOUT. I.e.
cat debian/confrol | cme migrate dpkg-control -save -
will output a fixed control file on STDOUT.
Show a list all applications where a model is available. This list depends on installed Config::Model modules.
Edit a configuration. By default, a Tk GUI will be opened If Config::Model::TkUI is installed. You can choose another user interface with the
tk: provides a Tk graphical interface (If Config::Model::TkUI is installed).
curses: provides a curses user interface (If Config::Model::CursesUI is installed).
shell: provides a shell like interface. See Config::Model::TermUI for details.
Checks the content of the configuration file of an application. Prints warnings and errors on STDOUT.
cme check fstab
Some applications will allow to override the default configuration file. For instance:
curl http://metadata.ftp-master.debian.org/changelogs/main/f/frozen-bubble/unstable_copyright \ | cme check dpkg-copyright -
Checks the content of the configuration file of an application (and show warnings if needed), update deprecated parameters (old value are saved to new parameters) and save the new configuration.
For more details, see "Upgrade" in Config::Model::Value
A bit like
migrate command, except that warnings are fixed. The configuration is saved if anything was changed. If no changes are done, the file is not saved. Options are:
-from to fix only a subset of a configuration tree. Example:
cme fix dpkg -from 'control binary:foo Depends'
This option can be repeated:
cme fix dpkg -from 'control binary:foo Depends' -from 'control source Build-Depends'
Filter the leaf according to a pattern. The pattern is applied to the element name to be fixed Example:
cme fix dpkg -from control -filter Build # will fix all Build-Depends and Build-Depend-Indep
cme fix dpkg -filter Depend
cme modify dpkg source format="quilt (3.0)" cme modify multistrap my_mstrap.conf sections:base source="http://ftp.fr.debian.org"
Some application like dpkg-copyright allows you to override the configuration file name. The problem is to make the difference between the overridden file name and the modification instruction you want to apply.
Either you specify both overridden file name modifications:
cme modify dpkg-copyright ubuntu/copyright 'Comment="Silly example"
Or you use
~~ to use the default file name:
cme modify dpkg-copyright ~~ 'Comment="Another silly example"
Another example which restores the default value of the text of all GPL like licenses :
cme modify dpkg-copyright ~~ 'License=~/GPL/ text~'
Or update the copyright years of the package maintainer's file:
cme modify dpkg-copyright ~~ 'File=debian/* Copyright=~s/2013/2014/'
You can search the configuration with the following options
Specifies a string or pattern to search.
cme will a list of path pointing to the matching tree element and their value. See "grab(...)" in Config::Model::AnyThing for details on the path syntax.
Narrows down the search to:
$ cme search multistrap my_mstrap.conf -search http -narrow value sections:base source -> 'http://ftp.fr.debian.org' sections:debian source -> 'http://ftp.uk.debian.org/debian' sections:toolchains source -> 'http://www.emdebian.org/debian'
Dump configuration content on STDOUT with Config::Model syntax.
By default, dump only custom values, i.e. different from application built-in values or model default values. You can use the
-dumptype option for other types of dump:
-dumptype [ full | preset | custom ]
Choose to dump every values (full), only preset values or only customized values (default)
Map the configuration file content to a FUSE virtual file system on a directory specified with option
-fuse-dir. To stop (and write the configuration data back to the configuration file), run
fusermount -u <mounted_fuse_dir>.
Mandatory. Directory where the virtual file system will be mounted.
Use this option to debug fuse problems.
Fuse will fail if an element name or key name contains '/'. You can specify a subsitution string to replace '/' in the fused dir. Default is
The following options are available for all commands:
Change the experience level. By default only parameters with "beginner" experience are shown or modifiable. You can choose
master level to get access to more parameters. Note that experience level can be changed in the GUI with the options menu.
Perform the operation even if the configuration file is missing. This may be used to create a minimal configuration file. This option is disabled by default as a missing configuration file often indicates an error during the installation of the application.
Load file even if error are found in data. Bad data are discarded
Create a backup of configuration files before saving. By default,
old will be appended to the backup file. I.e.
foo.conf will be backed up as
foo.conf.old. You can specify an alternate suffix. For instance
Force a save even if no change was done. Useful to reformat the configuration file.
When set, cme will exit 1 if warnings are found during check (of left after fix)
Use this option if you want to test a model under development. This option will add
@INC and use
lib/Config/Model/models as model directory. This option is ignored when run as root.
Specify an alternate directory to find model files. Mostly useful for tests.
Specify a pseudo root directory to read and write the configuration files. (Actual default directory and file names depends on the model (See
-model option). For instance, if you specify
/etc/ssh/sshd_config files will be written in
Provides a full stack trace when exiting on error.
Specify a read/write backend. The actual backend name depends on the model passed to
-model option. See Config::Model::BackendMgr for details.
When set, try to load a model using directly the application name specified as 3rd parameter on the command line. Experimental.
You can use cme from another program by using
-ui simple option. This way you will be able to send command on the standard input of
cme and get the results from the standard output.
cme subcommands can be placed in extensions directory (i.e. in
Config/Model/extensions. When a cme command matched one of this extension, the extension will be run. For instance, if you have:
cme foo will run this program (who must be written in Perl) with the same arguments as
All Config::Model logging is now based on Log::Log4perl. Logging can be configured in the following files:
A sample of a
.log4config-model is provided in contrib directory in
Config::Model distribution of on github
Without these files, the following Log4perl config is used:
log4perl.logger=WARN, Screen log4perl.appender.Screen = Log::Log4perl::Appender::Screen log4perl.appender.Screen.stderr = 0 log4perl.appender.Screen.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.Screen.layout.ConversionPattern = %d %m %n
Log4perl uses the following categories:
Trace change notification through configuration tree and instance.
More categories will come.
cme exits 0 when no errors are found. Exit 1 otherwise.
-strict option is set, cme will exit 1 when warnings are still present when the program ends.
If a configuration model is not up-to-date, you will get errors complaining about unknown parameters. In such a case, please file a bug on request tracked or fix the model and send a pull request. You can see this example from OpenSsh to learn how to fix a model.
For support, please check the following resources:
config-model-users at lists.sourceforge.net
Feedback from users are highly desired. If you find this module useful, please share your use cases, success stories with the author or with the config-model- users mailing list.
Dominique Dumont, ddumont at cpan dot org