This file is indexed.

/usr/bin/cme is in libconfig-model-perl 2.061-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
#!/usr/bin/perl 

eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
    if 0; # not running under some shell
#
# This file is part of Config-Model
#
# This software is Copyright (c) 2014 by Dominique Dumont.
#
# This is free software, licensed under:
#
#   The GNU Lesser General Public License, Version 2.1, February 1999
#

use strict;
use warnings;
use 5.10.1;

use Config::Model;
use Config::Model::Lister;
use Config::Model::ObjTreeScanner;
use Getopt::Long;
use Pod::Usage;
use Path::Tiny;
use POSIX qw/setsid/;

sub run_shell_ui ($$) {
    my ($root, $root_model) = @_;

    require Config::Model::TermUI;
    my $shell_ui = Config::Model::TermUI->new(
        root   => $root,
        title  => $root_model . ' configuration',
        prompt => ' >',
    );

    # engage in user interaction
    $shell_ui->run_loop;
}

my $ui_type;

my $model_dir;
my $trace = 0;
my $root_dir;

my $man        = 0;
my $help       = 0;
my $force_load = 0;
my $dev        = 0;
my $backend;
my $dumptype;
my $load;
my @fix_from;
my $fix_filter;
my $force_save = 0;
my $open_item  = '';
my $fuse_dir;
my $fuse_debug  = 0;
my $apply_fixes = 0;
my $search;
my $search_type = 'all';
my $dir_char_mockup;
my $try_application_as_model = 0; # means search a model instead of an application name
my $backup;
my $auto_create;
my $strict = 0;

my %command_option = (
    list    => [],
    check   => [],
    migrate => [],
    fix     => [
        "from=s"   => \@fix_from,
        "filter=s" => \$fix_filter,
    ],
    modify => [],
    search => [
        "search=s"        => \$search,
        "narrow-search=s" => \$search_type,
    ],
    edit => [
        "ui|if=s"               => \$ui_type,
        "open_item|open-item=s" => \$open_item,
    ],
    shell => [
        "open_item|open-item=s" => \$open_item,
    ],
    dump => [
        "dumptype:s" => \$dumptype,
    ],
    fusefs => [
        "fuse_dir|fuse-dir=s" => \$fuse_dir,
        "dfuse!"              => \$fuse_debug,
        "dir-char=s"          => \$dir_char_mockup,
    ],
);

my @global_options = (
    "model_dir|model-dir=s"  => \$model_dir,
    "try-app-as-model!"      => \$try_application_as_model,
    "dev!"                   => \$dev,
    "force_load|force-load!" => \$force_load,
    "create!"                => \$auto_create,
    "root_dir|root-dir=s"    => \$root_dir,
    "backend=s"              => \$backend,
    "stack-trace|trace!"     => \$trace,
    "backup:s"               => \$backup,
    "save!"                  => \$force_save,
    "strict!"                => \$strict,
);

# retrieve the main command, i.e. the first arg without leading dash
my ($command) = grep { !/^-/ } @ARGV;

pod2usage( -message => 'no command specified', -verbose => 0 )
    unless defined $command;

pod2usage( -verbose => 1 ) if $command =~ /help/;
pod2usage( -verbose => 2 ) if $command =~ /man/;

# scan lib/Config/Model/extensions dir to find cme-* subcommands
my @dir_to_scan = @INC;
my %extension_path;
foreach my $inc (@dir_to_scan) {
    my $dir = path("$inc/Config/Model/extensions/");
    next unless -d $dir;
    foreach my $ext ( $dir->children ) {
        my $cmd = substr $ext->basename, 4;

        # don't clobber commands found before in @INC
        next if $extension_path{$cmd};

        $command_option{$cmd} = [];
        $extension_path{$cmd} = $ext;
    }
}

# run extention if the command matches one extension
if ( my $path = $extension_path{$command} ) {
    say "doing $path";
    do $path;    # thus @INC and @ARGV  are still valid
    exit;
}

