CME(1)

๐Ÿ“ฆ
version 1.044 ยท 2 versions
, in fedora 43, fedora 44

๐Ÿ’– CME(1) โ€” bestie edition ๐Ÿ’–

okay so you found CME(1), which lives in the User Contributed Perl Documentation section of your man pages. Sit down, grab a boba, we're doing this ๐Ÿง‹โœจ


๐ŸŒธ NAME ๐ŸŒธ

cme โ€” Check or edit configuration data with Config::Model

โญ VERSION โญ

version 1.044

๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

# general synopsis
cme [ global_options ] command application [ options ] [ file ] [ modification_instructions ]

# edit dpkg config with GUI (and Config::Model::Dpkg)
cme edit dpkg

# read data from arbitrary file (for model read from alternate file)
cme check dpkg-copyright -file path/to/file

# edit /etc/sshd_config (with Config::Model::OpenSsh)
sudo cme edit sshd

# edit ~/.ssh/config (with Config::Model::OpenSsh)
cme edit ssh

# check validity
cme check dpkg

# 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="(3.0) quilt"'

# likewise with an application that accepts file override
cme modify dpkg-copyright 'Comment="Modified with cme"'

# map conf data to a fuse file system
cme fusefs dpkg-copyright -d fuse_dir
$ ls -l fuse_dir/License/LGPL-2.1+/text
-rw-r--r-- 1 domi domi 391 30 Jan 19:00 fuse_dir/License/LGPL-2.1+/text
$ fusermount -u fuse_dir

# list all available applications (depends on your installation)
cme list

like, look at all those little recipes ๐Ÿฅน every one of them is a real thing you can run.

๐ŸŽ€ DESCRIPTION ๐ŸŽ€

Depending on which command you pick (they're listed below, don't worry), the cme program uses Config::Model configuration descriptions to check, modify, or fix configuration files. it's giving very much "one tool, many vibes".

The 3rd parameter tells cme which application you want to work on. Most of the time cme will just find the relevant configuration file(s) all by itself โ€” this is the most simple case, the no-thoughts-just-vibes case. For instance:

sudo cme check popcon

Some applications โ€” like the late multistrap ๐Ÿชฆ โ€” have no constraint on the configuration file name, so you have to specify your file name yourself:

cme check multistrap raspbian.conf

or

cme check multistrap -file raspbian.conf

๐Ÿ—‚๏ธ Configuration file specification ๐Ÿ—‚๏ธ

