Blame Identity/Manual/repository-html/repository_2.70.html

728c6d
728c6d
<html>
728c6d
728c6d
organization, and administration of CentOS Artwork Repository.
728c6d
728c6d
Copyright C 2009-2011 Alain Reguera Delgado
728c6d
728c6d
Permission is granted to copy, distribute and/or modify this document
728c6d
under the terms of the GNU Free Documentation License, Version 1.2 or
728c6d
any later version published by the Free Software Foundation; with no
728c6d
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
728c6d
copy of the license is included in the section entitled GNU Free
728c6d
Documentation License.  
728c6d
-->
728c6d
728c6d
728c6d
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
728c6d
            Karl Berry  <karl@freefriends.org>
728c6d
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
728c6d
            and many others.
728c6d
Maintained by: Many creative people <dev@texi2html.cvshome.org>
728c6d
Send bugs and suggestions to <users@texi2html.cvshome.org>
728c6d
728c6d
-->
728c6d
<head>
728c6d
<title>CentOS Artwork Repository: 2.70 The trunk/Scripts/Functions/Shell Directory</title>
728c6d
728c6d
<meta name="description" content="CentOS Artwork Repository: 2.70 The trunk/Scripts/Functions/Shell Directory">
728c6d
<meta name="keywords" content="CentOS Artwork Repository: 2.70 The trunk/Scripts/Functions/Shell Directory">
728c6d
<meta name="resource-type" content="document">
728c6d
<meta name="distribution" content="global">
728c6d
<meta name="Generator" content="texi2html 1.76">
728c6d
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
728c6d
<style type="text/css">
728c6d
728c6d
/* CSS
728c6d
 *
728c6d
 * repository.css -- This file provides visual style for repository
728c6d
 * documentation manual in HTML format, as output by Texi2html
728c6d
 * program.
728c6d
 *
728c6d
 * Copyright (C) 2009-2011 Alain Reguera Delgado
728c6d
 *
728c6d
 * This program is free software; you can redistribute it and/or
728c6d
 * modify it under the terms of the GNU General Public License as
728c6d
 * published by the Free Software Foundation; either version 2 of the
728c6d
 * License, or (at your option) any later version.
728c6d
 * 
728c6d
 * This program is distributed in the hope that it will be useful, but
728c6d
 * WITHOUT ANY WARRANTY; without even the implied warranty of
728c6d
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
728c6d
 * General Public License for more details.
728c6d
 *
728c6d
 * You should have received a copy of the GNU General Public License
728c6d
 * along with this program; if not, write to the Free Software
728c6d
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
728c6d
 * USA.
728c6d
 * ----------------------------------------------------------------------
728c6d
 * $Id$
728c6d
 * ----------------------------------------------------------------------
728c6d
 */
728c6d
728c6d
@import url("/home/centos/artwork/trunk/Identity/Webenv/Css/base.css");
728c6d
@import url("/home/centos/artwork/trunk/Identity/Webenv/Css/base-app.css");
728c6d
728c6d
a.summary-letter {text-decoration: none}
728c6d
pre.display {font-family: serif}
728c6d
pre.format {font-family: serif}
728c6d
pre.menu-comment {font-family: serif}
728c6d
pre.menu-preformatted {font-family: serif}
728c6d
pre.smalldisplay {font-family: serif; font-size: smaller}
728c6d
pre.smallexample {font-size: smaller}
728c6d
pre.smallformat {font-family: serif; font-size: smaller}
728c6d
pre.smalllisp {font-size: smaller}
728c6d
span.sansserif {font-family:sans-serif; font-weight:normal;}
728c6d
ul.toc {list-style: none}
728c6d
-->
728c6d
</style>
728c6d
728c6d
728c6d
</head>
728c6d
728c6d
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
728c6d
728c6d
728c6d
[ < ]
728c6d
[ > ]
728c6d
   
728c6d
[Contents]
728c6d
[Index]
728c6d
[ ? ]
728c6d
728c6d
728c6d
728c6d

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

728c6d
    728c6d
    2.70.1 Goals 
    728c6d
    2.70.2 Description 
    728c6d
    2.70.3 Usage 
    728c6d
    2.70.4 See also 
    728c6d
    728c6d
    728c6d
    728c6d
    728c6d

    2.70.1 Goals

    728c6d
    728c6d

    This section exists to organize files related to shell

    728c6d
    functionality of <tt>`centos-art.sh'</tt> script.
    728c6d

    728c6d
    728c6d
    728c6d

    2.70.2 Description

    728c6d
    728c6d

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

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

    728c6d

    When you use shell functionality to update copyright inside

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

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

    Figure 2.4: The functions script base comment structure

    728c6d
    728c6d

    728c6d

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

    728c6d
    Everything else in the file is left immutable.
    728c6d

    728c6d

    When you are updating copyright through shell

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

    728c6d
    Caution

    Caution

    Be sure to add the long dash separator that matches

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

    728c6d
    728c6d

    The copyright template instance is created from one copyright template

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

    728c6d

    When you use shell functionality to update copyright, the first

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

    728c6d

    When shell functionality uses its own default values, the final

    728c6d
    copyright note looks like the following:
    728c6d

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

    Figure 2.5: The function script comment example

    728c6d
    728c6d

    728c6d

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

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

    728c6d

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

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

    728c6d

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

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

    728c6d
    Important

    Important

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

    728c6d

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

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

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

    728c6d
    728c6d
    728c6d
    728c6d

    2.70.3 Usage

    728c6d
    728c6d
    728c6d
    centos-art sh --update-copyright='path/to/dir'
    728c6d
    centos-art sh --update-copyright='path/to/dir' --filter='regex'
    728c6d

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

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

    728c6d
    728c6d
    728c6d

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

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

    728c6d
    Warning

    Warning

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

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

    728c6d
    728c6d

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

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

    728c6d

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

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

    728c6d
    728c6d
    728c6d

    2.70.4 See also

    728c6d
    728c6d
    728c6d
    728c6d
    728c6d
    [Contents]
    728c6d
    [Index]
    728c6d
    [ ? ]
    728c6d
    728c6d

    728c6d
     <font size="-1">
    728c6d
      This document was generated on March, 30 2011 using texi2html 1.76.
    728c6d
     </font>
    728c6d
     
    728c6d
    728c6d

    728c6d
    </body>
    728c6d
    </html>