Blame Manual/repository-html/repository_74.html

632e8b
632e8b
<html>
632e8b
632e8b
organization, and administration of CentOS Artwork Repository.
632e8b
632e8b
Copyright C 2009-2011 Alain Reguera Delgado
632e8b
632e8b
Permission is granted to copy, distribute and/or modify this document
632e8b
under the terms of the GNU Free Documentation License, Version 1.2 or
632e8b
any later version published by the Free Software Foundation; with no
632e8b
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
632e8b
copy of the license is included in the section entitled GNU Free
632e8b
Documentation License.  
632e8b
-->
ff7772
632e8b
632e8b
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
632e8b
            Karl Berry  <karl@freefriends.org>
632e8b
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
632e8b
            and many others.
632e8b
Maintained by: Many creative people <dev@texi2html.cvshome.org>
632e8b
Send bugs and suggestions to <users@texi2html.cvshome.org>
632e8b
632e8b
-->
632e8b
<head>
632e8b
<title>CentOS Artwork Repository: 2.70 The trunk/Scripts/Bash/Cli/Functions/Shell Directory</title>
632e8b
632e8b
<meta name="description" content="CentOS Artwork Repository: 2.70 The trunk/Scripts/Bash/Cli/Functions/Shell Directory">
632e8b
<meta name="keywords" content="CentOS Artwork Repository: 2.70 The trunk/Scripts/Bash/Cli/Functions/Shell Directory">
632e8b
<meta name="resource-type" content="document">
632e8b
<meta name="distribution" content="global">
632e8b
<meta name="Generator" content="texi2html 1.76">
632e8b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
632e8b
<style type="text/css">
632e8b
632e8b
@import "/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/common.css";
632e8b
632e8b
a.summary-letter {text-decoration: none}
632e8b
pre.display {font-family: serif}
632e8b
pre.format {font-family: serif}
632e8b
pre.menu-comment {font-family: serif}
632e8b
pre.menu-preformatted {font-family: serif}
632e8b
pre.smalldisplay {font-family: serif; font-size: smaller}
632e8b
pre.smallexample {font-size: smaller}
632e8b
pre.smallformat {font-family: serif; font-size: smaller}
632e8b
pre.smalllisp {font-size: smaller}
632e8b
span.sansserif {font-family:sans-serif; font-weight:normal;}
632e8b
ul.toc {list-style: none}
632e8b
-->
632e8b
</style>
632e8b
632e8b
632e8b
</head>
632e8b
632e8b
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
632e8b
632e8b
ff7772
[ < ]
ff7772
[ > ]
632e8b
   
632e8b
[ << ]
632e8b
[ Up ]
ff7772
[ >> ]
632e8b
   
632e8b
   
632e8b
   
632e8b
   
632e8b
[Top]
632e8b
[Contents]
ff7772
[Index]
632e8b
[ ? ]
632e8b
632e8b
ff7772
632e8b

2.70 The <tt>`trunk/Scripts/Bash/Cli/Functions/Shell'</tt> Directory

632e8b
632e8b
ff7772
632e8b

2.70.1 Goals

632e8b
632e8b

This section exists to organize files related to shell

632e8b
functionality of <tt>`centos-art.sh'</tt> script.
632e8b

632e8b
ff7772
632e8b

2.70.2 Description

632e8b
632e8b

The shell functionality of <tt>`centos-art.sh'</tt> script helps

632e8b
you to maintain bash scripts inside repository. For example, suppose
632e8b
you've created many functionalities for <tt>`centos-art.sh'</tt> script,
632e8b
and you want to use a common copyright and license note for
632e8b
consistency in all your script files. If you have a bunch of files,
632e8b
doing this one by one wouldn't be a big deal. In contrast, if the
632e8b
amount of files grows, updating the copyright and license note for all
632e8b
of them would be a task rather tedious. The shell functionality
632e8b
exists to solve maintainance tasks just as the one previously
632e8b
mentioned.
632e8b