my $cmd_options = $command_option{$command}
    || pod2usage( -message => "unknown command: $command", -verbose => 0 );

my $result = GetOptions( @global_options, @$cmd_options );

pod2usage( -verbose => 0 ) if not $result;

# @ARGV should be $command, $application, [ $config_file ] [ ~~ ] [ modification_instructions ]

shift @ARGV;
my $application = shift @ARGV;

# ignore $dev if run as root
if ( $> and $dev ) {
    unshift @INC, 'lib';
    $model_dir = 'lib/Config/Model/models/';
    warn "-dev option is ignored when run as root\n";
}

Config::Model::Exception::Any->Trace(1) if $trace;

if ( defined $root_dir && !-e $root_dir ) {
    mkdir $root_dir, 0755 || die "can't create $root_dir:$!";
}

my $model = Config::Model->new( model_dir => $model_dir );

my ( $categories, $appli_info, $appli_map ) = Config::Model::Lister::available_models;

if ( not $application or $command eq 'list' ) {
    print "You forgot to specify an application to run cme on. Like 'cme $command stuff'.\n"
        unless $application;
    print "The following applications are available:\n";
    foreach my $cat ( keys %$categories ) {
        my $names = $categories->{$cat} || [];
        next unless @$names;
        print "$cat:\n  ", join( "\n  ", @$names ), "\n";
    }
    exit 1;
}

my $root_model = $appli_map->{$application};
$root_model ||= $application if $try_application_as_model;

if ( not defined $root_model ) {
    die "Unknown application: $application. Run 'cme list' to list available applications\n";
}

# @ARGV should be [ $config_file ] [ ~~ ] [ modification_instructions ]
my $config_file;
if ( $appli_info->{$application}{require_config_file} ) {
    $config_file = shift @ARGV;
    pod2usage(
        -message => "no config file specified. Command should be cme $command $application file",
        -verbose => 0
    ) unless defined $config_file;
}
elsif ( $appli_info->{$application}{allow_config_file_override} and $ARGV[0] and $ARGV[0] ne '~~' )
{
    $config_file = shift @ARGV;
}

# else cannot distinguish between bogus config_file and modification_instructions

# slurp any '~~'
if ( $ARGV[0] and $ARGV[0] eq '~~' ) {
    shift @ARGV;
}

# now @ARGV contains modification_instructions (or bogus config_file) which can only be used by command modify
if ( @ARGV and $command ne 'modify' ) {
    pod2usage(
        -message => "cannot specify config modification with command $command",
        -verbose => 0
    );
}

my $inst = $model->instance(
    root_class_name => $root_model,
    instance_name   => $application,
    application     => $application,
    root_dir        => $root_dir,
    check           => $force_load ? 'no' : 'yes',
    auto_create     => $auto_create,
    skip_read       => $load ? 1 : 0,
    backend         => $backend,
    backup          => $backup,
    config_file     => $config_file,
);

my $root         = $inst->config_root;
my $request_save = 0;

