1CME(1)                User Contributed Perl Documentation               CME(1)
2
3
4

NAME

6       cme - Check or edit configuration data with Config::Model
7

VERSION

9       version 1.038
10

SYNOPSIS

12         # general synopsis
13         cme [ global_options ] command application [ options ] [ file ] [ modification_instructions ]
14
15         # edit dpkg config with GUI (and Config::Model::Dpkg)
16         cme edit dpkg
17
18         # read data from arbitrary file (for model read from alternate file)
19         cme check dpkg-copyright -file path/to/file
20
21         # edit /etc/sshd_config (with Config::Model::OpenSsh)
22         sudo cme edit sshd
23
24         # edit ~/.ssh/config (with Config::Model::OpenSsh)
25         cme edit ssh
26
27         # just check the validity of a file. Both commands are equivalent
28         cme check multistrap file.conf
29         cme check multistrap -file file.conf
30
31         # check dpkg files, update deprecated parameters and save
32         cme migrate dpkg
33
34         # like migrate, but also apply all suggested fixes
35         cme fix dpkg
36
37         # modify configuration with command line
38         cme modify dpkg source 'format="(3.0) quilt"'
39
40         # likewise with an application that accepts file override
41         cme modify dpkg-copyright 'Comment="Modified with cme"'
42
43         # edit a file (file name specification is mandatory here)
44         cme edit multistrap my.conf
45
46         # map conf data to a fuse file system
47         cme fusefs multistrap my.conf -d fuse_dir
48
49         # likewise for dpkg data
50         cme fusefs dpkg -d fuse_dir
51
52         # list all available applications (depends on your installation)
53         cme list
54

DESCRIPTION

56       Depending on the command described below, "cme" program will use
57       Config::Model configuration descriptions to check or modify or fix
58       configuration files.
59
60       The 3rd parameter specify the application you want to work on. Most of
61       the time, the relevant configuration file(s) will be found by cme. This
62       is the most simple case. For instance:
63
64         sudo cme check popcon
65
66       Some application like "multistrap" have no constraint on the
67       configuration file name and will require you to specify your
68       configuration file name:
69
70         cme check multistrap raspbian.conf
71
72       or
73
74         cme check multistrap -file raspbian.conf
75

Configuration file specification

77       The configuration of an application can take different forms. Either
78       several files (like debian packages), a single file with a predefined
79       file (popcon), or a single file with an arbitrary file name
80       (multistrap).
81
82       When needed the configuration file name is specified as the 3rd command
83       argument, i.e. "cme command application file_name". This applies if the
84       application requires a configuration file name (like multistrap), or if
85       the application allows configuration file override.
86

Main commands

88       This section describes the main commands shipped with cme. Other
89       Config::Model extensions can bring more command. Run "cme help" to get
90       the list of available commands on your system.
91
92   list
93       Show a list all applications where a model is available. This list
94       depends on installed Config::Model modules.
95
96   edit
97       Edit a configuration. By default, a Tk GUI will be opened If
98       Config::Model::TkUI is installed. See App::Cme::Command::edit.
99
100   shell
101       Edit the configuration with a shell like interface. See
102       App::Cme::Command::shell.
103
104   check
105       Checks the content of the configuration file of an application. See
106       App::Cme::Command::check.
107
108   migrate
109       Update deprecated parameters (old value are saved to new parameters)
110       and save the new configuration. See App::Cme::Command::migrate.
111
112   fix
113       Migrate data and fix warnings.  See App::Cme::Command::fix.
114
115   modify
116       Modify a configuration file with the values passed on the command line.
117       See App::Cme::Command::modify.
118
119   update
120       Update the content of the configuration file from external data.
121       Currently, only dpkg-copyright model support update sub command.  See
122       App::Cme::Command::update.
123
124   search
125       Search configuration data for a specific string. See
126       App::Cme::Command::search.
127
128   fusefs
129       Map the configuration file content to a FUSE virtual file system on a
130       directory specified with option "-fuse-dir". Modifications done in the
131       fuse file system are saved to the configuration file when the
132       "fusermount -u" is run.
133

Global options

135       The following options are available for all commands:
136
137       -create
138           Perform the operation even if the configuration file is missing.
139           This may be used to create a minimal configuration file. This
140           option is disabled by default as a missing configuration file often
141           indicates an error during the installation of the application.
142
143       -file
144           For model that support it, specify an alternate file to read and
145           write the configuration.
146
147           You can use this option for model that require the target file to
148           be specified (e.g. multitrap model), but file can in this case be
149           also specified with the 4th command argument. E.g. these 2 commands
150           have the same effect:
151
152             cme check multistrap foo.conf
153             cme check multistrap -file foo.conf
154
155       -force-load
156           Load file even if error are found in data. Bad data are discarded
157
158       -canonical
159           Write config data back using model order. By default, write items
160           back using the order found in the configuration file. This feature
161           is experimental and not supported by all backends.
162
163       -backup
164           Create a backup of configuration files before saving. By default,
165           "old" will be appended to the backup file. I.e. "foo.conf" will be
166           backed up as "foo.conf.old".  You can specify an alternate suffix.
167           For instance "-backup dpkg-old".
168
169       -save
170           Force a save even if no change was done. Useful to reformat the
171           configuration file.
172
173       -strict
174           When set, cme will exit 1 if warnings are found during check (of
175           left after fix)
176
177       -verbose
178           Show more information about what's going on.
179
180       -quiet
181           Suppress all output except error messages.
182

