Blame Identity/Manual/repository-html/repository_77.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
-->
52772c
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>
ed9de5
<title>CentOS Artwork Repository: 2.70 The trunk/Scripts/Functions/Shell Directory</title>
632e8b
ed9de5
<meta name="description" content="CentOS Artwork Repository: 2.70 The trunk/Scripts/Functions/Shell Directory">
ed9de5
<meta name="keywords" content="CentOS Artwork Repository: 2.70 The trunk/Scripts/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
ed9de5
[ < ]
ed9de5
[ > ]
632e8b
   
1075b9
[ << ]
1075b9
[ Up ]
ed9de5
[ >> ]
632e8b
   
632e8b
   
632e8b
   
632e8b
   
1075b9
[Top]
1075b9
[Contents]
ed9de5
[Index]
1075b9
[ ? ]
632e8b
ed9de5
ed9de5
ed9de5

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

632e8b
52772c
ed9de5
52772c

2.70.1 Goals

52772c
ed9de5

This section exists to organize files related to shell

ed9de5
functionality of <tt>`centos-art.sh'</tt> script.
06d106

52772c
ed9de5
52772c

2.70.2 Description

52772c
ed9de5

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

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

ed9de5

When you use shell functionality to update copyright inside

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

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

Figure 2.4: The functions script base comment structure

ed9de5
ed9de5

ed9de5

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

ed9de5
Everything else in the file is left immutable.
ed9de5

ed9de5

When you are updating copyright through shell

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

ed9de5
Caution

Caution

Be sure to add the long dash separator that matches

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

52772c
ed9de5

The copyright template instance is created from one copyright template

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

ed9de5

When you use shell functionality to update copyright, the first

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

ed9de5

When shell functionality uses its own default values, the final

ed9de5
copyright note looks like the following:
ed9de5

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

Figure 2.5: The function script comment example

ed9de5
06d106

ed9de5

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

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

ed9de5

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

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

ed9de5

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

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

ed9de5
Important

Important

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

52772c

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

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

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

9bfd15
9bfd15
ed9de5
ed9de5

2.70.3 Usage

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

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

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

ed9de5
632e8b
ed9de5

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

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

ed9de5
Warning

Warning

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

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

632e8b
ed9de5

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

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

ed9de5

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

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

632e8b
ed9de5
52772c

2.70.4 See also

632e8b
9bfd15
ed9de5
2.60 The <tt>`trunk/Scripts'</tt> Directory  
9bfd15
9bfd15
632e8b
632e8b
632e8b
ed9de5
[ < ]
ed9de5
[ > ]
632e8b
   
1075b9
[ << ]
ed9de5
[ Up ]
ed9de5
[ >> ]
632e8b
632e8b

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

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