if ( $command eq 'dump' ) {
    my $dump_string = $root->dump_tree( mode => $dumptype || 'custom' );
    print $dump_string ;
}
elsif ( $command eq 'check' ) {
    say "loading data";
    Config::Model::ObjTreeScanner->new( leaf_cb => sub { } )->scan_node( undef, $root );
    say "checking data";
    $root->dump_tree( mode => 'full' );
    say "check done";
}
elsif ( $command eq 'search' ) {
    pod2usage( -message => "missing -search option with search command" )
        unless defined $search;
    my @res = $root->tree_searcher( type => $search_type )->search($search);
    foreach my $path (@res) {
        print "$path";
        my $obj = $root->grab($path);
        if ( $obj->get_type =~ /leaf|check_list/ ) {
            my $v = $obj->fetch;
            $v = defined $v ? $v : '<undef>';
            print " -> '$v'";
        }
        print "\n";
    }
}
elsif ( $command eq 'migrate' ) {
    $request_save = 1;
    $root->migrate;
}
elsif ( $command eq 'fix' ) {
    @fix_from = ('') unless @fix_from;
    foreach my $path (@fix_from) {
        my $node_to_fix = $inst->config_root->grab($path);
        my $msg = "Fixing $application configuration";
        $msg .= "from node", $node_to_fix->name if $path;
        say $msg. "...";
        $node_to_fix->apply_fixes($fix_filter);
    }
    $request_save = 1;
}
elsif ( $command eq 'modify' ) {
    if (@ARGV) {
        $root->load("@ARGV");
    }
    else {
        pod2usage( -message => "No modification instructions given on command line", verbose => 0 );
    }
    $request_save = 1;
}
elsif ( $command =~ /^fuse/ ) {
    eval { require Config::Model::FuseUI; };
    my $has_fuse = $@ ? 0 : 1;

    die "could not load Config::Model::FuseUI. Is Fuse installed ?\n"
        unless $has_fuse;
    die "Missing -fuse_dir option\n" unless defined $fuse_dir;
    die "Directory $fuse_dir does not exists\n" unless -d $fuse_dir;

    my @extra;
    push @extra, dir_char_mockup => $dir_char_mockup if $dir_char_mockup;
    my $ui = Config::Model::FuseUI->new(
        root       => $root,
        mountpoint => "$fuse_dir",
        @extra,
    );

    print "Mounting config on $fuse_dir in background.\n",
        "Use command 'fusermount -u $fuse_dir' to unmount\n";

    # now fork
    my $pid = fork;

    if ( defined $pid and $pid == 0 ) {

        # child process, just run fuse and wait for exit
        $ui->run_loop( debug => $fuse_debug );
        $request_save = 1;
    }
    else {
        exit;    # don't save data in parent process
    }
}
elsif ( $command eq 'shell' ) {
    run_shell_ui($root, $root_model) ;
}
elsif ( $command eq 'edit' ) {
    eval { require Config::Model::TkUI; };
    my $has_tk = $@ ? 0 : 1;

    eval { require Config::Model::CursesUI; };
    my $has_curses = $@ ? 0 : 1;

    if ( not defined $ui_type ) {
        if ($has_tk) {
            $ui_type = 'tk';
        }
        elsif ($has_curses) {
            warn "You should install Config::Model::TkUI for a ", "more friendly user interface\n";
            $ui_type = 'curses';
        }
        else {
            warn "You should install Config::Model::TkUI or ",
                "Config::Model::CursesUI ",
                "for a more friendly user interface\n";
            $ui_type = 'shell';
        }
    }

    if ( $ui_type eq 'simple' ) {

        require Config::Model::SimpleUI;
        my $shell_ui = Config::Model::SimpleUI->new(
            root   => $root,
            title  => $root_model . ' configuration',
            prompt => ' >',
        );

        # engage in user interaction
        $shell_ui->run_loop;
    }
    elsif ( $ui_type eq 'shell' ) {
        run_shell_ui($root, $root_model) ;
    }
    elsif ( $ui_type eq 'curses' ) {
        die "cannot run curses interface: ", "Config::Model::CursesUI is not installed\n"
            unless $has_curses;
        my $err_file = '/tmp/cme-error.log';

        print "In case of error, check $err_file\n";

        open( FH, "> $err_file" ) || die "Can't open $err_file: $!";
        open STDERR, ">&FH";

        my $dialog = Config::Model::CursesUI->new();

        # engage in user interaction
        $dialog->start($model);

        close FH;
    }
    elsif ( $ui_type eq 'tk' ) {
        die "cannot run Tk interface: Config::Model::TkUI is not installed\n"
            unless $has_tk;

        require Tk;
        require Tk::ErrorDialog;
        Tk->import;

        no warnings 'once';
        my $mw = MainWindow->new;
        $mw->withdraw;

        # Thanks to Jerome Quelin for the tip
        $mw->optionAdd( '*BorderWidth' => 1 );

        my $cmu = $mw->ConfigModelUI(
            -root       => $root,
        );

        if ($open_item) {
            my $obj = $root->grab($open_item);
            $cmu->force_element_display($obj);
        }

        &MainLoop;    # Tk's
    }
    elsif ( $ui_type =~ /^no/i ) {

        # trigger a dump to load all sub-models
        my $dump = $root->dump_tree;
        $request_save = 1 if $apply_fixes or $load;
    }
    else {
        die "Unsupported user interface: $ui_type";
    }
}
else {
    die "Looks like the author forgot to implement $command. Bad author, bad.";
}