Advanced options

184       -model-dir
185           Specify an alternate directory to find model files. Mostly useful
186           for tests.
187
188       -root-dir
189           Specify a pseudo root directory to read and write the configuration
190           files. (Actual default directory and file names depends on the
191           model (See "-model" option). For instance, if you specify
192           "~/mytest", the "/etc/ssh/sshd_config" files will be written in
193           "~/mytest/etc/ssh/" directory.
194
195       -stack-trace
196           Provides a full stack trace when exiting on error.
197
198       -try-app-as-model
199           When set, try to load a model using directly the application name
200           specified as 3rd parameter on the command line. Experimental.
201

Embedding cme

203       You can use cme from another program by using "-ui simple" option. This
204       way you will be able to send command on the standard input of "cme" and
205       get the results from the standard output.
206

Logging

208       All Config::Model logging is now based on Log::Log4perl.  Logging can
209       be configured in the following files:
210
211
212
213
214            ~/.log4config-model
215
216
217
218
219            /etc/log4config-model.conf
220
221       A sample of a ".log4config-model" is provided in contrib directory in
222       "Config::Model" distribution of on github
223       <https://github.com/dod38fr/config-
224       model/blob/master/contrib/log4config-model>
225
226       Without these files, the following Log4perl config is used:
227
228        log4perl.rootLogger=WARN, Screen
229        log4perl.logger.Model.Legacy = INFO, SimpleScreen
230        log4perl.additivity.Model.Legacy = 0
231
232        log4perl.appender.Screen        = Log::Log4perl::Appender::Screen
233        log4perl.appender.Screen.stderr = 0
234        log4perl.appender.Screen.layout = Log::Log4perl::Layout::PatternLayout
235        log4perl.appender.Screen.layout.ConversionPattern = %M %m (line %L)%n
236
237        log4perl.appender.SimpleScreen        = Log::Log4perl::Appender::Screen
238        log4perl.appender.SimpleScreen.stderr = 0
239        log4perl.appender.SimpleScreen.layout = Log::Log4perl::Layout::PatternLayout
240        log4perl.appender.SimpleScreen.layout.ConversionPattern = %p: %m%n
241
242        log4perl.oneMessagePerAppender = 1
243
244       Log4perl uses the following categories:
245
246       Anything
247       Anything::Change
248           Trace change notification through configuration tree and instance.
249
250       Backend
251       Backend::Debian::Dpkg
252       Backend::Debian::Dpkg::Control
253       Backend::Debian::Dpkg::Copyright
254       Backend::Fstab
255       Backend::IniFile
256       Backend::PlainFile
257       Backend::ShellVar
258       Backend::Yaml
259       FuseUI
260       Instance
261       Loader
262       Model::Searcher
263       Tree::Element::CheckList
264       Tree::Element::Id
265       Tree::Element::Id::Hash
266       Tree::Element::Id::List
267       Tree::Element::Value
268       Tree::Element::Value::Dependency
269       Tree::Node
270       Tree::Node::Warped
271       ValueComputer
272       Warper
273       Iterator
274       Model
275
276       More categories will come.
277

EXIT CODE

279       cme exits 0 when no errors are found. Exit 1 otherwise.
280

BUGS

282   Files may be re-ordered
283       "cme" imposes a specific ordering of the parameters of a configuration
284       file. This ordering is derived from the documentation of the
285       configuration, like ssh_confg. "cme" writes back files using this
286       ordering.
287
288       Thus, the diff between the original configuration files and the new
289       version of the file may be more important than expected when "cme" is
290       used the first time.
291
292   Comments may be dropped
293       Comments are not supported in some applidations (like the one that use
294       YAML in configuration files). Comments are dropped when using "cme" to
295       edit or modify such files. For more details, see Available backend
296       <https://github.com/dod38fr/config-model/wiki/Available-models-and-
297       backends#Available_backend> page.
298
299   Configuration models can lag behind the target application
300       If a configuration model is not up-to-date, you will get errors
301       complaining about unknown parameters. In such a case, please file a bug
302       on github <https://github.com/dod38fr/cme-perl/issues> or fix the model
303       and send a pull request.  You can see this example from OpenSsh
304       <https://github.com/dod38fr/config-model/wiki/New-parameter-for-
305       openssh-example> to learn how to fix a model.
306

FOR MORE INFORMATION

308       For more information, please check:
309
310       •   config-model wiki: <http://github.com/dod38fr/config-model/wiki>
311
312       •   Blogs about this project:
313           <https://ddumont.wordpress.com/category/perl/configmodel/>
314

CONTRIBUTORS

316       In alphabetical order:
317
318        Ross Vandegrift
319

FEEDBACKS

321       Feedback from users are highly desired. If you find this module useful,
322       please share your use cases, success stories with the author.
323

SEE ALSO

325       Config::Model::Model, Config::Model::Instance, Config::Model::Node,
326       Config::Model::HashId, Config::Model::ListId,
327       Config::Model::WarpedNode, Config::Model::Value
328

AUTHOR

330       Dominique Dumont
331
333       This software is Copyright (c) 2014-2022 by Dominique Dumont
334       <ddumont@cpan.org>.
335
336       This is free software, licensed under:
337
338         The GNU Lesser General Public License, Version 2.1, February 1999
339
340
341
342perl v5.34.0                      2022-03-24                            CME(1)
Impressum