632e8b

When you use shell functionality to update copyright inside

632e8b
script files, it is required that your script files contain (at least)
632e8b
the following top commentary structure:
632e8b

632e8b
632e8b
 1| #!/bin/bash
632e8b
 2| #
632e8b
 3| # doSomething.sh -- The function description goes here.
632e8b
 4| # 
632e8b
 5| # Copyright
632e8b
 6| #
632e8b
 7| # ...
632e8b
 8| #
632e8b
 9| # ----------------------------------------------------------------------
632e8b
10| # $Id$
632e8b
11| # ----------------------------------------------------------------------
632e8b
12|
632e8b
13| function doSomething {
632e8b
14|     
632e8b
15| }
632e8b
632e8b

Figure 2.4: The functions script base comment structure

632e8b
632e8b

632e8b

Relevant lines in the above structure are lines from 5 to 9.

632e8b
Everything else in the file is left immutable.
632e8b

632e8b

When you are updating copyright through shell

632e8b
functionality,  the <tt>`centos-art.sh'</tt> script replaces everything
632e8b
in-between line 5 --the first one matching <samp>`^# Copyright .+$'</samp>
632e8b
string-- and line 9--the first long dash separator matching <samp>`^#
632e8b
-+$'</samp>-- with the content of copyright template instance.
632e8b

632e8b
Caution

Caution

Be sure to add the long dash separator that matches

632e8b
<samp>`^# -+$'</samp> regular expression before the function
632e8b
definition. Otherwise, if the <samp>`Copyright'</samp> line is present but no
632e8b
long dash separator exists, <tt>`centos-art.sh'</tt> will remove anything
632e8b
in-between the <samp>`Copyright'</samp> line and the end of file. This way you
632e8b
may lost your function definitions entirely.
632e8b

632e8b
632e8b

The copyright template instance is created from one copyright template

632e8b
stored in the <tt>`Config/tpl_forCopyright.sed'</tt> file.  The template
632e8b
instance is created once, and later removed when no longer needed. At
632e8b
this moment, when template instance is created, the
632e8b
<tt>`centos-art.sh'</tt> script takes advantage of automation in order to
632e8b
set copyright full name and date dynamically.
632e8b

632e8b

When you use shell functionality to update copyright, the first

632e8b
thing <tt>`shell'</tt> functionality does is requesting copyright
632e8b
information to user, and later, if values were left empty (i.e., no
632e8b
value was typed before pressing RET key), the <tt>`shell'</tt>
632e8b
functionality uses its own default values.
632e8b

632e8b

When shell functionality uses its own default values, the final

632e8b
copyright note looks like the following:
632e8b

632e8b
632e8b
 1| #!/bin/bash
632e8b
 2| #
632e8b
 3| # doSomthing.sh -- The function description goes here.
632e8b
 4| #
632e8b
 5| # Copyright (C) 2003, 2010 The CentOS Project
632e8b
 6| # 
632e8b
 7| # This program is free software; you can redistribute it and/or modify
632e8b
 8| # it under the terms of the GNU General Public License as published by
632e8b
 9| # the Free Software Foundation; either version 2 of the License, or
632e8b
10| # (at your option) any later version.
632e8b
11| # 
632e8b
12| # This program is distributed in the hope that it will be useful, but
632e8b
13| # WITHOUT ANY WARRANTY; without even the implied warranty of
632e8b
14| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
632e8b
15| # General Public License for more details.
632e8b
16| #
632e8b
17| # You should have received a copy of the GNU General Public License
632e8b
18| # along with this program; if not, write to the Free Software
632e8b
19| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
632e8b
20| # USA.
632e8b
21| #
632e8b
22| # ----------------------------------------------------------------------
632e8b
23| # $Id$
632e8b
24| # ----------------------------------------------------------------------
632e8b
25|
632e8b
26| function doSomething {
632e8b
27|
632e8b
28| }
632e8b
632e8b

Figure 2.5: The function script comment example

632e8b
632e8b

632e8b

Relevant lines in the above structure are lines from 5 to 22. Pay

632e8b
attention how the copyright line was built, and how the license was
632e8b
added into the top comment where previously was just three dots.
632e8b
Everything else in the file was left immutable. 
632e8b

632e8b

To change copyright information (i.e., full name or year information),

632e8b
run the shell functionality over the root directory containing
632e8b
the script files you want to update copyright in and enter the
632e8b
appropriate information when it be requested. You can run the
632e8b
shell functionality as many times as you need to.
632e8b

632e8b

To change copyright license (i.e., the text in-between lines 7 and

632e8b
20), you need to edit the <tt>`Config/tpl_forCopyright.sed'</tt> file, set
632e8b
the appropriate information, and run the shell functionality
632e8b
once again for changes to take effect over the files you specify.
632e8b