if ($request_save) {
    $inst->say_changes;

    # if load was forced, must write back to clean up errors (even if they are not changes
    # at semantic level, i.e. removed unnecessary stuff)
    $inst->write_back( force => $force_load || $force_save );
}

my $ouch = $inst->has_warning;
if ( $strict and $ouch ) {
    die "Found $ouch warnings in strict mode\n";
}

exit 0;

__END__

=pod

=head1 NAME

cme - Edit data of configuration managed by Config::Model

=head1 SYNOPSIS

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

  # 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 
  

=head1 DESCRIPTION

Depending on the commmand described below, C<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 C<multistrap> have no constraint on the
configuration file name and will require you to specify your
configuration file name:

  cme check multistrap raspbian.conf

=head1 Configuration file specification

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. C<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 C<-> (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.

=head1 Commands

=head2 list

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

=head2 edit

Edit a configuration. By default, a Tk GUI will be opened If L<Config::Model::TkUI> is
installed. You can choose another user interface with the C<-ui> option:

=over

=item *

C<tk>: provides a Tk graphical interface (If L<Config::Model::TkUI> is
installed).

=item *

C<curses>: provides a curses user interface (If
L<Config::Model::CursesUI> is installed).

=item *

C<shell>: provides a shell like interface.  See L<Config::Model::TermUI>
for details.

=back

=head2 shell

Edit the configuration with a shell like interface.  See L<Config::Model::TermUI>
for details. This is a shortcut for C<edit -ui shell>.

=head2 check

Checks the content of the configuration file of an application. Prints warnings
and errors on STDOUT.

Example:

 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 -

=head2 migrate

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 L<Config::Model::Value/Upgrade>

=head2 fix

A bit like C<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:

=over 

=item from

Use option C<-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'

=item filter

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

or 

 cme fix dpkg -filter Depend 

=back

=head2 modify

Modify a configuration file with the values passed on the command line.
These command must follow the syntax defined in L<Config::Model::Loader>
(which is similar to the output of L<cme dump|"/dump"> command)

Example:

   cme modify dpkg source format="(3.0) quilt"
   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 C<~~> 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/'

=head2 search

You can search the configuration with the following options

=over 

=item -search

Specifies a string or pattern to search. C<cme> will a list of path pointing 
to the matching tree element and their value. 
See L<Config::Model::AnyThing/grab(...)> for details
on the path syntax.

=item -narrow-search

Narrows down the search to:

=over 

=item element 

=item value 

=item key 

=item summary 

Summary text

=item description

description text 

=item help

value help text

=back 

=back 

Example:

 $ 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'

=head2 dump

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 C<-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)

=head2 fusefs 

Map the configuration file content to a FUSE virtual file system on a
directory specified with option C<-fuse-dir>. To stop (and write the
configuration data back to the configuration file), run C<< fusermount
-u <mounted_fuse_dir> >>.

Options:

=over

=item -fuse-dir

Mandatory. Directory where the virtual file system will be mounted.

=item -dfuse

Use this option to debug fuse problems.

=item -dir-char

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 C<< <slash> >>.

=back

=head1 Global options

