MCM

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXIT STATUS
NOTES
FILES
ENVIRONMENT
EXAMPLES
AUTHOR
REPORTING BUGS
COPYRIGHT
SEE ALSO

NAME

mcm − Machine Configuration Manager

SYNOPSIS

mcm [OPTION..] [STARTINGPOINT..] [OPTION..]

DESCRIPTION

Configure the specified files and directories (both file/directory contents and permissions). Changes to be made (if any) are displayed before they are enacted.

Machine Configuration Manager can be used to maintain directories, configuration files and to build scripts in a declarative way. MCM is designed such that it is easy for its inputs and outputs to be reviewed and audited.
STARTINGPOINT

starting point (default = "Go.<lowercase_hostname>"). The starting point may be provided partially. E.g. ".blue" would result in the starting point "Go.blue" being used; similarly "MyUserConfigs." would result in "MyUserConfigs.<lowercase_hostname>" being used. Multiple starting points may be provided, though it only really makes sense to provide multiple starting points together with the options −−parse−only or −−compile-to.

OPTIONS

−V, −−version

show version

−P PATH, −−config−path=PATH

colon−separated list of directories holding configs (default = ".")

−r DIRECTORY, −−root=DIRECTORY

path to manage (default = "./build")

−f no|prompt|ifnew|yes|promptunlessonlyadditions,
−−fix
=no|prompt|ifnew|yes|promptunlessonlyadditions

whether to enact the changes (default = prompt). no and yes result in the changes being only displayed or unconditionally enacted respectively. ifnew causes the changes to be made if the root directory does not exist. prompt asks the user whether to enact the changes, promptunlessonlyadditions automatically enacts the changes if the changes would only result in the addition of new files and/or directories, otherwise prompts the user.

−d, −−diff

display differences (requires ’diff’)

−−parse−only

parse configuration(s) only

−c DIRECTORY, −−compile−to=DIRECTORY

compile (each provided starting point) to a single (but separate) file. Compiled files can then, for example, be sent to destination hosts for implementation.

−−stdin

read (initial) config from stdin

−−error−on−leftover−fragments

complain if there are fragments without corresponding files

EXIT STATUS

0

if OK,

1

when errors are encountered in either reading the config files or implementing the changes,

2

if --fix=ifnew but the root path to manage already exists,

3

if --fix=prompt or --fix=promptunlessonlyadditions and the changes are not enacted (e.g. "N" is entered).

NOTES

The use of aliases/functions (e.g. in ~/.bashrc) is recommended for frequently used invocations. For example:

alias mcmroot=’sudo mcm -r / -P ~/mcm’
alias mcmhome=’mcm -r / -P ~/mcm MyUserConfigs.’

Or if using the grc colouriser:

alias mcmroot=’grc sudo mcm -r / -P ~/mcm’
alias mcmhome=’grc mcm -r / -P ~/mcm MyUserConfigs.’

You might also like to create an alias along the lines of the following, where mcmuserscripts and mcmrootscripts run any Machine Configuration Manager-generated scripts:

alias mcmall=’mcmuser && mcmuserscripts; mcmroot && mcmrootscripts’

FILES

None but those within directories specified with −−config−path.

ENVIRONMENT

PATH

$PATH can be altered to change the version of diff invoked when the -d, --diff option is provided.

EXAMPLES

Starting with the define "mystart" in the file "Go.mcm" in the current directory (with the MCM Package of "Go"), show what changes would be made to the root ./build and then prompt whether to enact them:

mcm .mystart

Starting with the define "<lowercase_hostname>" in the file "MyUserConfigs.mcm" in the current directory (with the MCM Package of "MyUserConfigs"), show what changes would be made to the root ~/ and then prompt whether to enact them:

mcm -r ~/ MyUserConfigs.

Test a long list of starting points (e.g. that a change made for one of them has not broken any others):

mcm --parse-only --error-on-leftover-fragments .oak .beech .birch .maple \
MyUserConfigs.oak MyUserConfigs.beech MyUserConfigs.birch MyUserConfigs.maple \
LiveCD.basic LiveCD.X11 LiveCD.friends \
DebianInstaller.basic DebianInstaller.home DebianInstaller.work DebianInstaller.friends \
Deb.basic Deb.mypackage \
Website.main Website.photos \
RaspberryInstallation.simple RaspberryInstallation.maple RaspberryInstallation.demo

Compile the starting points (Go).maple and MyUserConfigs.maple to single files. The single files can then, for example, be copied to the destination host for implementation, or compared to other compiled files.

grc mcm -d -r / -c compiled/ .maple MyUserConfigs.maple

AUTHOR

Written by Anthony Doggett <mcm@interfaces.org.uk>

REPORTING BUGS

Please email the author at the above address, preferably with sufficient information to reproduce the bug.

COPYRIGHT

Copyright (c) 2014-2017 Anthony Doggett

<http://interfaces.org.uk/mcm>

SEE ALSO

mcm2html(1), mcmtags(1)