source: branches/confman-1.9/confmandoc.sh @ 589

Revision 589, 14.1 KB checked in by blee, 5 months ago (diff)

Merge fix for #154 into confman-1.9.

Closes #154

  • Property svn:keywords set to Id
Line 
1# Copyright (c) 2008, Christopher Cowart and contributors
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7# * Redistributions of source code must retain the above copyright
8#   notice, this list of conditions and the following disclaimer.
9# * Redistributions in binary form must reproduce the above copyright
10#   notice, this list of conditions and the following disclaimer in the
11#   documentation and/or other materials provided with the distribution.
12#
13# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24#
25# $Id$
26#
27# This is a confman shell library that provides usage and help information.
28# I wanted to get it out of the main script, cause it's really long. This also
29# makes modularizing the code (think foreign languages) in the future.
30
31function print_usage {
32cat <<EOF
33$MYNAME manages configuration files
34
35Usage:
36  $MYNAME [ help | -h ] [ command ]
37  $MYNAME setup
38  $MYNAME update [ -a ] [ -r revision_string ] [ recipe ]
39  $MYNAME commit
40  $MYNAME diff [ working_copy ]
41  $MYNAME audit
42  $MYNAME log [ working_copy ]
43  $MYNAME create module [ module ... ]
44  $MYNAME rmmod module [ module ... ]
45  $MYNAME rename oldmodule newmodule
46  $MYNAME import module livefile
47  $MYNAME install workingfile [ workingfile ... ]
48  $MYNAME status [ working_copy ]
49  $MYNAME state
50  $MYNAME ls [ workingfile | workingdirectory ]
51  $MYNAME lsattr [ workingfile | workingdirectory ]
52  $MYNAME chattr attribute value [ workingfile | workingdirectory ]
53  $MYNAME recipe [ get | list ]
54  $MYNAME recipe [ create | edit | print | remove | set ] recipe_name
55  $MYNAME rmattr attribute [ workingfile | workingdirectory ]
56  $MYNAME rm workingfile
57  $MYNAME cp src_working_copy dest_working_copy
58  $MYNAME mv src_working_copy dest_working_copy
59  $MYNAME mkdir workingdirectory
60  $MYNAME touch workingfile
61  $MYNAME revert workingfile
62  $MYNAME chown owner [ workingfile | workingdirectory ]
63  $MYNAME chgrp group [ workingfile | workingdirectory ]
64  $MYNAME chmod mode  [ workingfile | workingdirectory ]
65  $MYNAME chcom comment-character [ workingfile | workingdirectory ]
66  $MYNAME chln target link_name
67  $MYNAME checklook module
68  $MYNAME checknew module name
69  $MYNAME checkclear module name
70  $MYNAME rollback module [ checkpoint | YYYYMMDD [HHMM] ]
71
72For specific information on a particular $MYNAME subcommand, please run
73  $MYNAME help subcommand
74
75eg: $MYNAME help rollback
76
77EOF
78
79conf_cleanExit $1
80}
81
82function print_help {
83    [ -z "$1" ] && print_usage 0
84
85  case $1 in
86          se* )
87cat <<EOF
88$MYNAME manages configuration files
89
90Usage:
91  $MYNAME setup
92
93The setup command is intended to be run the first time you use $MYNAME.
94It will generate your working copy. setup takes no additional arguments.
95
96EOF
97;;
98          cr* )
99cat <<EOF
100$MYNAME manages configuration files
101
102Usage:
103  $MYNAME create module [ module ... ]
104
105Creates one or more modules for the module arguments provided.
106New modules will appear in the top-level-directory of your work-
107ing copy.  This change will also be committed to the repository
108at the same time.
109
110EOF
111;;
112          rmm* )
113cat <<EOF
114$MYNAME manages configuration files
115
116Usage:
117  $MYNAME rmmod [ module ... ]
118
119Delete the modules corresponding to the specified module argu-
120ments from your working copy. Follow this action with a revert or
121commit operation.
122
123EOF
124;;
125          ren* )
126cat <<EOF
127$MYNAME manages configuration files
128
129Usage:
130  $MYNAME rename oldmodule newmodule
131
132Rename oldmoule to newmodule, updating all singularities, headers, and
133otherwise performing black magic.
134
135EOF
136;;
137          u* )
138cat <<EOF
139$MYNAME manages configuration files
140
141Usage:
142  $MYNAME update [ -a ] [ -r revision_string ] [ recipe ]
143
144With no arguments, the update command will update your entire working copy
145unless the UPDATE_RELEVANT_ONLY flag is set in confman.conf or your
146~/.confmanrc.  With the UPDATE_RELEVANT_ONLY flag, the default behavior of
147the update command is to update all of the files appearing in the current
148host's recipe file.  With a recipe argument, the update command will update
149all files in the working copy relevant to the recipe.  This command does not
150alter the repository.
151
152If -r is used, confman will retrieve versions of the files indicated by
153the revision string, e.g., -r PREV for the previous working copy.
154
155The -a option will force a full update of all files in your working copy,
156regardless of whether UPDATE_RELEVANT_ONLY is set.  Note that before any
157install or commit operation, there is an implicit update that will cause
158the latest repository revision to be reflected in your working copy.
159
160EOF
161;;
162          d* )
163cat <<EOF
164$MYNAME manages configuration files
165
166Usage:
167  $MYNAME diff [ working_copy ]
168
169Look at the changes you've made to your working copy of a file or directory.
170EOF
171;;
172          lo* )
173cat <<EOF
174$MYNAME manages configuration files
175
176Usage:
177  $MYNAME log [ working_copy ]
178
179Look at the log entries for the file or directory specified by working_copy.
180EOF
181;;
182          status )
183cat <<EOF
184$MYNAME manages configuration files
185
186Usage:
187  $MYNAME status [ working_copy ]
188
189Look at the status entries for the file or directory specified by working_copy.
190EOF
191;;
192          state )
193cat <<EOF
194$MYNAME manages configuration files
195
196Usage:
197  $MYNAME state
198
199This command indicates whether the system is "dirty" or "clean."
200
201A dirty system is one that has missed an automated "sync" operation in order
202to preserve changes made by installation operations occuring between the
203repository's export and the system's call to "sync."
204
205Dirty systems may have out-of-date configuration files. Subsquent sync or
206commit operations can bring the sytem up-to-date.
207EOF
208;;
209          cp )
210cat <<EOF
211$MYNAME manages configuration files
212
213Usage:
214  $MYNAME cp src_working_copy dest_working_copy
215
216Copy source to destination. Arguments must be working copies.
217EOF
218;;
219          mv )
220cat <<EOF
221$MYNAME manages configuration files
222
223Usage:
224  $MYNAME mv src_working_copy dest_working_copy
225
226Move source to destination. Arguments must be working copies.
227EOF
228;;
229          co* )
230cat <<EOF
231$MYNAME manages configuration files
232
233Usage:
234    $MYNAME commit [ -F filename | -m message ]
235
236The commit command causes your changes to take effect. This means that
237first, your working copy of all of the modules in the current host's
238recipe will be committed to the repository. This happens after we've run
239a $MYNAME update to prevent out-of-date conflicts. If there are any
240conflicts that require human intervention, the command will fail and exit
241non-zero.
242
243Once $MYNAME is satisfied that all of your changes have been propogated to
244the repository, we will roll-out your working copy to the live filesystem.
245Every module appearing in the host's recipe file will be rolled out IN THE
246ORDER OF APPEARANCE.
247
248If -F or -m are used, the log message will be read from the filename or
249the commandline, respectively, instead of prompting the user.
250
251EOF
252;;
253          im* )
254cat <<EOF
255$MYNAME manages configuration files
256
257Usage:
258  $MYNAME import module livefile
259
260The import subcommand adds the specified file to your working copy of the
261repository.
262
263EOF
264;;
265          in* )
266cat <<EOF
267$MYNAME manages configuration files
268
269Usage:
270    $MYNAME install [-F filename | -m message] workingfile [workingfile [...]]
271
272The install subcommand allows you to roll out a single file from your working
273copy.
274
275If -F or -m are used, the log message will be read from the filename or
276the commandline, respectively, instead of prompting the user.
277
278EOF
279;;
280          rev* )
281cat <<EOF
282$MYNAME manages configuration files
283
284Usage:
285  $MYNAME revert workingfile [ workingfile ... ]
286
287The revert subcommand gives you the opportunity to revert to the file before
288you started making changes to it.
289
290EOF
291;;
292          rm )
293cat <<EOF
294$MYNAME manages configuration files
295
296Usage:
297  $MYNAME rm file
298
299The remove subcommand removes a file from version control It will NOT remove
300the file from the live filesystem.
301
302EOF
303;;
304          mk* )
305cat <<EOF
306$MYNAME manages configuration files
307
308Usage:
309  $MYNAME mkdir directory
310
311This command will create a new version-controlled directory in your working
312copy.  Parent directories do not have to exist; they will be created
313automagically. This command only affects your working copy. It does not commit
314the change.
315
316EOF
317;;
318          ls )
319cat<<EOF
320$MYNAME manages configuration files
321
322Usage:
323  $MYNAME ls [ file | directory ]
324
325The ls subcommand lists out the contents, in modified long form, of the
326current working directory. If a file or directory is specified, it will list
327that instead.
328
329EOF
330;;
331    link | ln )
332cat<<EOF
333$MYNAME manages configuration files
334
335Usage:
336  $MYNAME ( link | ln ) [-f] ( file | directory ) ( link_name | directory)
337
338The ln subcommand creates a symlink within the repository.  The first
339argument is the target of the link, which can be either a file or a
340directory.  The second argument is either the name of a link or the
341directory in which to create a link of the same name as the target.
342The force command causes ln to ignore any files or links already
343present when creating the link.
344EOF
345;;
346          lsattr )
347cat<<EOF
348$MYNAME manages configuration files
349
350Usage:
351  $MYNAME lsattr [ file | directory ]
352
353The lsattr subcommand lists out the confman attributes of files in the
354repository. These attributes can be used to store information such as
355file permissions, ownership, comment characters, syntax checkers, and
356even commands to execute when changing the file.
357
358EOF
359;;
360          chattr )
361cat<<EOF
362$MYNAME manages configuration files
363
364Usage:
365  $MYNAME chattr attribute value [ file | directory ]
366
367The chattr subcommand alters the confman attributes of files in the
368repository. These attributes can be used to store information such as
369file permissions, ownership, comment characters, syntax checkers, and
370even commands to execute when changing the file.
371
372EOF
373;;
374          rmattr )
375cat<<EOF
376$MYNAME manages configuration files
377
378Usage:
379  $MYNAME rmattr attribute [ file | directory ]
380
381The rmattr subcommand removes the confman attributes of files in the
382repository. These attributes can be used to store information such as
383file permissions, ownership, comment characters, syntax checkers, and
384even commands to execute when changing the file.
385
386EOF
387;;
388          cho* )
389cat <<EOF
390$MYNAME manages configuration files
391
392Usage:
393  $MYNAME chown [ -R ] owner [ file | directory ]
394
395The chown command works like it's unix equivalent. It does not support
396user:group notation. The only option it will take is -R for recursive.
397
398EOF
399;;
400          chg* )
401cat <<EOF
402$MYNAME manages configuration files
403
404Usage:
405  $MYNAME chgrp group [ file | directory ]
406
407The chgrp command works like it's unix equivalent. The only option it will take
408is -R for recursive.
409
410EOF
411;;
412          chm* )
413cat <<EOF
414$MYNAME manages configuration files
415
416Usage:
417  $MYNAME chmod mode [ file | directory ]
418
419The chmod command works like it's unix equivalent. Note that it will only
420accept octets as permissions -- it will not interpret symbolic permissions
421correctly. The only option it will take is -R for recursive.
422
423EOF
424;;
425          chc* )
426cat <<EOF
427$MYNAME manages configuration files
428
429Usage:
430  $MYNAME chcom comment-character [ file | directory ]
431
432The chcom subcommand takes a file or directory as an argument and changes the
433comment string associated with it. This will typically only be useful when
434confman has guessed the comment character of your file incorrectly.
435
436EOF
437;;
438    chl* )
439cat <<EOF
440$MYNAME manages configuration files
441
442Usage:
443   $MYNAME chln target link_name
444
445The chln subcommand takes a confman link as an argument and changes the
446target on the live filesystem to which it points.  This works for
447"simulated" symlinks to files on the live filesystem, not on actual
448symlinks within your confman working copy.
449EOF
450;;
451          checkl* )
452cat <<EOF
453$MYNAME manages configuration files
454
455Usage:
456  $MYNAME checklook module
457
458The checklook command peeks into the checkpoints for the specified module
459and gives you a listing of current checkpoints with some other cool info.
460This command does not alter the repository.
461
462EOF
463;;
464          checkn* )
465cat <<EOF
466$MYNAME manages configuration files
467
468Usage:
469  $MYNAME checknew module name
470
471The newcheck command creates a named checkpoint for the specified module.
472This change is committed to the repository immediately.
473
474EOF
475;;
476          checkc* )
477cat <<EOF
478$MYNAME manages configuration files
479
480Usage:
481  $MYNAME checkclear module name
482
483The rmcheck command clears a named checkpoint from the specified module.
484This change is committed to the repository immediately.
485
486EOF
487;;
488          ro* )
489cat <<EOF
490$MYNAME manages configuration files
491
492Usage:
493  $MYNAME rollback module [ checkpoint | YYYYMMDD [HHMM] ]
494
495The rollback command first rolls your working copy of module back to the
496named checkpoint. You can optionally roll-back to a specific point in time
497using a date (and optionally time) as specified in the usage statement.
498This change is immediately committed to the repository.
499
500After the rollback is complete, we perform the equivalent of a:
501  $MYNAME commit
502
503EOF
504;;
505    rec* )
506cat <<EOF
507$MYNAME manages configuration files
508
509Usage:
510  $MYNAME recipe [ get | list ]
511  $MYNAME recipe [ print | edit ] [ recipe_name ]
512  $MYNAME recipe set recipe_name
513  $MYNAME recipe [ create | remove ] [ -F file | -m msg ] recipe_name
514
515The recipe command provides an interface to manage confman recipes.
516
517    create      Create a recipe with the given name
518    edit        Edit a recipe with the given name
519    get         List the host's recipe
520    list        List all recipes
521    print       Print the given recipe (defaults to this host's recipe)
522    remove      Delete a recipe with the given name
523    set         Set the host's recipe to the given name
524
525EOF
526;;
527          * )
528print_usage 1
529;;
530esac
531return 0
532}
Note: See TracBrowser for help on using the repository browser.