The following options are available for all commands:

=over

=item -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 as a missing configuration file often indicates an
error during the installation of the application.

=item -force-load

Load file even if error are found in data. Bad data are discarded

=item -backup

Create a backup of configuration files before saving. By default, C<old> will
be appended to the backup file. I.e. C<foo.conf> will be backed up as C<foo.conf.old>.
You can specify an alternate suffix. For instance C<-backup dpkg-old>.

=item -save

Force a save even if no change was done. Useful to reformat the configuration file.

=item -strict

When set, cme will exit 1 if warnings are found during check (of left after fix)

=back

=head1 Advanced options

=over

=item -dev

Use this option if you want to test a model under development. This
option will add C<lib> in C<@INC> and use C<lib/Config/Model/models>
as model directory. This option is ignored when run as root.

=item -model-dir

Specify an alternate directory to find model files. Mostly useful for
tests.

=item -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 C<-model> option). For instance, if you specify C<~/mytest>, the
C</etc/ssh/sshd_config> files will be written in C<~/mytest/etc/ssh/>
directory.

=item -stack-trace

Provides a full stack trace when exiting on error.

=item -backend

Specify a read/write backend. The actual backend name depends on the model
passed to C<-model> option. See L<Config::Model::BackendMgr> for details.

=item -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.

=back

=head1 Embedding cme

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

=head1 cme extensions

New C<cme> subcommands can be placed in extensions directory (i.e. in
C<Config/Model/extensions>. When a cme command matched one of this extension,
the extension will be run. For instance, if you have:

 .../Config/Model/extensions/cme-foo
 
Running C<cme foo> will run this program (who must be written in Perl) with 
the same arguments as C<cme>.

=head1 Logging

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

=over

=item *

 ~/.log4config-model

=item * 

 /etc/log4config-model.conf

=back

A sample of a C<.log4config-model> is provided in contrib directory in C<Config::Model>
distribution of on L<github|https://github.com/dod38fr/config-model/blob/master/contrib/log4config-model>

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:

=over

=item Anything

=item Anything::Change

Trace change notification through configuration tree and instance.

=item Backend

=item Backend::Debian::Dpkg

=item Backend::Debian::Dpkg::Control

=item Backend::Debian::Dpkg::Copyright

=item Backend::Fstab

=item Backend::IniFile

=item Backend::PlainFile

=item Backend::ShellVar

=item Backend::Yaml

=item FuseUI

=item Instance

=item Loader

=item Model::Searcher

=item Tree::Element::CheckList

=item Tree::Element::Id

=item Tree::Element::Id::Hash

=item Tree::Element::Id::List

=item Tree::Element::Value

=item Tree::Element::Value::Dependency

=item Tree::Node

=item Tree::Node::Warped

=item ValueComputer

=item Warper

=item Wizard::Helper

=item Model


=back

More categories will come.

=head1 EXIT CODE

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

If C<-strict> option is set, cme will exit 1 when warnings are still present when the program ends.

=head1 BUGS

=head2 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 
L<request tracked|http://rt.cpan.org/> or fix the model and send a pull request. 
You can see this 
L<example from OpenSsh|https://github.com/dod38fr/config-model/wiki/New-parameter-for-openssh-example>
to learn how to fix a model.

=head1 SUPPORT

For support, please check the following resources:

=over

=item *

The config-model users mailing list:

 config-model-users at lists.sourceforge.net

=item *

The config-model wiki: L<http://github.com/dod38fr/config-model/wiki>

=back

=head1 FEEDBACKS

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. 

=head1 AUTHOR

Dominique Dumont, ddumont at cpan dot org

=head1 SEE ALSO

L<Config::Model::Model>, 
L<Config::Model::Instance>, 
L<Config::Model::Node>, 
L<Config::Model::HashId>,
L<Config::Model::ListId>,
L<Config::Model::WarpedNode>,
L<Config::Model::Value>

=cut