The configuration of an application can take different forms, and she contains multitudes:

  • several files (like debian packages)
  • a single file with a predefined file (popcon)
  • a single file with an arbitrary file name (like the late 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 to edit, or if the application allows configuration file override. ๐Ÿซถ

๐Ÿ‘‘ Main commands ๐Ÿ‘‘

This section describes the main commands shipped with cme. Other Config::Model extensions can bring more commands. Run cme help to get the list of available commands on your system. (yes, cme help is your friend, go say hi ๐Ÿ‘‹)

๐Ÿ“‹ list

Show a list all applications where a model is available. This list depends on installed Config::Model modules.

โœ๏ธ edit

Edit a configuration. By default, a Tk GUI will be opened if Config::Model::TkUI is installed. See App::Cme::Command::edit.

๐Ÿš shell

Edit the configuration with a shell like interface. See App::Cme::Command::shell.

โœ… check

Checks the content of the configuration file of an application. See App::Cme::Command::check.

๐Ÿšš migrate

Update deprecated parameters (old value are saved to new parameters) and save the new configuration. See App::Cme::Command::migrate.

๐Ÿฉน fix

Migrate data and fix warnings. See App::Cme::Command::fix.

๐Ÿ’… modify

Modify a configuration file with the values passed on the command line. See App::Cme::Command::modify.

๐Ÿ”„ update

Update the content of the configuration file from external data. Currently, only dpkg-copyright model support update sub command. See App::Cme::Command::update.

Search configuration data for a specific string. See App::Cme::Command::search.

๐ŸŒˆ fusefs

Map the configuration file content to a FUSE virtual file system on a directory specified with option -fuse-dir. Modifications done in the fuse file system are saved to the configuration file when the fusermount -u is run. (it's giving โœจmagicโœจ, truly)

๐ŸŒ Global options ๐ŸŒ

The following options are available for all commands โ€” universal queens, every single one:

  • -create โ€” 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, because a missing configuration file often indicates an error during the installation of the application. ๐Ÿ™ˆ
  • -file โ€” For model that support it, specify an alternate file to read and write the configuration.

You can use this option for model that require the target file to be specified (e.g. the late multitrap model). A file can also be specified with the 4th command argument. E.g. these 2 commands have the same effect:

cme check multistrap foo.conf
cme check multistrap -file foo.conf
  • -force-load โ€” Load file even if errors are found in data. Bad data is discarded. ๐Ÿ’€
  • -canonical โ€” Write config data back using model order. By default, write items back using the order found in the configuration file. This feature is experimental and not supported by all backends. (she's experimental, be gentle)
  • -backup โ€” 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 -backup dpkg-old.
  • -save โ€” Force a save even if no change was done. Useful to reformat the configuration file.
  • -strict โ€” When set, cme will exit 1 if warnings are found during check (of left after fix).
  • -verbose โ€” Show more information about what's going on. ๐Ÿ‘€
  • -quiet โ€” Suppress all output except error messages. ๐Ÿคซ

๐Ÿ”ฎ Advanced options ๐Ÿ”ฎ

  • -model-dir โ€” Specify an alternate directory to find model files. Mostly useful for tests.
  • -root-dir โ€” 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 ~/mytest, the /etc/ssh/sshd_config files will be written in ~/mytest/etc/ssh/ directory.
  • -stack-trace โ€” Provides a full stack trace when exiting on error. ๐Ÿ•ต๏ธ
  • -try-app-as-model โ€” When set, try to load a model using directly the application name specified as 3rd parameter on the command line. Experimental.

๐Ÿงฉ Embedding cme ๐Ÿงฉ

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. bestie-to-bestie pipeline energy ๐Ÿซถ

๐Ÿ“ Logging ๐Ÿ“

All Config::Model logging is now based on Log::Log4perl. Logging can be configured in the following files:

  • ~/.log4config-model
  • /etc/log4config-model.conf

A sample of a .log4config-model is provided in contrib directory in Config::Model distribution of on github (https://github.com/dod38fr/config-model/blob/master/contrib/log4config-model)

Without these files, the following Log4perl config is used:

log4perl.rootLogger=WARN, Screen
log4perl.logger.Model.Legacy = INFO, SimpleScreen
log4perl.additivity.Model.Legacy = 0

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 = %M %m (line %L)%n

log4perl.appender.SimpleScreen        = Log::Log4perl::Appender::Screen
log4perl.appender.SimpleScreen.stderr = 0
log4perl.appender.SimpleScreen.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.SimpleScreen.layout.ConversionPattern = %p: %m%n

log4perl.oneMessagePerAppender = 1

Log4perl uses the following categories:

  • Anything
  • Anything::Change โ€” Trace change notification through configuration tree and instance.
  • Backend
  • Backend::Debian::Dpkg
  • Backend::Debian::Dpkg::Control
  • Backend::Debian::Dpkg::Copyright
  • Backend::Fstab
  • Backend::IniFile
  • Backend::PlainFile
  • Backend::ShellVar
  • Backend::Yaml
  • FuseUI
  • Instance
  • Loader
  • Model::Searcher
  • Tree::Element::CheckList
  • Tree::Element::Id
  • Tree::Element::Id::Hash
  • Tree::Element::Id::List
  • Tree::Element::Value
  • Tree::Element::Value::Dependency
  • Tree::Node
  • Tree::Node::Warped
  • ValueComputer
  • Warper
  • Iterator
  • Model

More categories will come. ๐Ÿ”ฎ (they're cooking, fr fr)

๐Ÿ’€ EXIT CODE ๐Ÿ’€

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

๐Ÿ˜ญ BUGS ๐Ÿ˜ญ

Files may be re-ordered

cme imposes a specific ordering of the parameters of a configuration file. This ordering is derived from the documentation of the configuration, like ssh_confg. cme writes back files using this ordering.

Thus, the diff between the original configuration files and the new version of the file may be more important than expected when cme is used the first time. ๐Ÿ˜ณ so like, first-time diffs are gonna look WILD, don't panic.

Comments may be dropped

Comments are not supported in some applidations (like the one that use YAML in configuration files). Comments are dropped when using cme to edit or modify such files. For more details, see Available backend page: https://github.com/dod38fr/config-model/wiki/Available-models-and-backends#Available_backend. ๐Ÿซฃ your comments, gone, poof.

Configuration models can lag behind the target application

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 github (https://github.com/dod38fr/cme-perl/issues) or fix the model and send a pull request. You can see this example from OpenSsh (https://github.com/dod38fr/config-model/wiki/New-parameter-for-openssh-example) to learn how to fix a model. ๐Ÿ› ๏ธ you can be the fix, icon behavior.

๐Ÿ“š FOR MORE INFORMATION ๐Ÿ“š

For more information, please check:

๐Ÿซถ CONTRIBUTORS ๐Ÿซถ

In alphabetical order:

  • Ross Vandegrift

๐Ÿ’Œ FEEDBACKS ๐Ÿ’Œ

Feedback from users are highly desired. If you find this module useful, please share your use cases, success stories with the author. (literally please, they want to hear from you ๐Ÿฅน)

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

Config::Model::Model, Config::Model::Instance, Config::Model::Node, Config::Model::HashId, Config::Model::ListId, Config::Model::WarpedNode, Config::Model::Value

โœ๏ธ AUTHOR โœ๏ธ

Dominique Dumont

This software is Copyright (c) 2014-2022 by Dominique Dumont <ddumont@cpan.org>.

This is free software, licensed under:

The GNU Lesser General Public License, Version 2.1, February 1999

and that's the whole page bestie!! ๐ŸŒŸ this was perl v5.42.0, dated 2026-02-02, page CME(1) โ€” slay, go check your configs, mwah ๐Ÿ’…๐Ÿ’–

๐Ÿ“ฆ where this page comes from