Blame Manual/repository-html/repository_80.html

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

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

06d106
06d106
52772c
52772c

2.73.1 Goals

06d106
52772c

This section exists to organize files related to shell

52772c
functionality of <tt>`centos-art.sh'</tt> script.
52772c

06d106
52772c
52772c

2.73.2 Description

06d106
52772c

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

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

52772c

When you use shell functionality to update copyright inside

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

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

Figure 2.4: The functions script base comment structure

52772c
52772c

52772c

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

52772c
Everything else in the file is left immutable.
52772c

52772c

When you are updating copyright through shell

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

52772c
Caution

Caution

Be sure to add the long dash separator that matches

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

06d106
52772c

The copyright template instance is created from one copyright template

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

52772c

When you use shell functionality to update copyright, the first

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

52772c

When shell functionality uses its own default values, the final

52772c
copyright note looks like the following:
52772c

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

Figure 2.5: The function script comment example

52772c
52772c

52772c

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

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

52772c

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

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

52772c

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

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

52772c
Important

Important

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

52772c

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

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

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

06d106
06d106
52772c
52772c

2.73.3 Usage

06d106
52772c
52772c
centos-art sh --update-copyright='path/to/dir'
52772c
centos-art sh --update-copyright='path/to/dir' --filter='regex'
52772c

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

52772c
under <samp>`path/to/dir'</samp> directory. 
52772c

52772c
06d106
52772c

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

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

52772c
Warning

Warning

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

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

06d106
52772c

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

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

52772c

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

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

06d106
52772c
52772c

2.73.4 See also

06d106
52772c
1075b9
2.62 The <tt>`trunk/Scripts/Bash'</tt> Directory  
52772c
52772c
9bfd15
9bfd15
9bfd15
52772c
[ < ]
1075b9
[ > ]
9bfd15
   
1075b9
[ << ]
52772c
[ Up ]
1075b9
[ >> ]
9bfd15
9bfd15

9bfd15
 <font size="-1">
52772c
  This document was generated on March, 22 2011 using texi2html 1.76.
9bfd15
 </font>
9bfd15
 
9bfd15
9bfd15

9bfd15
</body>
9bfd15
</html>