|
|
db14a4 |
|
|
|
db14a4 |
<html>
|
|
|
db14a4 |
|
|
|
db14a4 |
|
|
|
db14a4 |
Permission is granted to copy, distribute and/or modify this document
|
|
|
db14a4 |
under the terms of the GNU Free Documentation License, Version 1.2 or
|
|
|
db14a4 |
any later version published by the Free Software Foundation; with no
|
|
|
db14a4 |
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
|
|
|
db14a4 |
copy of the license is included in the section entitled GNU Free
|
|
|
db14a4 |
Documentation License.
|
|
|
db14a4 |
-->
|
|
|
406f69 |
|
|
|
db14a4 |
|
|
|
db14a4 |
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
|
|
|
db14a4 |
Karl Berry <karl@freefriends.org>
|
|
|
db14a4 |
Olaf Bachmann <obachman@mathematik.uni-kl.de>
|
|
|
db14a4 |
and many others.
|
|
|
db14a4 |
Maintained by: Many creative people <dev@texi2html.cvshome.org>
|
|
|
db14a4 |
Send bugs and suggestions to <users@texi2html.cvshome.org>
|
|
|
db14a4 |
|
|
|
db14a4 |
-->
|
|
|
db14a4 |
<head>
|
|
|
063806 |
<title>CentOS Artwork Repository: 2.60 The trunk/Scripts/Bash/Cli/Functions/Shell Directory</title>
|
|
|
db14a4 |
|
|
|
063806 |
<meta name="description" content="CentOS Artwork Repository: 2.60 The trunk/Scripts/Bash/Cli/Functions/Shell Directory">
|
|
|
063806 |
<meta name="keywords" content="CentOS Artwork Repository: 2.60 The trunk/Scripts/Bash/Cli/Functions/Shell Directory">
|
|
|
db14a4 |
<meta name="resource-type" content="document">
|
|
|
db14a4 |
<meta name="distribution" content="global">
|
|
|
db14a4 |
<meta name="Generator" content="texi2html 1.76">
|
|
|
db14a4 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
db14a4 |
<style type="text/css">
|
|
|
db14a4 |
|
|
|
db14a4 |
@import "/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/common.css";
|
|
|
db14a4 |
|
|
|
db14a4 |
a.summary-letter {text-decoration: none}
|
|
|
db14a4 |
pre.display {font-family: serif}
|
|
|
db14a4 |
pre.format {font-family: serif}
|
|
|
db14a4 |
pre.menu-comment {font-family: serif}
|
|
|
db14a4 |
pre.menu-preformatted {font-family: serif}
|
|
|
db14a4 |
pre.smalldisplay {font-family: serif; font-size: smaller}
|
|
|
db14a4 |
pre.smallexample {font-size: smaller}
|
|
|
db14a4 |
pre.smallformat {font-family: serif; font-size: smaller}
|
|
|
db14a4 |
pre.smalllisp {font-size: smaller}
|
|
|
db14a4 |
span.sansserif {font-family:sans-serif; font-weight:normal;}
|
|
|
db14a4 |
ul.toc {list-style: none}
|
|
|
db14a4 |
-->
|
|
|
db14a4 |
</style>
|
|
|
db14a4 |
|
|
|
db14a4 |
|
|
|
db14a4 |
</head>
|
|
|
db14a4 |
|
|
|
db14a4 |
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
|
|
db14a4 |
|
|
|
db14a4 |
|
|
|
063806 |
[ < ]
|
|
|
063806 |
[ > ]
|
|
|
db14a4 |
|
|
|
063806 |
[ << ]
|
|
|
063806 |
[ Up ]
|
|
|
063806 |
[ >> ]
|
|
|
db14a4 |
|
|
|
db14a4 |
|
|
|
db14a4 |
|
|
|
db14a4 |
|
|
|
56a476 |
[Top]
|
|
|
56a476 |
[Contents]
|
|
|
063806 |
[Index]
|
|
|
56a476 |
[ ? ]
|
|
|
db14a4 |
|
|
|
063806 |
|
|
|
063806 |
|
|
|
063806 |
2.60 The <tt>`trunk/Scripts/Bash/Cli/Functions/Shell'</tt> Directory
|
|
|
aaf678 |
|
|
|
982d5c |
|
|
|
063806 |
|
|
|
063806 |
2.60.1 Goals
|
|
|
b130a0 |
|
|
|
063806 |
This section exists to organize files related to shell
|
|
|
063806 |
functionality of <tt>`centos-art.sh'</tt> script.
|
|
|
b9dbd3 |
|
|
|
b9dbd3 |
|
|
|
063806 |
|
|
|
063806 |
2.60.2 Description
|
|
|
b130a0 |
|
|
|
063806 |
The shell functionality of <tt>`centos-art.sh'</tt> script helps
|
|
|
063806 |
you to maintain bash scripts inside repository. For example, suppose
|
|
|
063806 |
you've created many functionalities for <tt>`centos-art.sh'</tt> script,
|
|
|
063806 |
and you want to use a common copyright and license note for
|
|
|
063806 |
consistency in all your script files. If you have a bunch of files,
|
|
|
063806 |
doing this one by one wouldn't be a big deal. In contrast, if the
|
|
|
063806 |
amount of files grows, updating the copyright and license note for all
|
|
|
063806 |
of them would be a task rather tedious. The shell functionality
|
|
|
063806 |
exists to solve maintainance tasks just as the one previously
|
|
|
063806 |
mentioned.
|
|
|
063806 |
|
|
|
063806 |
When you use shell functionality to update copyright inside
|
|
|
063806 |
script files, it is required that your script files contain (at least)
|
|
|
063806 |
the following top commentary structure:
|
|
|
063806 |
|
|
|
063806 |
|
|
|
063806 |
1| #!/bin/bash
|
|
|
063806 |
2| #
|
|
|
063806 |
3| # doSomething.sh -- The function description goes here.
|
|
|
063806 |
4| #
|
|
|
063806 |
5| # Copyright
|
|
|
063806 |
6| #
|
|
|
063806 |
7| # ...
|
|
|
063806 |
8| #
|
|
|
063806 |
9| # ----------------------------------------------------------------------
|
|
|
063806 |
10| # $Id$
|
|
|
063806 |
11| # ----------------------------------------------------------------------
|
|
|
063806 |
12|
|
|
|
063806 |
13| function doSomething {
|
|
|
063806 |
14|
|
|
|
063806 |
15| }
|
|
|
063806 |
|
|
|
063806 |
Figure 2.4: The functions script base comment structure
|
|
|
063806 |
|
|
|
063806 |
|
|
|
063806 |
Relevant lines in the above structure are lines from 5 to 9.
|
|
|
063806 |
Everything else in the file is left immutable.
|
|
|
063806 |
|
|
|
063806 |
When you are updating copyright through shell
|
|
|
063806 |
functionality, the <tt>`centos-art.sh'</tt> script replaces everything
|
|
|
063806 |
in-between line 5 --the first one matching <samp>`^# Copyright .+$'</samp>
|
|
|
063806 |
string-- and line 9--the first long dash separator matching <samp>`^#
|
|
|
063806 |
-+$'</samp>-- with the content of copyright template instance.
|
|
|
063806 |
|
|
|
063806 |
Caution Be sure to add the long dash separator that matches
|
|
|
063806 |
<samp>`^# -+$'</samp> regular expression before the function
|
|
|
063806 |
definition. Otherwise, if the <samp>`Copyright'</samp> line is present but no
|
|
|
063806 |
long dash separator exists, <tt>`centos-art.sh'</tt> will remove anything
|
|
|
063806 |
in-between the <samp>`Copyright'</samp> line and the end of file. This way you
|
|
|
063806 |
may lost your function definitions entirely.
|
|
|
b9dbd3 |
|
|
|
010b2d |
|
|
|
063806 |
The copyright template instance is created from one copyright template
|
|
|
063806 |
stored in the <tt>`Config/tpl_forCopyright.sed'</tt> file. The template
|
|
|
063806 |
instance is created once, and later removed when no longer needed. At
|
|
|
063806 |
this moment, when template instance is created, the
|
|
|
063806 |
<tt>`centos-art.sh'</tt> script takes advantage of automation in order to
|
|
|
063806 |
set copyright full name and date dynamically.
|
|
|
063806 |
|
|
|
063806 |
When you use shell functionality to update copyright, the first
|
|
|
063806 |
thing <tt>`shell'</tt> functionality does is requesting copyright
|
|
|
063806 |
information to user, and later, if values were left empty (i.e., no
|
|
|
063806 |
value was typed before pressing RET key), the <tt>`shell'</tt>
|
|
|
063806 |
functionality uses its own default values.
|
|
|
063806 |
|
|
|
063806 |
When shell functionality uses its own default values, the final
|
|
|
063806 |
copyright note looks like the following:
|
|
|
063806 |
|
|
|
063806 |
|
|
|
063806 |
1| #!/bin/bash
|
|
|
063806 |
2| #
|
|
|
063806 |
3| # doSomthing.sh -- The function description goes here.
|
|
|
063806 |
4| #
|
|
|
063806 |
5| # Copyright (C) 2003, 2010 The CentOS Project
|
|
|
063806 |
6| #
|
|
|
063806 |
7| # This program is free software; you can redistribute it and/or modify
|
|
|
063806 |
8| # it under the terms of the GNU General Public License as published by
|
|
|
063806 |
9| # the Free Software Foundation; either version 2 of the License, or
|
|
|
063806 |
10| # (at your option) any later version.
|
|
|
063806 |
11| #
|
|
|
063806 |
12| # This program is distributed in the hope that it will be useful, but
|
|
|
063806 |
13| # WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
063806 |
14| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
063806 |
15| # General Public License for more details.
|
|
|
063806 |
16| #
|
|
|
063806 |
17| # You should have received a copy of the GNU General Public License
|
|
|
063806 |
18| # along with this program; if not, write to the Free Software
|
|
|
063806 |
19| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
063806 |
20| # USA.
|
|
|
063806 |
21| #
|
|
|
063806 |
22| # ----------------------------------------------------------------------
|
|
|
063806 |
23| # $Id$
|
|
|
063806 |
24| # ----------------------------------------------------------------------
|
|
|
063806 |
25|
|
|
|
063806 |
26| function doSomething {
|
|
|
063806 |
27|
|
|
|
063806 |
28| }
|
|
|
063806 |
|
|
|
063806 |
Figure 2.5: The function script comment example
|
|
|
063806 |
|
|
|
063806 |
|
|
|
063806 |
Relevant lines in the above structure are lines from 5 to 22. Pay
|
|
|
063806 |
attention how the copyright line was built, and how the license was
|
|
|
063806 |
added into the top comment where previously was just three dots.
|
|
|
063806 |
Everything else in the file was left immutable.
|
|
|
063806 |
|
|
|
063806 |
To change copyright information (i.e., full name or year information),
|
|
|
063806 |
run the shell functionality over the root directory containing
|
|
|
063806 |
the script files you want to update copyright in and enter the
|
|
|
063806 |
appropriate information when it be requested. You can run the
|
|
|
063806 |
shell functionality as many times as you need to.
|
|
|
063806 |
|
|
|
063806 |
To change copyright license (i.e., the text in-between lines 7 and
|
|
|
063806 |
20), you need to edit the <tt>`Config/tpl_forCopyright.sed'</tt> file, set
|
|
|
063806 |
the appropriate information, and run the shell functionality
|
|
|
063806 |
once again for changes to take effect over the files you specify.
|
|
|
063806 |
|
|
|
063806 |
Important The <tt>`centos-art.sh'</tt> script is released as:
|
|
|
063806 |
|
|
|
063806 |
GNU GENERAL PUBLIC LICENSE
|
|
|
063806 |
Version 2, June 1991
|
|
|
db14a4 |
|
|
|
063806 |
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
|
|
063806 |
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
063806 |
|
|
|
063806 |
Do not change the license information under which <tt>`centos-art.sh'</tt>
|
|
|
063806 |
script is released. Instead, if you think a different license must be
|
|
|
063806 |
used, please share your reasons at CentOS Developers mailing list.
|
|
|
063806 |
|
|
|
b130a0 |
|
|
|
b9dbd3 |
|
|
|
063806 |
|
|
|
063806 |
2.60.3 Usage
|
|
|
b9dbd3 |
|
|
|
b9dbd3 |
|
|
|
063806 |
centos-art sh --update-copyright='path/to/dir'
|
|
|
063806 |
centos-art sh --update-copyright='path/to/dir' --filter='regex'
|
|
|
063806 |
Use these commands to update copyright information in <samp>`.sh'</samp> files
|
|
|
063806 |
under <samp>`path/to/dir'</samp> directory.
|
|
|
063806 |
|
|
|
b9dbd3 |
|
|
|
b130a0 |
|
|
|
063806 |
When you provide <samp>`--filter='regex''</samp> argument, the list of files
|
|
|
063806 |
to process is reduced as specified in <samp>`regex'</samp> regular expression.
|
|
|
063806 |
Inside <tt>`centos-art.sh'</tt> script, the <samp>`regex'</samp> regular
|
|
|
063806 |
expression is used in combination with find command to look
|
|
|
063806 |
for files matching the regular expression path pattern.
|
|
|
063806 |
|
|
|
063806 |
Warning In order for <samp>`regex'</samp> regular expression to match
|
|
|
063806 |
a file, the <samp>`regex'</samp> regular expresion must match the whole file
|
|
|
063806 |
path not just the file name.
|
|
|
063806 |
|
|
|
b130a0 |
|
|
|
063806 |
For example, if you want to match all <tt>`render.conf.sh'</tt> files
|
|
|
063806 |
inside <tt>`path/to/dir'</tt>, use the .+/render.conf regular
|
|
|
063806 |
expression. Later, <tt>`centos-art.sh'</tt> script uses this value inside
|
|
|
063806 |
^$REGEX\.sh$ expression in order to build the final regular
|
|
|
063806 |
expression (i.e., ^.+/render.conf\.sh$ ) that is evaluated
|
|
|
063806 |
against available file paths inside the list of files to process.
|
|
|
063806 |
|
|
|
063806 |
Exceptionally, when you provide <samp>`--filter='regex''</samp> in the way
|
|
|
063806 |
that <samp>`regex'</samp>, appended to <samp>`path/to/dir/'</samp> (i.e.
|
|
|
063806 |
<samp>`path/to/dir/regex'</samp>), matches a regular file; the
|
|
|
063806 |
<tt>`centos-art.sh'</tt> script uses the file matching as only file in the
|
|
|
063806 |
list of files to process.
|
|
|
b9dbd3 |
|
|
|
b9dbd3 |
|
|
|
063806 |
|
|
|
063806 |
2.60.4 See also
|
|
|
5cb5a7 |
|
|
|
b9dbd3 |
|
|
|
063806 |
2.50 The <tt>`trunk/Scripts/Bash'</tt> Directory
|
|
|
b9dbd3 |
|
|
|
b9dbd3 |
|
|
|
5cb5a7 |
|
|
|
5cb5a7 |
|
|
|
db14a4 |
|
|
|
063806 |
[ < ]
|
|
|
063806 |
[ > ]
|
|
|
db14a4 |
|
|
|
063806 |
[ << ]
|
|
|
063806 |
[ Up ]
|
|
|
063806 |
[ >> ]
|
|
|
db14a4 |
|
|
|
db14a4 |
|
|
|
db14a4 |
<font size="-1">
|
|
|
406f69 |
This document was generated on March, 1 2011 using texi2html 1.76.
|
|
|
db14a4 |
</font>
|
|
|
db14a4 |
|
|
|
db14a4 |
|
|
|
db14a4 |
|
|
|
db14a4 |
</body>
|
|
|
db14a4 |
</html>
|