632e8b
Important

Important

The <tt>`centos-art.sh'</tt> script is released as:

632e8b

632e8b
GNU GENERAL PUBLIC LICENSE
632e8b
Version 2, June 1991
632e8b
632e8b
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
632e8b
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
632e8b
632e8b

Do not change the license information under which <tt>`centos-art.sh'</tt>

632e8b
script is released. Instead, if you think a different license must be
632e8b
used, please share your reasons at CentOS Developers mailing list.
632e8b

632e8b
632e8b
ff7772
632e8b

2.70.3 Usage

632e8b
632e8b
632e8b
centos-art sh --update-copyright='path/to/dir'
632e8b
centos-art sh --update-copyright='path/to/dir' --filter='regex'
632e8b

Use these commands to update copyright information in <samp>`.sh'</samp> files

632e8b
under <samp>`path/to/dir'</samp> directory. 
632e8b

632e8b
632e8b
632e8b

When you provide <samp>`--filter='regex''</samp> argument, the list of files

632e8b
to process is reduced as specified in <samp>`regex'</samp> regular expression.
632e8b
Inside <tt>`centos-art.sh'</tt> script, the <samp>`regex'</samp> regular
632e8b
expression is used in combination with find command to look
632e8b
for files matching the regular expression path pattern.
632e8b

632e8b
Warning

Warning

In order for <samp>`regex'</samp> regular expression to match

632e8b
a file, the <samp>`regex'</samp> regular expresion must match the whole file
632e8b
path not just the file name. 
632e8b

632e8b
632e8b

For example, if you want to match all <tt>`render.conf.sh'</tt> files

632e8b
inside <tt>`path/to/dir'</tt>, use the .+/render.conf regular
632e8b
expression.  Later, <tt>`centos-art.sh'</tt> script uses this value inside
632e8b
^$REGEX\.sh$ expression in order to build the final regular
632e8b
expression (i.e., ^.+/render.conf\.sh$) that is evaluated
632e8b
against available file paths inside the list of files to process.
632e8b

632e8b

Exceptionally, when you provide <samp>`--filter='regex''</samp> in the way

632e8b
that <samp>`regex'</samp>, appended to <samp>`path/to/dir/'</samp> (i.e.
632e8b
<samp>`path/to/dir/regex'</samp>), matches a regular file; the
632e8b
<tt>`centos-art.sh'</tt> script uses the file matching as only file in the
632e8b
list of files to process. 
632e8b

632e8b
ff7772
632e8b

2.70.4 See also

632e8b
632e8b
ff7772
2.60 The <tt>`trunk/Scripts/Bash'</tt> Directory  
632e8b
632e8b
632e8b
632e8b
632e8b
ff7772
[ < ]
ff7772
[ > ]
632e8b
   
632e8b
[ << ]
ff7772
[ Up ]
ff7772
[ >> ]
632e8b
632e8b

632e8b
 <font size="-1">
ff7772
  This document was generated on March, 6 2011 using texi2html 1.76.
632e8b
 </font>
632e8b
 
632e8b
632e8b

632e8b
</body>
632e8b
</html>