Blame Manuals/en/Html/Repository/repository_47.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
-->
49b888
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>
c6292c
<title>CentOS Artwork Repository: 3.44 trunk/Scripts/Bash/Functions/Shell</title>
4c79b5
c6292c
<meta name="description" content="CentOS Artwork Repository: 3.44 trunk/Scripts/Bash/Functions/Shell">
c6292c
<meta name="keywords" content="CentOS Artwork Repository: 3.44 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
c6292c
[ < ]
c6292c
[ > ]
4c79b5
   
4c79b5
[ << ]
4c79b5
[ Up ]
c6292c
[ >> ]
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
[Top]
4c79b5
[Contents]
c6292c
[Index]
4c79b5
[ ? ]
4c79b5
c6292c
c6292c
c6292c

3.44 trunk/Scripts/Bash/Functions/Shell

008ee0
ef356a
c6292c
54b5a5

3.44.1 Goals

54b5a5
c6292c

This section exists to organize files related to shell

c6292c
functionality of <tt>`centos-art.sh'</tt> script.
63f275

008ee0
c6292c
54b5a5

3.44.2 Description

54b5a5
c6292c

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

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

c6292c

When you use shell functionality to update copyright inside

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

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

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

c6292c
Everything else in the file is left immutable.
3d6160

c6292c

When you are updating copyright through shell

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

c6292c
Caution

Caution

Be sure to add the long dash separator that matches

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

49b888
c6292c

The copyright template instance is created from one copyright template

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

c6292c

When you use shell functionality to update copyright, the first

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

c6292c

When shell functionality uses its own default values, the final

c6292c
copyright note looks like the following:
60c152

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

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

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

c6292c

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

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

c6292c

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

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

c6292c
Important

Important

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

e37211

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

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

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

3d6160
e37211
035049
008ee0

3.44.3 Usage

008ee0
63f275
c6292c
centos-art sh --update-copyright='path/to/dir'
c6292c
centos-art sh --update-copyright='path/to/dir' --filter='regex'
c6292c

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

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

49b888
49b888
c6292c

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

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

c6292c
Warning

Warning

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

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

c6292c
c6292c

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

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

c6292c

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

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

63f275
035049
4c79b5

3.44.4 See also

4c79b5
2c8180
63f275
3.36 trunk/Scripts/Bash  
63f275
63f275
3.37 trunk/Scripts/Bash/Functions  
2c8180
2c8180
4c79b5
4c79b5
4c79b5
035049
[ < ]
035049
[ > ]
4c79b5
   
4c79b5
[ << ]
c6292c
[ Up ]
c6292c
[ >> ]
4c79b5
4c79b5

4c79b5
 <font size="-1">
49b888
  This document was generated on December, 5 2010 using texi2html 1.76.
4c79b5
 </font>
4c79b5
 
4c79b5
4c79b5

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