Blame Manuals/en/Html/Repository/repository_50.html

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

3.47 trunk/Scripts/Bash/Functions/Shell

4c79b5
4c79b5
008ee0
fe989b

3.47.1 Goals

4c79b5
008ee0

This section exists to organize files related to shell

008ee0
functionality of <tt>`centos-art.sh'</tt> script.
008ee0

eae802
008ee0
55c2ff

3.47.2 Description

eae802
008ee0

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

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

008ee0

When you use shell functionality to update copyright inside

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

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

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

008ee0
Everything else in the file is left immutable.
008ee0

008ee0

When you are updating copyright through shell

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

008ee0
Caution

Caution

Be sure to add the long dash separator that matches

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

008ee0
008ee0

The copyright template instance is created from one copyright template

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

008ee0

When you use shell functionality to update copyright, the first

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

008ee0

When shell functionality uses its own default values, the final

008ee0
copyright note looks like the following:
008ee0

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

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

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

008ee0

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

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

008ee0

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

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

008ee0
Important

Important

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

008ee0

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

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

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

eae802
eae802
008ee0
2c8180

3.47.3 Usage

6aec21
008ee0
008ee0
centos-art sh --update-copyright='path/to/dir'
008ee0
centos-art sh --update-copyright='path/to/dir' --filter='regex'
008ee0

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

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

008ee0
6aec21
008ee0

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

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

008ee0
Warning

Warning

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

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

6aec21
008ee0

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

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

008ee0

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

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

008ee0
008ee0
4c79b5

3.47.4 See also

4c79b5
008ee0
008ee0
3.39 trunk/Scripts/Bash  
008ee0
008ee0
3.40 trunk/Scripts/Bash/Functions  
008ee0
008ee0
4c79b5
4c79b5
4c79b5
008ee0
[ < ]
008ee0
[ > ]
4c79b5
   
4c79b5
[ << ]
008ee0
[ Up ]
008ee0
[ >> ]
4c79b5
4c79b5

4c79b5
 <font size="-1">
008ee0
  This document was generated on December, 2 2010 using texi2html 1.76.
4c79b5
 </font>
4c79b5
 
4c79b5
4c79b5

4c79b5
</body>
4c79b5
</html>