From fe83c0302a504807e572136c266301c343b893ae Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Feb 24 2011 18:13:36 +0000 Subject: Update trunk/Scripts directory structure. --- diff --git a/Scripts/Bash/centos-art/Functions/About/Config/authors.txt b/Scripts/Bash/centos-art/Functions/About/Config/authors.txt new file mode 100644 index 0000000..7d73104 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/About/Config/authors.txt @@ -0,0 +1,4 @@ +Alain Reguera Delgado +Ralph Angenendt +Karanbirn Singh +Marcus Moeller diff --git a/Scripts/Bash/centos-art/Functions/About/Config/copying.txt b/Scripts/Bash/centos-art/Functions/About/Config/copying.txt new file mode 100644 index 0000000..58298c2 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/About/Config/copying.txt @@ -0,0 +1,18 @@ +centos-art.sh -- The CentOS Artowrk Repository automation tool. + +Copyright (C) 2009-2011 Alain Reguera Delgado + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA. diff --git a/Scripts/Bash/centos-art/Functions/About/Config/history.txt b/Scripts/Bash/centos-art/Functions/About/Config/history.txt new file mode 100644 index 0000000..1b98ad5 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/About/Config/history.txt @@ -0,0 +1,136 @@ +$Id$ +This file records noteworthy changes of CentOS Artwork Repository. + + Copyright (C) 2009-2011 Alain Reguera Delgado + + Copying and distribution of this file, with or without modification, are + permitted in any medium without royalty provided the copyright notice and + this notice are preserved. + +------------------------------------------------------------------------------- +(2011) + + - Unify common arguments for all specific functionalities (e.g, --answer, + --quiet, --filter, etc.) and leave just specific arguments for specific + functions to parse. There is no need to duplicate common arguments + definitions inside every specific functionality. + + - The `.sed' translation files are no longer used, scalable vector + graphics are used instead. Translation messages take place by means of + xml2po and gettext. With xml2po translatable strings are retrived from + `.svg' files and stored inside gettext `.pot' and `.po' files for + translators to edit. Finally, xml2po is used again to build the temporal + design model translated instance which the final `.png' image is built + from. + + - The `trunk/Translation' directory structure is removed. The + `trunk/Locales' directory structure is used instead to store locale + information. + +------------------------------------------------------------------------------- +(2010) + + - Inside centos-art.sh script, functionalities start to get + identified and separated one from another. For example, when + images are rendered, there is no need to load manual + functionality. There are now common functionalities and specific + functionalities. Common functionalities are loaded when the + script is initiated and are available to specific + functionalities. + + - The directory structure is optimized to implements the corporate + identity concepts and the centos-art.sh script. The CentOS + Artwork Repository directory structure places the organizational + convenctions that centos-art.sh script needs to do what we + expect from it to do. + + - The following functionalities start to take form as part of + centos-art.sh script: + + `trunk/Scripts/Bash/Functions/Render/render.sh' + + To produce translated images using Inkscape and Sed + replacement commands. + + `trunk/Scripts/Bash/Functions/Manual/manual.sh' + + To produce documentation using Texinfo. Almost all + LaTeX-based documents were moved to Texinfo format and + handled by manual functionality. + + `trunk/Scripts/Bash/Functions/Locale/locale.sh' + + To translate centos-art.sh command-line interface messages + using gettext. + + `trunk/Scripts/Functions/Shell/shell.sh' + + To perform massive actions inside shell scripts. For + example, update top-commentaries massively. + + `trunk/Scripts/Functions/Svg/svg.sh' + + To perform massive actions inside SVG files. + + `trunk/Scripts/Functions/Html/html.sh' + + To perform massive actions inside HTML files. + + `trunk/Scripts/Functions/Path/path.sh' + + To automate manipulation of files, branches, and tags. + + `trunk/Scripts/Functions/About/about.sh' + + To print license, authors, history, copying, etc. + +------------------------------------------------------------------------------- +(2009) + + - The rendering script starts to evolve into centos-art.sh script, a + command-line interface to manipulate the CentOS Artwork Repository. + + - Corporate identity concepts taken from Wikipedia and related books are + introduced as development reference. The main goal of centos-art.sh + turns to: automate production of a monolithic corporate visual identity + structure based on CentOS Mission and CentOS Release Schema. + + - Alain Reguera Delgado is out of Internet for an undefined amount of + time, but continues developing CentOS Artwork Repository and its + automation tool (i.e., the centos-art.sh script) off-line. + + - Documentation begins to take form in LaTeX format. + +------------------------------------------------------------------------------- +(2008) + + - The CentOS Artwork Repository started at CentOS Developers + mailing list. + + - Alain Reguera Delgado shares ideas in a thread about Anaconda + progress slide images and the possibility of automating their + construction. + + - Ralph Angenendt rises up his hand asking: Do you have something + to show? + + - Alain Reguera Delgado posts a Bash script to produce slide + images in different languages ---together with the proposition + of creating a Subversion centralized repository where + translations and image production could be distributed inside + CentOS Community---. + + - Karanbirn Sighn considers the idea intresting and provides the + infrastructure to support the effort as the CentOS Artwork SIG. + + https://projects.centos.org/svn/artwork/ + https://projects.centos.org/trac/artwork/ + + - Alain Reguera Delagdo uploads the rendering script to CentOS + Artwork Repository. + + - Ralph Angenendt documents the rendering script. + + - With the rendering script and its documentation available, + translators start to download working copies of CentOS Artwork + Repository to produce slide images in their own languages. diff --git a/Scripts/Bash/centos-art/Functions/About/Config/license.txt b/Scripts/Bash/centos-art/Functions/About/Config/license.txt new file mode 100644 index 0000000..5b6e7c6 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/About/Config/license.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Scripts/Bash/centos-art/Functions/About/about.sh b/Scripts/Bash/centos-art/Functions/About/about.sh new file mode 100755 index 0000000..77ea1d2 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/About/about.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# license.sh -- This function outputs centos-art.sh about messages. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function about { + + # Define command-line interface. + about_getActions + +} diff --git a/Scripts/Bash/centos-art/Functions/About/about_getActions.sh b/Scripts/Bash/centos-art/Functions/About/about_getActions.sh new file mode 100755 index 0000000..15d714b --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/About/about_getActions.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# +# about_getActions.sh -- This function interpretes arguments passed to +# about functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function about_getActions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="license,history,authors,copying" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + case "$1" in + + --license ) + ACTIONVAL="${FUNCCONFIG}/license.txt" + break + ;; + + --history ) + ACTIONVAL="${FUNCCONFIG}/history.txt" + break + ;; + + --authors ) + ACTIONVAL="${FUNCCONFIG}/authors.txt" + break + ;; + + --copying | * ) + ACTIONVAL="${FUNCCONFIG}/copying.txt" + break + ;; + + esac + done + + # Execute action name. + if [[ -f $ACTIONVAL ]];then + less $ACTIONVAL + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Brand/brandAnaconda.sh b/Scripts/Bash/centos-art/Functions/Brand/brandAnaconda.sh new file mode 100644 index 0000000..8b215eb --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Brand/brandAnaconda.sh @@ -0,0 +1,107 @@ +#!/bin/bash +# +# brandAnaconda - Anaconda branding script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function brandAnaconda { + + # Define file's source and target. + local ARTDIR=~/artwork/trunk/Identity/Themes/$(cli_getPathComponent '--theme')/Distro/Anaconda + local PIXMAP=/usr/share/anaconda/pixmaps + local SOURCE='' + local TARGET='' + + # Define list of files used as base to determine which files may + # need to be updated. Remove target from file path. Do not use + # basename command. We may need the directory structure (if any) + # under target, for further evaluation. + local FILES=$(find ${PIXMAP}/ | sort | uniq | sed "s!${PIXMAP}/!!g") + local FILE='' + + for FILE in $FILES;do + + # Define which file is release-specific, and specify the correct + # path on source. + case $FILE in + anaconda_header.png ) + SOURCE=$ARTDIR/Header/Img/$MAJOR_RELEASE/$FILE + TARGET=$PIXMAP/$FILE + ;; + + progress_first*.png | first*.png ) + SOURCE=$ARTDIR/Progress/Img/$MAJOR_RELEASE/$FILE + TARGET=$PIXMAP/$FILE + ;; + + rnotes | rnotes/?? | rnotes/??_?? ) + continue + ;; + + rnotes/??-*.png ) + FILE=$(basename $FILE | sed -r 's!-centos[0-9]+!!') + SOURCE=$ARTDIR/Progress/Img/$MAJOR_RELEASE/en/$FILE + TARGET=$PIXMAP/rnotes/$FILE + ;; + + rnotes/*/??-*.png ) + LANGUAGE=$(echo $FILE | sed -r 's!rnotes/(.+)/.*!\1!') + FILE=$(basename $FILE | sed -r 's!-centos[0-9]+!!') + SOURCE=$ARTDIR/Progress/Img/$MAJOR_RELEASE/$LANGUAGE/$FILE + TARGET=$PIXMAP/rnotes/$LANGUAGE/$FILE + ;; + + splash.png ) + SOURCE=$ARTDIR/Splash/Img/$MAJOR_RELEASE/$FILE + TARGET=$PIXMAP/$FILE + ;; + + syslinux-splash.png ) + TARGET=$PIXMAP/$FILE + FILE=$(echo $FILE | sed -r 's!\.png$!-16c.png!') + SOURCE=$ARTDIR/Prompt/Img/$MAJOR_RELEASE/$FILE + ;; + + * ) + TARGET=$PIXMAP/$FILE + SOURCE=$ARTDIR/$FILE + esac + + # Check if file exists on source. If file doesn't exist on the + # source it is not updated on target. Go to next file in the + # loop and check again. Only file names on source that match + # those in target are updated. + cli_checkFiles "$SOURCE" + + # File exists and will be installed on target. + cli_printMessage "$TARGET" "AsUpdatingLine" + + # Update file. + #cp $SOURCE $TARGET + + # Set file's access rights. + #chown root:root $TARGET + #chmod 755 $TARGET + #chcon system_u:object_r:usr_t $TARGET + +done +} diff --git a/Scripts/Bash/centos-art/Functions/Brand/brandFirstboot.sh b/Scripts/Bash/centos-art/Functions/Brand/brandFirstboot.sh new file mode 100755 index 0000000..cb785d7 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Brand/brandFirstboot.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# +# brandFirstboot - Firstboot branding script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function brandFirstboot { + + # Define file's source and target. + local ARTDIR=~/artwork/trunk/Identity/Themes/$(cli_getPathComponent '--theme')/Distro/Anaconda + local PIXMAP=/usr/share/firstboot/pixmaps + local SOURCE='' + local TARGET='' + + # Define list of files used as base to determine which files may + # need to be updated. Remove target from file path. Do not use + # basename command. We may need the directory structure (if any) + # under target, for further evaluation. + local FILES=$(find ${PIXMAP}/ | sort | uniq | sed "s!${PIXMAP}/!!g") + local FILE='' + + for FILE in $FILES;do + + # Define which file is release-specific, and specify the correct + # path on source. + case $FILE in + + splash-small.png ) + SOURCE=$ARTDIR/Firstboot/Img/$MAJOR_RELEASE/$FILE + TARGET=$PIXMAP/$FILE + ;; + + firstboot-left.png ) + SOURCE=$ARTDIR/Firstboot/Img/$FILE + TARGET=$PIXMAP/$FILE + ;; + + * ) + SOURCE=$ARTDIR/Firstboot/Img/$FILE + TARGET=$PIXMAP/$FILE + esac + + # Check if file exists on source. If file doesn't exist on the + # source it is not updated on target. Go to next file in the + # loop and check again. Only file names on source that match + # those in target are updated. + cli_checkFiles "$SOURCE" + + # File exists and will be installed on target. + cli_printMessage "$TARGET" "AsUpdatingLine" + + # Update file. + #cp $SOURCE $TARGET + + # Set file's access rights. + #chown root:root $TARGET + #chmod 755 $TARGET + #chcon system_u:object_r:usr_t $TARGET + + done +} diff --git a/Scripts/Bash/centos-art/Functions/Html/Config/output_forHeadingsToc.awk b/Scripts/Bash/centos-art/Functions/Html/Config/output_forHeadingsToc.awk new file mode 100644 index 0000000..bcc0f21 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Html/Config/output_forHeadingsToc.awk @@ -0,0 +1,79 @@ +#!/usr/bin/gawk +# +# output_forHadingsToc.awk -- This file provides the output format +# required by html_updateHeadings.sh function, inside centos-art.sh +# script. +# +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +BEGIN {FS=":"} + +{ + if ($1 == 0 && $2 == $3) { + opentags = "
  • " + closetags = "" + } + + if ($1 > 0 && $2 > $3) { + opentags = "
    • " + closetags = "" + } + + if ($1 > 0 && $2 == $3) { + opentags = "
    • " + closetags = "" + } + + if ($1 > 0 && $2 < $3) { + opentags = "" + for (i = 1; i <= ($3 - $2); i++) { + opentags = opentags "
    " + closetags = "" + } + opentags = opentags "
  • " + } + + printf "%s%s%s\n",opentags,$4,closetags + +} + +END { + + if ($1 > 0 && $2 >= $3 && $3 > 1) { + for (i = 1; i <= $3; i++) { + print "
" + } + } + + if ($1 > 0 && $2 >= $3 && $3 == 1) { + print "" + print "" + } + + if ($1 > 0 && $2 < $3) { + for (i = 1; i <= $2; i++) { + print "" + } + } + + print "" +} diff --git a/Scripts/Bash/centos-art/Functions/Html/html.sh b/Scripts/Bash/centos-art/Functions/Html/html.sh new file mode 100755 index 0000000..8b4cf95 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Html/html.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# html.sh -- This function provides very basic HTML manipulations to +# help maintain html files inside the repository. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function html { + + # Define command-line interface. + html_getActions + +} diff --git a/Scripts/Bash/centos-art/Functions/Html/html_getActions.sh b/Scripts/Bash/centos-art/Functions/Html/html_getActions.sh new file mode 100755 index 0000000..dc29888 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Html/html_getActions.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# +# html_getActions.sh -- This function interprets arguments passed to +# `html' functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function html_getActions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="update-headings:" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Define action to take for each option passed. + while true; do + case "$1" in + + --update-headings ) + + # Define action value passed through the command-line. + ACTIONVAL="$2" + + # Define action name using action value as reference. + ACTIONNAM="${FUNCNAM}_updateHeadings" + + # Rotate positional parameters. + shift 2 + ;; + + * ) + break + esac + done + + # Check action value. Be sure the action value matches the + # convenctions defined for source locations inside the working + # copy. + cli_checkRepoDirSource + + # Syncronize changes between the working copy and the central + # repository to bring down changes. + cli_commitRepoChanges + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Syncronize changes between the working copy and the central + # repository to commit up changes. + cli_commitRepoChanges + +} diff --git a/Scripts/Bash/centos-art/Functions/Html/html_updateHeadings.sh b/Scripts/Bash/centos-art/Functions/Html/html_updateHeadings.sh new file mode 100644 index 0000000..9b1dc3a --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Html/html_updateHeadings.sh @@ -0,0 +1,169 @@ +#!/bin/bash +# +# html_updateHeadings.sh -- This function transforms html headings to +# to make them accessible (e.g., through a table of contents). +# +# - In order for this function to work, you need to put headings in +# just one line and they must have the following formats: +# +#

Title

+#

Title

+#

Title

+# +# In the above examples, h1 alternates from h1 to h6. Closing tag +# must be present and match the one opentaging. The value of and options are the md5sum of page +# location, plus the 'head-' string, plus the heading string. If +# heading title or page location changes, the values of and options will change too. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function html_updateHeadings { + + # Define variables as local to avoid conflicts outside. + local COUNT=0 + local FILE='' + local FILES='' + local PREVCOUNT=0 + local PATTERN='' + local -a FINAL + local -a TITLE + local -a MD5SM + local -a OPTNS + local -a LEVEL + local -a PARENT + local -a TOCENTRIES + local -a LINK + + # Define html heading regular expression pattern. Use parenthisis + # to save html action name, action value, and heading title. + PATTERN="(]>)(.*[^<])" + + # Define list of files to process. + FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}.*\.(xhtml|html|htm)") + + # Set action preamble. + cli_printActionPreamble "${FILES}" + + # Process list of files. + for FILE in $FILES;do + + # Verify list of html files. Are files really html files? If + # they don't, continue with the next one in the list. + if [[ ! $(file --brief $FILE) =~ '^(XHTML|HTML|XML)' ]];then + continue + fi + + # Output action message. + cli_printMessage $FILE 'AsUpdatingLine' + + # Define list of headings to process. When building the + # heading, it is required to change spaces characters from its + # current decimal output to something different (e.g., its + # \040 octal alternative). This is required because the space + # character is used as egrep default field separator and + # spaces can be present inside heading strings we don't want + # to separate. + for HEADING in $(egrep "$PATTERN" $FILE \ + | sed -r -e 's!^[[:space:]]+!!' -e "s! !\\\040!g");do + + # Define previous counter value using current counter + # value as reference. + if [[ $COUNT -ne 0 ]];then + PREVCOUNT=$(($COUNT-1)) + fi + + # Define initial heading information. + FIRST[$COUNT]=$(echo $HEADING | sed -r "s!\\\040! !g") + TITLE[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\3!") + MD5SM[$COUNT]=$(echo "${FILE}${FIRST[$COUNT]}" | md5sum | sed -r 's![[:space:]]+-$!!') + OPTNS[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\2!") + LEVEL[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\1!") + PARENT[$COUNT]=${LEVEL[$PREVCOUNT]} + + # Transform heading information using initial heading + # information as reference. + if [[ ${OPTNS[$COUNT]} =~ '^$' ]];then + OPTNS[$COUNT]='' + elif [[ ${OPTNS[$COUNT]} =~ '^$' ]];then + OPTNS[$COUNT]='' + elif [[ ${OPTNS[$COUNT]} =~ '^$' ]];then + OPTNS[$COUNT]='' + fi + + # Build final html heading structure. + FINAL[$COUNT]=''${OPTNS[$COUNT]}${TITLE[$COUNT]}'' + + # Build html heading link structure. These links are used + # by the table of contents later. + LINK[$COUNT]=''${TITLE[$COUNT]}'' + + # Build table of contents entry with numerical + # identifications. The numerical identification is what we + # use to determine the correct position of each heading + # link on the table of content. + TOCENTRIES[$COUNT]="$COUNT:${LEVEL[$COUNT]}:${PARENT[$COUNT]}:${LINK[$COUNT]}" + + # Update heading information inside the current file being + # processed. Use the first and final heading information. + sed -i -r "s!${FIRST[$COUNT]}!${FINAL[$COUNT]}!" $FILE + + # Increase heading counter. + COUNT=$(($COUNT + 1)) + + done + + # Build the table of contents using heading numerical + # identifications as reference. The numerical identification + # describes the order of headings in one html file. This + # information is processed by awk to make the appropriate + # replacements. Finnally, the result is stored in the TOC + # variable. + TOC=$(echo '
' + echo "

`gettext "Table of contents"`

" + for TOCENTRY in "${TOCENTRIES[@]}";do + echo $TOCENTRY + done \ + | awk -f /home/centos/artwork/trunk/Scripts/Bash/Functions/Html/Config/output_forHeadingsToc.awk) + + # Update table of contents inside the current file being + # processed. + sed -i -r '/
(.*)<\/div>/c'"$(echo -e $TOC)" $FILE + + # Reset counters. + COUNT=0 + PREVCOUNT=0 + + # Clean up variables to receive the next file. + unset FINAL + unset TITLE + unset MD5SM + unset OPTNS + unset LEVEL + unset PARENT + unset TOCENTRIES + unset LINK + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Brands/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Brands/render.conf.sh new file mode 100755 index 0000000..d9bb979 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Brands/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines brands pre-rendition +# configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]='LAST:renderBrands' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Fonts/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Fonts/render.conf.sh new file mode 100755 index 0000000..8f03a3a --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Fonts/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines fonts pre-rendition +# configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]='POST:renderFormats: jpg pdf' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Models/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Models/render.conf.sh new file mode 100755 index 0000000..5c40a17 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Models/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines models pre-rendition +# configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]='POST:renderFormats: pdf jpg' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Backgrounds/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Backgrounds/render.conf.sh new file mode 100755 index 0000000..0f659be --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Backgrounds/render.conf.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines themes backgrounds +# pre-rendition configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]='POST:renderFormats: jpg' + ACTIONS[1]='POST:groupByType: png jpg' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Concept/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Concept/render.conf.sh new file mode 100755 index 0000000..632c8f9 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Concept/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines theme info +# pre-rendition configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]='POST:renderFormats: jpg pdf' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Anaconda/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Anaconda/render.conf.sh new file mode 100755 index 0000000..417c8b1 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Anaconda/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines Anaconda pre-rendition +# configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + #ACTIONS[0]='' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Firstboot/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Firstboot/render.conf.sh new file mode 100755 index 0000000..b5fe32a --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Firstboot/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines firstboot +# pre-rendition configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + #ACTIONS[0]='' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Gdm/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Gdm/render.conf.sh new file mode 100755 index 0000000..6d7d094 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Gdm/render.conf.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines GNOME display manager +# (GDM) pre-rendition configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]="LAST:renderDm:Gdm:800x600 1024x768 1280x1024 1360x768 \ + 1680x1050 2048x1536 2560x960 2560x1240 3271x1227" + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Grub/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Grub/render.conf.sh new file mode 100755 index 0000000..59e1a10 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Grub/render.conf.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines GRUB pre-rendition +# configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]='POST:renderGrub:' + ACTIONS[1]='POST:renderGrub:-floyd' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Gsplash/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Gsplash/render.conf.sh new file mode 100755 index 0000000..ed9d313 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Gsplash/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines GSplash pre-rendition +# configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + #ACTIONS[0]='' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Kdm/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Kdm/render.conf.sh new file mode 100755 index 0000000..d241e51 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Kdm/render.conf.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines KDE display manager +# (KDM) pre-rendition configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]="LAST:renderDm:Kdm:800x600 1024x768 1280x1024 1360x768 \ + 1680x1050 2048x1536 2560x960 2560x1240 3271x1227" + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Ksplash/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Ksplash/render.conf.sh new file mode 100755 index 0000000..a0aa21a --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Ksplash/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines KSplash pre-rendition +# configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]='LAST:renderKSplash' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Rhgb/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Rhgb/render.conf.sh new file mode 100755 index 0000000..60a4a49 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Rhgb/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines graphical boot (RHGB) +# pre-rendition configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + #ACTIONS[0]='' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Syslinux/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Syslinux/render.conf.sh new file mode 100755 index 0000000..f91cc69 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Distro/Syslinux/render.conf.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines Syslinux pre-rendition +# configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]='POST:renderSyslinux:' + ACTIONS[1]='POST:renderSyslinux:-floyd' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Promo/Releases/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Promo/Releases/render.conf.sh new file mode 100755 index 0000000..f4b6862 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Promo/Releases/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines release promotion +# pre-rendition configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + #ACTIONS[0]='' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Media/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Media/render.conf.sh new file mode 100755 index 0000000..ef6ec48 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Media/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines installation media +# promotion pre-rendition configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + #ACTIONS[0]='' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Posters/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Posters/render.conf.sh new file mode 100755 index 0000000..c63754b --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Posters/render.conf.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines posters promotion +# pre-rendition configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + # Deifne theme model. + #THEMEMODEL='Default' + + # Define rendition actions. + ACTIONS[0]='POST:renderFormats: pdf jpg' + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Widgets/render.conf.sh b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Widgets/render.conf.sh new file mode 100755 index 0000000..4f52452 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/Config/Identity/Widgets/render.conf.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# identity_loadConfig.sh -- This function defines widgets pre-rendition +# configuration script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_loadConfig { + + return + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity.sh b/Scripts/Bash/centos-art/Functions/Identity/identity.sh new file mode 100644 index 0000000..e66e31c --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# render.sh -- This function provides rendition features to +# centos-art.sh script. Here we initialize rendition variables and +# call identity_getActions functions. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity { + + # Define default value to target flag. The target flag (--to) + # controls final destination used by copy related actions. + local FLAG_TO='' + + # Define release number flag. The relesase number flag (--release) + # specifies the release number identity images are rendered for. + # By default no release number is used. + local FLAG_RELEASE='' + + # Define architecture flag. The architecture flag (--architecture) + # specifies the architecture type identity images are rendered + # for. By default no architecture type is used. + local FLAG_ARCHITECTURE='' + + # Define rendition actions. + identity_getActions + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_checkAbsolutePaths.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_checkAbsolutePaths.sh new file mode 100755 index 0000000..1e942e5 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_checkAbsolutePaths.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# identity_checkAbsolutePaths.sh -- This function retrives absolute +# files and checks their existence. In order for design templates to +# point different artistic motifs, design templates make use of +# external files that point to specific artistic motif background +# images. If such external files doesn't exist, print a message and +# stop script execution. We cannot continue without background +# information. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_checkAbsolutePaths { + + local FILE='' + local ABSPATHS='' + + # Define absolute path of file we need to retrive absolute paths + # from. + FILE="$1" + + # Verify existence of file we need to retrive absolute paths from. + cli_checkFiles $FILE 'f' + + # Retrive absolute paths from file. + ABSPATHS=$(egrep '="/[a-zA-Z0-9_./-]+" ' $FILE \ + | sed -r "s/ /\n/g" | egrep '(sodipodi:absref|xlink:href)=' \ + | sed -r "s/.+=\"(\/.+)\".*/\1/" | sort | uniq) + + # Verify absolute paths retrived from file. + for FILE in $ABSPATHS;do + cli_checkFiles $FILE + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_copy.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_copy.sh new file mode 100755 index 0000000..b87d8bf --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_copy.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# identity_copy.sh -- This function duplicates rendition stuff. +# Rendition stuff is formed by design models, design images and +# pre-rendition configuration scripts (which includes translations +# files). This way, when we say to duplicate rendition stuff we are +# saying to duplicate these four directory structures (i.e., design +# models, design images, pre-rendition configuration scripts, and +# related translations files). +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_copy { + + # Verify target directory. + cli_checkRepoDirTarget + + # Determine what directory structure we are duplicating. + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_getActions.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_getActions.sh new file mode 100644 index 0000000..ba02548 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_getActions.sh @@ -0,0 +1,148 @@ +#!/bin/bash +# +# identity_getActions.sh -- This function interprets arguments passed to +# render functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_getActions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="render:,release:,architecture:,copy:,to:" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + + case "$1" in + + --render ) + + # Redefine action name. + ACTIONNAM="${FUNCNAM}_render" + + # Redefine action value. + ACTIONVAL="$2" + + # Rotate positional parameters + shift 2 + ;; + + --copy ) + + # Redefine action value variable. + ACTIONVAL="$2" + + # Redefine action name variable. + ACTIONNAM="${FUNCNAME}_doCopy" + + # Rotate positional parameters + shift 2 + ;; + + --release ) + + # Redefine release number flag. + FLAG_RELEASE="$2" + + # Verify release number flag. + if [[ ! $FLAG_RELEASE =~ $(cli_getPathComponent '--release-pattern') ]];then + cli_printMessage "`gettext "The release number provided is not supported."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Rotate positional parameters + shift 2 + ;; + + --architecture ) + + # Redefine architecture flag. + FLAG_ARCHITECTURE="$2" + + # Verify architecture flag. + if [[ ! $FLAG_ARCHITECTURE =~ $(cli_getPathComponent '--architecture-pattern') ]];then + cli_printMessage "`gettext "The architecture provided is not supported."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Rotate positional parameters + shift 2 + ;; + + --to ) + + # Redefine target value flag. + FLAG_TO="$2" + + # Rotate positional parameters + shift 2 + ;; + + * ) + # Break options loop. + break + esac + done + + # Check action value. Be sure the action value matches the + # convenctions defined for source locations inside the working + # copy. + cli_checkRepoDirSource + + # Define pre-rendition configuration directory. Pre-rendition + # configuration directory is where we store render.conf.sh + # scripts. The render.conf.sh script defines how each identity + # content is rendered. + local ARTCONF=$(echo "$ACTIONVAL" \ + | sed -r -e 's!/(Identity)!/Scripts/Bash/Functions/Identity/Config/\1!' \ + -e "s!Motifs/$(cli_getPathComponent '--theme')/?!!") + + # Check directory of pre-rendition configuration script. + cli_checkFiles "$ARTCONF" 'd' + + # Syncronize changes between the working copy and the central + # repository to bring down changes. + cli_commitRepoChanges + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Syncronize changes between the working copy and the central + # repository to commit up changes. + cli_commitRepoChanges + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_getConfig.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_getConfig.sh new file mode 100755 index 0000000..fe459a6 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_getConfig.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# identity_getConfig.sh -- This function checks/validates variables +# passed from artwork-specific pre-rendition configuration files. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_getConfig { + + local POSTCOUNT=0 + local LASTCOUNT=0 + + # Re-define action variables in separated array variables. Once + # verification is done, we remove the BASE, POST, LAST parts from + # action definition in order to have the plain name of function to + # call. + for ACTION in "${ACTIONS[@]}"; do + + # Define post-rendition actions. + if [[ $ACTION =~ '^POST:' ]];then + ACTION=$(identity_getConfigOption "$ACTION" '2-') + POSTACTIONS[$POSTCOUNT]="$ACTION" + POSTCOUNT=$(($POSTCOUNT + 1)) + + # Define last-rendition actions. + elif [[ $ACTION =~ '^LAST:' ]];then + ACTION=$(identity_getConfigOption "$ACTION" '2-') + LASTACTIONS[$LASTCOUNT]="$ACTION" + LASTCOUNT=$(($LASTCOUNT + 1)) + fi + + done + + # Sanitate theme model value using repository directory name + # convenction. + THEMEMODEL=$(cli_getRepoName "$THEMEMODEL" 'd') + + # Check theme model directory. + cli_checkFiles "$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}" 'd' + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_getConfigOption.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_getConfigOption.sh new file mode 100755 index 0000000..2c78ef9 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_getConfigOption.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# identity_getConfigOption.sh -- This function standardizes the way +# action values are retrived from pre-rendition configuration files. +# Use this function whenever you need to retrive action values from +# pre-rendition configuration script. +# +# Usage: VAR=$(identity_getConfigOption "ACTION" "FIELD") +# +# VAR is the name of the variable where we store the option named +# returned by identity_getConfigOption. +# +# ACTION is the string definition set in the pre-rendition +# configuration script that holds the action name and its options +# fields. +# +# FIELD is the field number in the action string we want to retrive +# option from. By default options start from third field on. The first +# field is reserved for the action type (i.e., POST or LAST), and the +# second field is reserved for the action itself (e.g., renderFormats, +# renderSyslinux, renderKsplash, etc.). +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_getConfigOption { + + local ACTION="$1" + local FIELD="$2" + local VALUE='' + + # Check action value. The action's value must be present in order + # for this function to work. It provides the string needed to + # retrive options from. + if [[ "$ACTION" == '' ]];then + cli_printMessage "`gettext "There is no action to work with."`" + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Check field value. The field's value must match the cut's + # command specification of its -f option. + if [[ ! "$FIELD" =~ '^([0-9]+|[0-9]+-|-[0-9]+|[0-9]+-[0-9]+)$' ]];then + cli_printMessage "`gettext "The field specified is not valid."`" + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Get option from pre-rendition configuration action definition. + VALUE=$(echo -n "$ACTION" | cut -d: -f${FIELD}) + + # Sanitate action value passed from pre-rendition configuration + # action definition. + VALUE=$(echo -n "${VALUE}" \ + | sed -r 's!^ *!!g' \ + | sed -r 's!( |,|;) *! !g' \ + | sed -r 's! *$!!g') + + # Output action value without trailing newline. + echo -n "$VALUE" + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_getDirOutput.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_getDirOutput.sh new file mode 100644 index 0000000..e28cbd4 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_getDirOutput.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# identity_getDirOutput.sh -- This function defines the final +# absolute path the centos-art.sh script uses to store identity +# contents produced at rendition time. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_getDirOutput { + + # Define base output directory using design model path as + # reference. By default rendered identity content is stored + # immediatly under identity entry structure, but if `Img/' + # directory exists use it instead. + OUTPUT=$(dirname $FILE | sed -r \ + -e "s!/Models/${THEMEMODEL}!/Motifs/$(cli_getPathComponent "$ACTIONVAL" "--theme")!" \ + -e "s!/Tpl!/Img!") + + # Redefine base output directory to introduce specific information + # like release number, architecture, etc. + OUTPUT=${OUTPUT}/${FLAG_RELEASE}/${FLAG_ARCHITECTURE} + + # Define whether to use or not locale-specific directory to store + # content, using current locale information as reference. As + # convenction, when we produce content in English language, we do + # not add a laguage-specific directory to organize content. + # However, when we produce language-specific content in a language + # different from English we do use language-specific directory to + # organize content. + if [[ ! $(cli_getCurrentLocale) =~ '^en' ]];then + OUTPUT=${OUTPUT}/$(cli_getCurrentLocale) + fi + + # Remove two or more consecutive slashes as well as the last + # remaining slash in the path. + OUTPUT=$(echo $OUTPUT | sed -r 's!/{2,}!/!g' | sed -r 's!/$!!') + + # Create final output directory, if it doesn't exist yet. + if [[ ! -d ${OUTPUT} ]];then + mkdir -p ${OUTPUT} + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_getDirTemplate.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_getDirTemplate.sh new file mode 100644 index 0000000..e6c1ef5 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_getDirTemplate.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# identity_getDirTemplate.sh -- This function re-defines absolute +# path to artwork's related design templates directory. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_getDirTemplate { + + # Initialize design models location using action value as + # reference. + TEMPLATE=$ACTIONVAL + + # Sanitate design models location. Be sure design models do + # always point to trunk directory structure. This is useful to let + # `centos-art.sh' script do rendition under branches directory + # structure, reusing design models under trunk directory + # structure. + TEMPLATE=$(echo "$TEMPLATE" | sed "s!/branches/!/trunk/!") + + # Sanitate design models location using or not Tpl/ directory. + if [[ -d $TEMPLATE/Tpl ]];then + # Using Tpl/ directory is an obsolete practice that should be + # avoided. The concept of Tpl/ directory per artwork directory + # has been replaced by a common design model directory + # structure where we centralize design models for all + # different artistic motifs. However, there are some cases + # that we may need to use Tpl/ directory still, so we verify + # its existence and use it if present. + TEMPLATE=$TEMPLATE/Tpl + else + # Redefine design model location based on theme model + # (THEMEMODEL) variable value. The theme model variable is + # defined in the associated pre-rendition configuration script + # and can be used to set which design model to use among a + # list of different design models that we can choose from. + TEMPLATE=$(echo "$TEMPLATE" \ + | sed "s!Motifs/$(cli_getPathComponent "$TEMPLATE" '--theme')!Models/$THEMEMODEL!") + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_render.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_render.sh new file mode 100755 index 0000000..f5eb19f --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_render.sh @@ -0,0 +1,113 @@ +#!/bin/bash +# +# identity_render.sh -- This function initiates rendition +# configuration functions and executes them to perform the rendition +# action specified in the `ACTIONS' array variable. Function +# initialization and execution is based on the absolute path +# convenction defined by ARTCONF variable. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id: identity_render.sh 824 2011-01-06 20:54:52Z al $ +# ---------------------------------------------------------------------- + +function identity_render { + + local FILE='' + + # Initialize artwork identification. + local ARTCOMP='' + + # Define default theme model. + local THEMEMODEL='Default' + + # Build list of files to process. + local FILES=$(cli_getFilesList "$ARTCONF" ".*/?render\.conf\.sh") + + # Set action preamble. + cli_printAction Preamble "$FILES" + + # Process list of files. + for FILE in $FILES;do + + # Output action message. + cli_printMessage $FILE 'AsConfigurationLine' + + # Define artwork-specific action arrays. We need to do this + # here because ACTIONS variable is unset after + # identity_renders execution. Otherwise, undesired + # concatenations may occur. + local -a ACTIONS + local -a POSTACTIONS + local -a LASTACTIONS + + # Initialize artwork-specific pre-rendition configuration + # (function) scripts. + . $FILE + + # Execute artwork-specific pre-rendition configuration + # (function) scripts to re-define artwork-specific ACTIONS. + identity_loadConfig + + # Check variables passed from artwork-specific pre-rendition + # configuration scripts and make required transformations. + identity_getConfig + + # Redefine action value (ACTIONVAL) based on pre-rendition + # configuration script path value. Otherwise, massive + # rendition may fail. Functions like renderImage need to know + # the exact artwork path (that is, where images will be + # stored). + ACTIONVAL=$(dirname $(echo $FILE | sed -r \ + -e 's!Scripts/Bash/Functions/Identity/Config/(Identity)/!\1/!' \ + -e "s!Themes/!Themes/Motifs/$(cli_getPathComponent '--theme')/!")) + + # Redefine artwork identification using redefined action + # value. + ARTCOMP=$(echo $ACTIONVAL | cut -d/ -f6-) + + # Remove motif name from artwork identification in order to + # reuse motif artwork identification. There is not need to + # create one artwork identification for each motif directory + # structure if we can reuse just one. + ARTCOMP=$(echo $ARTCOMP \ + | sed -r "s!Themes/Motifs/$(cli_getPathComponent '--theme')/!Themes/!") + + # Initiate base rendition using pre-rendition configuration + # files. + identity_renderBase + + # Unset artwork-specific actions so they can be redefined by + # artwork-specific pre-rendition configuration scripts. This + # is required in massive rendition. For example, if you say + # centos-art.sh to render the whole Distro directory it first + # renders Prompt entry, which defines the renderSyslinux + # post-rendition action, and later Progress entry which does + # not defines post-rendition actions. If we do not unset the + # ACTIONS variable, post-rendition actions defined in Prompt + # entry remain for Progress entry and that is not desired. We + # want ACTIONS to do what we exactly tell it to do inside each + # artwork-specific pre-rendition configuration script. + unset ACTIONS + unset POSTACTIONS + unset LASTACTIONS + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_renderBase.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_renderBase.sh new file mode 100755 index 0000000..a280c38 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_renderBase.sh @@ -0,0 +1,227 @@ +#!/bin/bash +# +# identity_renderBase.sh -- This function initiates base rendition +# using pre-rendition configuration files. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderBase { + + local FILE='' + local FILES='' + local OUTPUT='' + local EXPORTID='' + local TEMPLATE='' + local COMMONDIR='' + local PARENTDIR='' + local TRANSLATION='' + local EXTERNALFILE='' + local EXTERNALFILES='' + local COMMONDIRCOUNT=0 + local -a COMMONDIRS + + # Redefine parent directory for current workplace. + PARENTDIR=$(basename "${ACTIONVAL}") + + # Define base location of template files. + identity_getDirTemplate + + # Define list of files to process. + FILES=$(cli_getFilesList "${TEMPLATE}" "${FLAG_FILTER}.*\.(svgz|svg)") + + # Set action preamble. + cli_printActionPreamble "$FILES" + + # Define common absolute paths in order to know when centos-art.sh + # is leaving a directory structure and entering into another. This + # information is required in order for centos-art.sh to know when + # to apply last-rendition actions. + for COMMONDIR in $(dirname "$FILES" | sort | uniq);do + COMMONDIRS[$COMMONDIRCOUNT]=$(dirname "$COMMONDIR") + COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1)) + done + + # Reset common directory counter. + COMMONDIRCOUNT=0 + + # Define export id used inside design templates. This value + # defines the design area we want to export. + EXPORTID='CENTOSARTWORK' + + # Start processing the base rendition list of FILES. Fun part + # approching :-). + for FILE in $FILES; do + + # Define final location of translation file. + TRANSLATION=$(dirname $FILE \ + | sed -r 's!/trunk/(Identity/)!/trunk/Locales/\1!')/$(cli_getCurrentLocale).po + + # Print final location of translation file. + if [[ ! -f "$TRANSLATION" ]];then + cli_printMessage "`gettext "None"`" "AsTranslationLine" + else + cli_printMessage "$TRANSLATION" 'AsTranslationLine' + fi + + # Define final location of template file. + TEMPLATE=${FILE} + + # Print final location of template file. + if [[ ! -f "$TEMPLATE" ]];then + cli_printMessage "`gettext "None"`" "AsDesignLine" + else + cli_printMessage "$TEMPLATE" 'AsDesignLine' + fi + + # Define final location of output directory. + identity_getDirOutput + + # Get relative path to file. The path string (stored in FILE) + # has two parts: 1. the variable path and 2. the common path. + # The variable path is before the common point in the path + # string. The common path is after the common point in the + # path string. The common point is the name of the parent + # directory (stored in PARENTDIR). + # + # trunk/Locales/Identity/.../Firstboot/3/splash-small.svg + # -------------------------^| the |^------------^ + # variable path | common | common path + # -------------------------v| point | v------------v + # trunk/Identity/Themes/M.../Firstboot/Img/3/splash-small.png + # + # What we do here is remove the varibale path, the common + # point, and the file extension parts in the string holding + # the path retrived from design models directory structure. + # Then we use the common path as relative path to store the + # the final image file. + # + # The file extension is removed from the common path because + # it is set when we create the final image file. This + # configuration let us use different extensions for the same + # file name. + # + # When we render using renderImage function, the structure of + # files under the output directory will be the same used after + # the common point in the related design model directory + # structure. + FILE=$(echo ${FILE} \ + | sed -r "s!.*${PARENTDIR}/!!" \ + | sed -r "s/\.(svgz|svg)$//") + + # Define absolute path to final file (without extension). + FILE=${OUTPUT}/$(basename "${FILE}") + + # Define instance name from design model. + INSTANCE=$(cli_getTemporalFile ${TEMPLATE}) + + if [[ -f ${TRANSLATION} ]];then + + # Create translated instance from design model. + /usr/bin/xml2po -p ${TRANSLATION} ${TEMPLATE} > ${INSTANCE} + + # Remove .xml2po.mo temporal file. + if [[ -f ${PWD}/.xml2po.mo ]];then + rm ${PWD}/.xml2po.mo + fi + + else + + # Create non-translated instance form design model. + /bin/cat ${TEMPLATE} > ${INSTANCE} + + fi + + # Apply replacement of translation markers to design model + # translated instance. + cli_replaceTMarkers ${INSTANCE} + + # Check export id inside design templates. + grep "id=\"$EXPORTID\"" $INSTANCE > /dev/null + if [[ $? -gt 0 ]];then + cli_printMessage "`eval_gettext "There is no export id (\\\$EXPORTID) inside \\\$TEMPLATE."`" "AsErrorLine" + cli_printMessage '-' 'AsSeparatorLine' + continue + fi + + # Check existence of external files. In order for design + # templates to point different artistic motifs, design + # templates make use of external files that point to specific + # artistic motif background images. If such external files + # doesn't exist, print a message and stop script execution. + # We cannot continue without background information. + identity_checkAbsolutePaths "$INSTANCE" + + # Render template instance and modify the inkscape output to + # reduce the amount of characters used in description column + # at final output. + cli_printMessage "$(inkscape $INSTANCE \ + --export-id=$EXPORTID --export-png=${FILE}.png | sed -r \ + -e "s!Area !`gettext "Area"`: !" \ + -e "s!Background RRGGBBAA:!`gettext "Background"`: RRGGBBAA!" \ + -e "s!Bitmap saved as:!`gettext "Saved as"`:!")" \ + 'AsRegularLine' + + # Remove template instance. + if [[ -a $INSTANCE ]];then + rm $INSTANCE + fi + + # Execute post-rendition actions. + identity_renderPostActions + + # Output separator line. + cli_printMessage '-' 'AsSeparatorLine' + + # Verify position of file being produced in the list of files + # been currently processed. As convenction, last-rendition + # actions are applied after all images inside the same + # directory structure have being produced. Notice that, in + # order to apply last-rendition actions correctly, + # centos-art.sh needs to "predict" what the last file in the + # same directory structure would be. There is no magic here, + # so we need to previously define which are the common + # directory structures centos-art.sh could produce content for + # inside an array variable. Later, using the index of that + # array variable we could check the next item in the array + # against the file being currently produced. If they match, we + # haven't reached the end of the same directory structure, but + # if they don't match, we do have reach the end of the same + # directory structure and it is time for last-rendition + # actions to be evaluated before go producing the next + # directory structure in the list of files to process. + if [[ $(dirname "$TEMPLATE") != ${COMMONDIRS[$(($COMMONDIRCOUNT + 1))]} ]];then + + # At this point centos-art.sh should be producing the last + # file from the same unique directory structure, so, + # before producing images for the next directory structure + # lets execute last-rendition actions for the current + # directory structure. + identity_renderLastActions + + fi + + # Increment common directory counter. + COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1)) + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_renderBrands.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_renderBrands.sh new file mode 100644 index 0000000..16a1049 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_renderBrands.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# +# identity_renderBrands.sh -- This function provides last-rendition +# actions to produce CentOS brands. This function takes both The +# CentOS Symbol and The CentOS Type images and produces variation of +# them in different dimensions and formats using ImageMagick tool-set. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderBrands { + + local SOURCEFILE='' + local TARGETDIR='' + local TARGETFILE='' + local NEWFILE='' + + # Define absolute path to image file. + local FILE="$1" + + # Define height dimensions you want to produce brands for. + local SIZES="16 20 22 24 32 36 40 48 64 96 128 148 164 196 200 512" + + # Define image formats you want to produce brands for. + local FORMATS="png xpm pdf jpg tif" + + # Redefine absolute path to directory where final brand images + # will be stored. Notice how both final image directory and design + # model have the same name, this is intentional in order to keep + # images and design models related and organized inside their own + # directory structures. + local DIRNAME=$(cli_getRepoName "$FILE" 'd')/$(cli_getRepoName "$FILE" 'fd') + + # Check directory where final brand images will be stored. + if [[ ! -d $DIRNAME ]];then + mkdir -p ${DIRNAME} + fi + + for SIZE in ${SIZES};do + + # Redefine name of new file. + NEWFILE=${DIRNAME}/${SIZE} + + for FORMAT in ${FORMATS};do + + # Output action information. + cli_printMessage "${NEWFILE}.${FORMAT}" "AsCreatingLine" + + # Convert and resize to create new file. + convert -resize x${SIZE} ${FILE}.png ${NEWFILE}.${FORMAT} + + done + + # Create logo copy in 2 colors. + cli_printMessage "${NEWFILE}.xbm (`gettext "2 colors grayscale"`)" "AsCreatingLine" + convert -resize x${SIZE} -colorspace gray -colors 2 ${FILE}.png ${NEWFILE}.xbm + + # Create logo copy in emboss effect. + cli_printMessage "${NEWFILE}-emboss.png" "AsCreatingLine" + convert -resize x${SIZE} -emboss 1 ${FILE}.png ${NEWFILE}-emboss.png + + done + + # Output division line. + cli_printMessage '-' 'AsSeparatorLine' +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_renderDm.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_renderDm.sh new file mode 100755 index 0000000..bc7780e --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_renderDm.sh @@ -0,0 +1,191 @@ +#!/bin/bash +# +# identity_renderDm.sh -- This function collects Display Manager (DM) +# required files and creates a tar.gz package that groups them all +# together. Use this function as last-rendition action for Gdm and Kdm +# base-rendition actions. +# +# Usage: +# +# ACTIONS[1]='LAST:renderDm:TYPE:RESOLUTION' +# +# Where: +# +# TYPE can be either `Gdm' or `Kdm'. These values correspond to the +# directory names used to store related design models. +# +# RESOLUTION represents the screen resolution tar.gz files are +# produced for (e.g., 800x600, 1024x768, 2048x1536, etc.). +# +# In order to produce tar.gz files correctly, both screen resolution +# definition inside pre-rendition configuration script and background +# name inside theme directory structure need to match one another. If +# one screen resolution is defined correctly, but there is no +# background information for it, the related tar.gz file is not +# produced and the next file in the list of files to process is +# evaluated. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderDm { + + local -a SRC + local -a DST + local DM='' + local TGZ='' + local COUNT=0 + local RESOLUTION='' + local RESOLUTIONS='' + + # Get display manager passed from render.conf.sh pre-rendition + # configuration script. + DM=$(identity_getConfigOption "${ACTION}" '2') + + # Sanitate display manager passed from render.conf.sh + # pre-rendition configuration script. Whatever value be retrived + # as display manager configuration option is converted to + # uppercase in order to match either Gdm or Kdm design model + # directory structures. + DM=$(cli_getRepoName "$DM" 'd') + + # Get screen resolutions passed from render.conf.sh pre-rendition + # configuration script. + RESOLUTIONS=$(identity_getConfigOption "${ACTION}" '3') + + # Check screen resolutions passed from render.conf.sh + # pre-rendition configuration script. + if [[ "$RESOLUTIONS" == '' ]];then + cli_printMessage "`gettext "There is no resolution information to process."`" 'AsErrorLine' + cli_printMessage $(caller) "AsToKnowMoreLine" + fi + + # Define source files using absolute paths. + SRC[0]=$(cli_getRepoTLDir)/Identity/Brands/Img/Symbol/48.png + SRC[1]=${OUTPUT}/release.png + SRC[2]=${OUTPUT}/screenshot.png + SRC[3]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/GdmGreeterTheme.xml + SRC[4]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/GdmGreeterTheme.desktop + SRC[5]=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Backgrounds/Img/Png + SRC[6]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-language.png + SRC[7]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-reboot.png + SRC[8]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-session.png + SRC[9]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-shutdown.png + + # Define name used as temporal holder to build tar.gz file. + TGZ=$(cli_getPathComponent '--theme-name') + + # Define target files using relative paths. + DST[0]=${TGZ}/centos-symbol.png + DST[1]=${TGZ}/centos-release.png + DST[2]=${TGZ}/screenshot.png + DST[3]=${TGZ}/${TGZ}.xml + DST[4]=${TGZ}/GdmGreeterTheme.desktop + DST[5]=${TGZ}/background.png + DST[6]=${TGZ}/icon-language.png + DST[7]=${TGZ}/icon-reboot.png + DST[8]=${TGZ}/icon-session.png + DST[9]=${TGZ}/icon-shutdown.png + + # Move into the working directory. + pushd ${OUTPUT} > /dev/null + + # Create directory used as temporal holder to build tar.gz file. + if [[ ! -d ${TGZ} ]];then + mkdir ${TGZ} + fi + + for RESOLUTION in $RESOLUTIONS;do + + while [[ $COUNT -lt ${#SRC[*]} ]];do + + if [[ $COUNT -eq 5 ]];then + + # Redefine background information using resolution as + # reference. Avoid concatenation. + SRC[$COUNT]=$(echo "${SRC[$COUNT]}" | cut -d/ -f-13)/${RESOLUTION}-final.png + + # If background information defined inside + # pre-rendition configuration script doesn't match + # background information inside theme-specific + # backgrounds directory structure, try the next + # background definition. + if [[ ! -f ${SRC[$COUNT]} ]];then + continue 2 + fi + + elif [[ $COUNT =~ '^[6-9]$' ]];then + + # If display manager is Kdm, then increment counter and + # resume the next iteration. Icons aren't used on Kdm, + # so there's no need to have them inside it. + if [[ $DM =~ '^Kdm$' ]];then + COUNT=$(($COUNT + 1)) + continue + fi + + fi + + # Check existence of source files. + cli_checkFiles ${SRC[$COUNT]} + + # Copy files from source to target location. + cp ${SRC[$COUNT]} ${DST[$COUNT]} + + # Replace common translation markers from design model + # files with appropriate information. + if [[ $COUNT =~ '^(3|4)$' ]];then + cli_replaceTMarkers "${DST[$COUNT]}" + fi + + # Increment counter. + COUNT=$(($COUNT + 1)) + + done + + # Reset counter. + COUNT=0 + + # Print action message. + cli_printMessage "${OUTPUT}/${RESOLUTION}.tar.gz" "AsCreatingLine" + + # Create tar.gz file. + tar -czf "${RESOLUTION}.tar.gz" $TGZ + + done + + # Remove directory used as temporal holder to build targ.gz + # file. + rm -r $TGZ + + # Remove release-specific images. + cli_printMessage "${SRC[1]}" "AsDeletingLine" + rm ${SRC[1]} + cli_printMessage "${SRC[2]}" "AsDeletingLine" + rm ${SRC[2]} + + # Return to where we were initially. + popd > /dev/null + + # Output division rule. + cli_printMessage '-' 'AsSeparatorLine' + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_renderFormats.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_renderFormats.sh new file mode 100644 index 0000000..7712dc9 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_renderFormats.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# identity_renderFormats.sh -- This function provides post-rendition +# action used to convert images from PNG to different image formats. +# This function uses ImageMagick command line image manipulation tool +# set to convert the base PNG image to as many formats as ImageMagick +# supports. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderFormats { + + # Get image formats. + local FORMATS=$(identity_getConfigOption "$ACTION" '2-') + + # Check base file existence. + if [[ -f ${FILE}.png ]];then + + # Check image formats. + if [[ "$FORMATS" != "" ]];then + + # Loop through image formats and do format convertion using + # PNG file as base. + for FORMAT in $FORMATS;do + cli_printMessage "${FILE}.${FORMAT}" "AsSavedAsLine" + convert -quality 85 ${FILE}.png ${FILE}.${FORMAT} + done + + fi + + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_renderGroupByType.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_renderGroupByType.sh new file mode 100755 index 0000000..0f03e44 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_renderGroupByType.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# identity_renderGroupByTypes.sh -- This function provides +# post-rendition action to group files inside directories named as +# their file extensions. For example: if the current file is a .png +# file, it is moved inside a Png/ directory; if the current file is a +# .jpg file, it is stored inside a Jpg/ directory, and so on. +# +# For this function to work correctly, you need to specify which file +# type you want to group. This is done in the post-rendition ACTIONS +# array inside the appropriate `render.conf.sh' pre-configuration +# script. This function cannot be used as last-rendition action. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderGroupByType { + + local SOURCE='' + local TARGET='' + + # Sanitate file types passed from render.conf.sh pre-rendition + # configuration script. + local FORMATS=$(identity_getConfigOption "$ACTION" '2-') + + for FORMAT in $FORMATS;do + + # Redifine source file we want to move. + SOURCE=${FILE}.${FORMAT} + + # Define target directory where source file will be moved + # into. + TARGET=$(dirname "$FILE")/$(cli_getRepoName "$FORMAT" 'd') + + # Check existence of source file. + cli_checkFiles $SOURCE 'f' + + # Check existence of target directory. + if [[ ! -d $TARGET ]];then + mkdir -p $TARGET + fi + + # Redifine file path to add file and its type. + TARGET=${TARGET}/$(cli_getRepoName "$FILE" 'f').${FORMAT} + + # Move file into its final location. + cli_printMessage "$TARGET" 'AsMovedToLine' + mv ${SOURCE} ${TARGET} + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_renderGrub.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_renderGrub.sh new file mode 100644 index 0000000..c9ebecb --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_renderGrub.sh @@ -0,0 +1,101 @@ +#!/bin/bash +# +# identity_renderGrub.sh -- This function provides post-rendition +# action used to produce GRUB images. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderGrub { + + # Define 16 colors images default file name prefix. + local PREFIX='-14c' + + # Define options using those passed to actions from pre-rendition + # configuration script. These options are applied to pnmremap when + # doing color reduction, so any option available for pnmremap + # command can be passed to renderSyslinux functionality. + local OPTIONS=$(identity_getConfigOption "$ACTION" '2-') + + # Re-define 16 colors images default file name prefix using + # options as reference. This is useful to differenciate final + # files produced using Floyd-Steinberg dithering and files which + # do not. + if [[ "$OPTIONS" =~ '-floyd' ]];then + PREFIX="${PREFIX}-floyd" + fi + + # Check options passed to action. This is required in order to + # aviod using options used already in this script. For example + # -verbose and -mapfile options. + for OPTION in $OPTIONS;do + # Remove anything after equal sign inside option. + OPTION=$(echo -n $OPTION | cut -d'=' -f1) + if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then + cli_printMessage "`eval_gettext "The \\\$OPTION option is already used."`" + cli_printMessage "$(caller)" "AsToKnowMoreLine" + fi + done + + # Define motif's palette location. + local PALETTES=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Colors + + # Define the Netpbm color palettes used when reducing colors. + # These palettes should be 14 colors based. For more information + # on this see the GRUB's documentation. + local PALETTE_PPM=$PALETTES/grub.ppm + + # Print which palette of colors centos-art.sh script is using to + # produce grub content. This is relevant in order to know if we + # are using whether trunk or branches palette of colors. + cli_printMessage "$PALETTE_PPM" 'AsPaletteLine' + + # Check GRUB's palettes existence: If there is no palette assume + # that this is the first time you are rendition GRUB images. If + # that is the case the script will provide you with the PNG format + # which should be used as base to produce (using GIMP) the .gpl + # palette. The .gpl palette information is used to produced + # (using GIMP) the colormap (.ppm) which is used to automate the + # GRUB's 14 colors image (splash.png) rendition. If there is no + # palette available, do not apply color reduction, show a message, + # and continue. + cli_checkFiles $PALETTE_PPM + + # Create Netpbm superformat (PNM). PNM file is created from the + # PNG image rendered previously. PNM is a common point for image + # manipulation using Netpbm tools. + cli_printMessage "${FILE}.pnm" "AsSavedAsLine" + pngtopnm -verbose \ + < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm + + # Reduce colors as specified in ppm palette of colors. + cli_printMessage "${FILE}${PREFIX}.ppm" "AsSavedAsLine" + pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ + < ${FILE}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.ppm + + # Create the 14 colors xpm.gz file. + cli_printMessage "${FILE}${PREFIX}.xpm.gz" "AsSavedAsLine" + ppmtoxpm \ + < ${FILE}${PREFIX}.ppm 2>>${FILE}.log > ${FILE}.xpm \ + && gzip --force ${FILE}.xpm \ + && mv ${FILE}.xpm.gz ${FILE}${PREFIX}.xpm.gz + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_renderKsplash.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_renderKsplash.sh new file mode 100755 index 0000000..f88f0e9 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_renderKsplash.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# +# identity_renderKsplash.sh -- This function collects KDE splash +# (KSplash) required files and creates a tar.gz package that groups +# them all together. Use this function as last-rendition action for +# KSplash base-rendition action. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderKsplash { + + local -a SRC + local -a DST + local FONT='' + local COUNT=0 + + # Define font used to print bottom splash message. + FONT=$(cli_getRepoTLDir)/Identity/Fonts/DejaVuLGCSans-Bold.ttf + + # Check existence of font file. + cli_checkFiles "$FONT" 'f' + + # Define absolute source location of files. + SRC[0]="${OUTPUT}/splash_top.png" + SRC[1]="${OUTPUT}/splash_active_bar.png" + SRC[2]="${OUTPUT}/splash_inactive_bar.png" + SRC[3]="${OUTPUT}/splash_bottom.png" + SRC[4]="$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/Ksplash/Theme.rc" + + # Check absolute source location of files. + cli_checkFiles "${SRC[@]}" 'f' + + # Define relative target location of files. + DST[0]="${OUTPUT}/splash_top.png" + DST[1]="${OUTPUT}/splash_active_bar.png" + DST[2]="${OUTPUT}/splash_inactive_bar.png" + DST[3]="${OUTPUT}/splash_bottom.png" + DST[4]="${OUTPUT}/Theme.rc" + + # Print action message. + cli_printMessage "${OUTPUT}/Preview.png" 'AsCreatingLine' + + # Create `Preview.png' image. + convert -append ${SRC[0]} ${SRC[1]} ${SRC[3]} ${OUTPUT}/Preview.png + + # Add bottom text to Preview.png image. The text position was set + # inside an image of 400x300 pixels. If you change the final + # preview image dimension, you probably need to change the text + # position too. + mogrify -draw 'text 6,295 "KDE is up and running."' \ + -fill \#ffffff \ + -font $FONT \ + ${OUTPUT}/Preview.png + + # Copy `Theme.rc' file. + cp ${SRC[4]} ${DST[4]} + + # Apply common translation markers to Theme.rc file. + cli_replaceTMarkers "${DST[4]}" + + # Print separator line. + cli_printMessage '-' 'AsSeparatorLine' + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_renderLastActions.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_renderLastActions.sh new file mode 100755 index 0000000..0311b5d --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_renderLastActions.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# identity_renderLastActions.sh -- This function executes +# last-rendition actions. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderLastActions { + + local ACTION='' + + for ACTION in "${LASTACTIONS[@]}"; do + + case "${ACTION}" in + + renderKSplash ) + identity_renderKsplash + ;; + + renderDm:* ) + identity_renderDm + ;; + + groupByType:* ) + identity_renderGroupByType + ;; + esac + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_renderPostActions.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_renderPostActions.sh new file mode 100755 index 0000000..4cde273 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_renderPostActions.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# identity_renderPostActions.sh -- This function executes +# post-rendition actions. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderPostActions { + + local ACTION='' + + for ACTION in "${POSTACTIONS[@]}"; do + + case "${ACTION}" in + + renderSyslinux* ) + identity_renderSyslinux + ;; + + renderGrub* ) + identity_renderGrub + ;; + + renderFormats:* ) + identity_renderFormats + ;; + + groupByType:* ) + identity_renderGroupByType + ;; + + renderBrands ) + identity_renderBrands + ;; + + esac + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Identity/identity_renderSyslinux.sh b/Scripts/Bash/centos-art/Functions/Identity/identity_renderSyslinux.sh new file mode 100755 index 0000000..1346ac3 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Identity/identity_renderSyslinux.sh @@ -0,0 +1,130 @@ +#!/bin/bash +# +# identity_renderSyslinux.sh -- This function provides post-rendition +# action used to produce syslinux images. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderSyslinux { + + # Define 16 colors images default file name prefix. + local PREFIX='-16c' + + # Define options using those passed to actions from pre-rendition + # configuration script. These options are applied to pnmremap when + # doing color reduction, so any option available for pnmremap + # command can be passed to renderSyslinux functionality. + local OPTIONS=$(identity_getConfigOption "$ACTION" '2-') + + # Check options passed to action. This is required in order to + # aviod using options used already in this script. For example + # -verbose and -mapfile options. + for OPTION in $OPTIONS;do + # Remove anything after equal sign inside option. + OPTION=$(echo $OPTION | cut -d'=' -f1) + if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then + cli_printMessage "`eval_gettext "The \\\$OPTION option is already used."`" + cli_printMessage "$(caller)" "AsToKnowMoreLine" + fi + done + + # Re-define 16 colors images default file name prefix using + # options as reference. This is useful to differenciate final + # files produced using Floyd-Steinberg dithering and final files + # which are not. + if [[ "$OPTIONS" =~ '-floyd' ]];then + PREFIX="${PREFIX}-floyd" + fi + + # Define motif's palette location. + local PALETTES=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Colors + + # Define the Netpbm color palette used when reducing colors. This + # palette should be 16 colors based. For more information on this + # see the isolinux documentation. + local PALETTE_PPM=$PALETTES/syslinux.ppm + + # Define hexadecimal color information used by ppmtolss16. Color + # information and order used on PALETTE_HEX and PALETTE_PPM should + # match exactly. + local PALETTE_HEX=$PALETTES/syslinux.hex + + # Print which palette of colors centos-art.sh script is using to + # produce grub content. This is relevant in order to know if we + # are using whether trunk or branches palette of colors. + cli_printMessage "$PALETTE_PPM" 'AsPaletteLine' + cli_printMessage "$PALETTE_HEX" 'AsPaletteLine' + + # Check syslinux's palettes existence: If there is no palette + # assume that this is the first time you are rendition syslinux + # images. If that is the case the script will provide you with the + # PNG format which should be used as base to produce (using GIMP) + # the .gpl palette. The .gpl palette information is used to + # produced (using GIMP) the colormap (.ppm) which is used to + # automate the syslinux's 16 colors image (syslinux-splash.png) + # rendition. If there is no palette available, do not apply color + # reduction, show a message, and continue. + cli_checkFiles $PALETTE_PPM + cli_checkFiles $PALETTE_HEX + + # Create Netpbm superformat (PNM). PNM file is created from the + # PNG image rendered previously. PNM is a common point for image + # manipulation using Netpbm tools. + cli_printMessage "${FILE}.pnm" "AsSavedAsLine" + pngtopnm -verbose \ + < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm + + # Reduce colors. Here we use the Netpbm color $PALETTE_PPM to + # enforce the color position in the image index and the + # Floyd-Steinberg dithering in order to improve color reduction. + cli_printMessage "${FILE}${PREFIX}.pnm" "AsSavedAsLine" + pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ + < ${FILE}.pnm 2>> ${FILE}.log > ${FILE}${PREFIX}.pnm + + # Create LSS16 image. As specified in isolinux documentation the + # background color should be indexed on position 0 and forground + # in position 7 (see /usr/share/doc/syslinux-X.XX/isolinux.doc). + # This order of colors is specified in $PALETTE_PPM and redefined + # here again for the LSS16 image format. Both $PALETTE_PPM and + # LSS16 color map redefinition ($PALETTE_HEX) should have the same + # colors and index order. PALETTE_HEX should return just one line + # with the color information as described in isolinux + # documentation (i.e #RRGGBB=0 #RRGGBB=1 ... [all values in the + # same line]). + cli_printMessage "${FILE}${PREFIX}.lss" "AsSavedAsLine" + PALETTE_HEX=$(cat $PALETTE_HEX | tr "\n" ' ' | tr -s ' ') + ppmtolss16 $PALETTE_HEX \ + < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.lss + + # Create the PPM image indexed to 16 colors. Also the colormap + # used in the LSS16 image is saved on ${FILE}.log; this is useful to + # verify the correct order of colors in the image index. + cli_printMessage "${FILE}${PREFIX}.ppm" "AsSavedAsLine" + lss16toppm -map \ + < ${FILE}${PREFIX}.lss 2>>${FILE}.log > ${FILE}${PREFIX}.ppm + + # Create the 16 colors PNG image. + cli_printMessage "${FILE}${PREFIX}.png" "AsSavedAsLine" + pnmtopng -verbose -palette=$PALETTE_PPM \ + < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.png + +} diff --git a/Scripts/Bash/centos-art/Functions/Locale/locale.sh b/Scripts/Bash/centos-art/Functions/Locale/locale.sh new file mode 100644 index 0000000..a64e3ed --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Locale/locale.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# locale.sh -- This function provides internationalization features +# for centos-art.sh script through gettext standard processes. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale { + + # Initialize default value to create/update machine object flag. + # The machine object flag (--dont-create-mo) controls whether + # centos-art.sh script does create/update the machine object + # related object or not. + local FLAG_DONT_CREATE_MO='false' + + # Define the command-line interface. + locale_getActions + +} diff --git a/Scripts/Bash/centos-art/Functions/Locale/locale_editMessages.sh b/Scripts/Bash/centos-art/Functions/Locale/locale_editMessages.sh new file mode 100755 index 0000000..2dfbdf7 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Locale/locale_editMessages.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# locale_editMessages.sh -- This function edits portable objects (.po) +# using default text editor. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_editMessages { + + local FILES='' + + # Define list of files to process. In order to make edition + # easier for translators, the current locale information is used + # to determine which portable object to edit. If filter flag is + # set to something else but its default value (i.e., it was + # specified in the command line), the value entered is used + # instead. + if [[ $FLAG_FILTER == '.+' ]];then + FILES=$(cli_getFilesList "${WORKDIR}" "$(cli_getCurrentLocale).*\.po") + else + FILES=$(cli_getFilesList "${WORKDIR}" "${FLAG_FILTER}.*\.po") + fi + + # Set action preamble. + cli_printActionPreamble "${FILES}" "doEdit" 'AsResponseLine' + + # Use default text editor to edit files. + eval ${EDITOR} ${FILES} + + # Update machine object (.mo) from portable object (.po). + locale_updateMessageBinary ${FILES} + +} diff --git a/Scripts/Bash/centos-art/Functions/Locale/locale_getActions.sh b/Scripts/Bash/centos-art/Functions/Locale/locale_getActions.sh new file mode 100644 index 0000000..25425d0 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Locale/locale_getActions.sh @@ -0,0 +1,119 @@ +#!/bin/bash +# +# locale_getActions.sh -- This function interprets arguments passed to +# `locale' functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_getActions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="update:,edit:,dont-create-mo" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + case "$1" in + + --update ) + + # Redefine action name. + ACTIONNAM="${FUNCNAM}_updateMessages" + + # Redefine action value. + ACTIONVAL="$2" + + # Rotate positional parameters + shift 2 + ;; + + --edit ) + + # Redefine action name. + ACTIONNAM="${FUNCNAM}_editMessages" + + # Redefine action value. + ACTIONVAL="$2" + + # Rotate positional parameters + shift 2 + ;; + + --dont-create-mo ) + + # Redefine create machine object flag. + FLAG_DONT_CREATE_MO="true" + + # Rotate positional parameters + shift 1 + ;; + + * ) + break + ;; + esac + done + + # Check action value. Be sure the action value matches the + # convenctions defined for source locations inside the working + # copy. + cli_checkRepoDirSource + + # Define locales base directory where locale directory structures + # are stored in. + local BASEDIR="$(cli_getRepoTLDir)/Locales" + + # Define locales work directory. This is the place where locale + # files (e.g., .po, .pot, .mo), for a specific parent directories, + # are stored in. There is one locale work directory for each + # parent directory or said differently, each parent directory has + # a parallel directory under `trunk/Locales' to store its + # translation messages. + local WORKDIR=$(echo $ACTIONVAL | sed -r \ + -e 's!trunk/(Identity|Manuals|Scripts)!trunk/Locales/\1!') + + # Syncronize changes between the working copy and the central + # repository to bring down changes. + cli_commitRepoChanges "${WORKDIR}" + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Syncronize changes between the working copy and the central + # repository to commit up changes. + cli_commitRepoChanges "${WORKDIR}" + +} diff --git a/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageBinary.sh b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageBinary.sh new file mode 100755 index 0000000..a4907e2 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageBinary.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# +# locale_updateMessageBinary.sh -- This function creates/updates +# machine objects (.mo) from portable objects (.po). +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessageBinary { + + # Verify machine object creation flag. + if [[ ${FLAG_DONT_CREATE_MO} == 'true' ]];then + return + fi + + local PO='' + local MO='' + local FILE='' + local FILES="$1" + + for FILE in $FILES;do + + # Verify existence of portable object. + cli_checkFiles "${FILE}" 'f' + + # Define absolute path to portable object. + PO=$FILE + + # Define absolute path to machine object. + MO=$(dirname ${PO})/LC_MESSAGES/$(basename ${PO} | sed -r 's!\.po$!.mo!') + + # Print action message. + if [[ -f ${MO} ]];then + cli_printMessage "${MO}" 'AsUpdatingLine' + else + cli_printMessage "${MO}" 'AsCreatingLine' + fi + + # Define directory used to store machine object. + MODIR=$(dirname ${MO}) + + # Create directory to store machine object, if it doesn't + # exist. + if [[ ! -d ${MODIR} ]];then + mkdir -p ${MODIR} + fi + + # Create machine object from portable object. + msgfmt --check ${PO} --output-file=${MO} + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageMetadata.sh b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageMetadata.sh new file mode 100755 index 0000000..5f9bd04 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageMetadata.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# +# locale_updateMessageMetadata.sh -- This function sanitates .pot and +# .po files to use common translation markers inside top comment. +# Later, replacement of common translation markers is applied to set +# the final information. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id4 +# ---------------------------------------------------------------------- + +function locale_updateMessageMetadata { + + local COUNT=0 + local -a SRC + local -a DST + + # Retrive absolute path of portable object we'll work with. + local FILE="$1" + + # Define current locale. + local CURRENTLOCALE=$(cli_getCurrentLocale) + + # Define language name from current locale. + local LANGNAME=$(cli_getLangName ${CURRENTLOCALE}) + + # Check existence of file before work with it. + cli_checkFiles "${FILE}" 'f' + + # Define pattern lines. The pattern lines are put inside portable + # objects through xgettext and xml2po commands . + SRC[0]='Project-Id-Version:' + SRC[1]='Report-Msgid-Bugs-To:' + SRC[2]='Last-Translator:' + SRC[3]='Language-Team:' + + # Define replacement lines for pattern line. + DST[0]="\"Project-Id-Version: ${CLINAME} (${CURRENTLOCALE})\\\n\"" + DST[1]="\"Report-Msgid-Bugs-To: =MAIL_DOCS=\\\n\"" + DST[2]="\"Last-Translator: CentOS Documentation SIG\\\n\"" + DST[3]="\"Language-Team: ${LANGNAME}\\\n\"" + + # Change pattern lines with their replacement lines. + while [[ $COUNT -lt ${#SRC[*]} ]];do + sed -i -r "/${SRC[$COUNT]}/c${DST[$COUNT]}" ${FILE} + COUNT=$(($COUNT + 1)) + done + + # Replace package information using gettext domain information. + sed -i -r "s/PACKAGE/${TEXTDOMAIN}/g" ${FILE} + + # Unset array variables to avoid undesired concatenations. + unset SRC + unset DST + +} diff --git a/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessagePObjects.sh b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessagePObjects.sh new file mode 100755 index 0000000..2c8182a --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessagePObjects.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# +# locale_updateMessagePObjects.sh --- This function verifies, +# initializes or updates portable objects from portable object +# templates. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessagePObjects { + + local FILE="$1" + + # Verify the portable object template. The portable object + # template is used to create the portable object. + cli_checkFiles "${FILE}.pot" 'f' + + # Verify existence of portable object. The portable object is the + # file translators edit in order to make translation works. + if [[ -f ${FILE}.po ]];then + + # Print action message. + cli_printMessage "${FILE}.po" 'AsUpdatingLine' + + # Update portable object merging both portable object and + # portable object template. + msgmerge --output="${FILE}.po" "${FILE}.po" "${FILE}.pot" --quiet + + else + + # Print action message and initiate portable object using + # portable object template. There is no `--quiet' option for + # msginit command that let to separate both printing action + # message and creation command apart one from another so we + # have to play with stderr and stdout outputs to print the + # action message as we usually do. + cli_printMessage $(msginit -i ${FILE}.pot -o ${FILE}.po --width=70 \ + --no-translator 2>&1 | cut -d' ' -f2 | sed -r 's!\.$!!') 'AsCreatingLine' + + # Sanitate portable object metadata. This is the first time + # the portable object is created so some modifications are + # needed to customized metadata. + locale_updateMessageMetadata "${FILE}.po" + + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageShell.sh b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageShell.sh new file mode 100755 index 0000000..055475e --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageShell.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +# locale_updateMessageShell.sh -- This function parses shell scripts +# under action value, retrives translatable strings and +# creates/updates both portable object templates (.pot) and portable +# objects (.po). +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessageShell { + + local FILE='' + local FILES='' + + # Define file name used as reference to create portable object + # templates (.pot), portable objects (.po) and machine objects + # (.mo). + FILE="${WORKDIR}/$(cli_getCurrentLocale)/${TEXTDOMAIN}" + + # Verify directory used to store locale-specific translation + # messages. If it doesn't exist, create it. + if [[ ! -d $(dirname ${FILE}) ]];then + mkdir -p $(dirname ${FILE}) + fi + + # Build list of files to process. + if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Scripts/Bash" ]];then + FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}\.sh") + else + cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Set action preamble. + cli_printActionPreamble "${FILES}" "doLocale" 'AsResponseLine' + + # Print action message. + cli_printMessage "${FILE}.pot" 'AsUpdatingLine' + + # Prepare directory structure to receive .po files. + if [[ ! -d $(dirname ${FILE}) ]];then + mkdir -p $(dirname ${FILE}) + fi + + # Retrive translatable strings from shell script files and create + # the portable object template (.pot) from them. + /usr/bin/xgettext --output=${FILE}.pot \ + --copyright-holder="CentOS Documentation SIG" \ + --width=70 --sort-by-file ${FILES} + + # Verify, initialize or update portable objects from portable + # object templates. + locale_updateMessagePObjects "${FILE}" + +} diff --git a/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageXml.sh b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageXml.sh new file mode 100755 index 0000000..68e8b3c --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessageXml.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# +# locale_updateMessageXml.sh -- This function parses XML-based files +# (e.g., scalable vector graphics), retrives translatable strings and +# creates/update gettext portable objects. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessageXml { + + local FILE='' + local FILES='' + + # Define filename used to create both portable object templates + # (.pot) and portable objects (.po) files. + FILE="${WORKDIR}/$(cli_getCurrentLocale)" + + # Build list of files to process. + if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/.+" ]];then + FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}\.svg") + elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Manuals/.+" ]];then + FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}\.xml") + else + cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Set action preamble. + cli_printActionPreamble "${FILES}" "doLocale" 'AsResponseLine' + + # Print action message. + cli_printMessage "${FILE}.pot" 'AsUpdatingLine' + + # Prepare directory structure to receive .po files. + if [[ ! -d $(dirname ${FILE}) ]];then + mkdir -p $(dirname ${FILE}) + fi + + # Retrive translatable strings from XML-based files and + # create the portable object template (.pot) from them. + /usr/bin/xml2po ${FILES} | msgcat --output=${FILE}.pot --width=70 --sort-by-file - + + # Verify, initialize or merge portable objects from portable + # object templates. + locale_updateMessagePObjects "${FILE}" + +} diff --git a/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessages.sh b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessages.sh new file mode 100755 index 0000000..934e141 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Locale/locale_updateMessages.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# locale_updateMessages.sh -- This function extracts translatable +# strings from both XML-based files (using xml2po) and shell scripts +# (using xgettext). Translatable strings are initially stored in +# portable objects templates (.pot) which are later merged into +# portable objects (.po) in order to be optionally converted as +# machine objects (.mo). +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_updateMessages { + + local ACTIONNAM='' + + # Evaluate action value to determine whether to use xml2po to + # extract translatable strings from XML-based files or to use + # xgettext to extract translatable strings from shell script + # files. + if [[ $WORKDIR =~ "^${BASEDIR}/(Identity|Manuals)/.+$" ]];then + + # Update translatable strings inside portable object templates + # for XML-based files (e.g., scalable vector graphics). + ACTIONNAM="${FUNCNAM}_updateMessageXml" + + elif [[ $WORKDIR =~ "^${BASEDIR}/Scripts/.+$" ]];then + + # Update translatable strings inside portable object templates + # for shell scripts (e.g., centos-art.sh script). + ACTIONNAM="${FUNCNAM}_updateMessageShell" + + else + + cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + + fi + + # Execute action name. + if [[ $ACTIONNAM != '' ]];then + eval $ACTIONNAM + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/Config/manual-index.texi b/Scripts/Bash/centos-art/Functions/Manual/Config/manual-index.texi new file mode 100644 index 0000000..abe002c --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/Config/manual-index.texi @@ -0,0 +1,3 @@ +@node Index +@unnumbered Index +@printindex cp diff --git a/Scripts/Bash/centos-art/Functions/Manual/Config/manual-intro.texi b/Scripts/Bash/centos-art/Functions/Manual/Config/manual-intro.texi new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/Config/manual-intro.texi diff --git a/Scripts/Bash/centos-art/Functions/Manual/Config/manual-menu.texi b/Scripts/Bash/centos-art/Functions/Manual/Config/manual-menu.texi new file mode 100644 index 0000000..70362c8 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/Config/manual-menu.texi @@ -0,0 +1,3 @@ +@menu +* Index:: +@end menu diff --git a/Scripts/Bash/centos-art/Functions/Manual/Config/manual-nodes.texi b/Scripts/Bash/centos-art/Functions/Manual/Config/manual-nodes.texi new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/Config/manual-nodes.texi diff --git a/Scripts/Bash/centos-art/Functions/Manual/Config/manual-section.texi b/Scripts/Bash/centos-art/Functions/Manual/Config/manual-section.texi new file mode 100644 index 0000000..fb39647 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/Config/manual-section.texi @@ -0,0 +1,22 @@ +@subsection Goals + +@itemize +@item ... +@end itemize + +@subsection Description + +@itemize +@item ... +@end itemize + +@subsection Usage + +@itemize +@item ... +@end itemize + +@subsection See also + +@menu +@end menu diff --git a/Scripts/Bash/centos-art/Functions/Manual/Config/manual.texi b/Scripts/Bash/centos-art/Functions/Manual/Config/manual.texi new file mode 100644 index 0000000..3d05184 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/Config/manual.texi @@ -0,0 +1,55 @@ +\input texinfo @c -*-texinfo-*- +@c $Id$ +@c -- Header -------------------------------------------------- + +@setfilename =FILENAME=.info +@settitle =TITLE= +@documentlanguage =LOCALE_LL= +@afourpaper +@finalout + +@c -- Summary description and copyright ----------------------- + +@copying +=DESCRIPTION= + +Copyright @copyright{} =COPYRIGHT_YEAR= =COPYRIGHT_HOLDER= + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation; with no +Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A +copy of the license is included in the section entitled GNU Free +Documentation License. +@end copying + +@c -- Titlepage, contents, copyright --------------------------- + +@titlepage +@title =TITLE= +@subtitle =SUBTITLE= +@author =AUTHOR= +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage +@contents + +@c -- `Top' node and master menu ------------------------------- + +@ifnottex +@node Top +@top =TITLE= +@insertcopying +@end ifnottex +@include manual-menu.texi + +@c -- The body of the document -------------------------------- + +@include manual-nodes.texi + +@c -- The end of the document --------------------------------- + +@include manual-index.texi + +@bye diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual.sh b/Scripts/Bash/centos-art/Functions/Manual/manual.sh new file mode 100755 index 0000000..ff211a9 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# manual.sh -- This function provides documentation features to +# centos-art.sh script. Here we initialize documentation variables and +# call manual_getActions functions. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual { + + # Define manuals base directory. This is the place where + # documentation manuals base directory structures are stored and + # organized in. + MANUAL_BASEDIR="${HOME}/artwork/trunk/Manuals" + + # Define default value to target flag. The target flag (--to) + # controls final destination used by copy related actions. + local FLAG_TO='' + + # Define command-line interface. + manual_getActions + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_checkChapter.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_checkChapter.sh new file mode 100755 index 0000000..afb57de --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_checkChapter.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# manual_checkChapter.sh -- This function checks chapter structure. If +# it doesn't exist, create it. Inside CentOS Artwork Repository +# chapters are the base structure used to organize documentation. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_checkChapter { + + # Check chapter's directory existence. + if [[ ! -d $MANUAL_DIR_CHAPTER ]];then + + cli_printMessage "`gettext "The following documentation chapter will be created:"`" + cli_printMessage "$MANUAL_DIR_CHAPTER" "AsResponseLine" + cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" + + manual_updateChaptersFiles + manual_updateChaptersMenu + manual_updateChaptersNodes + + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_checkEntry.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_checkEntry.sh new file mode 100755 index 0000000..b851aef --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_checkEntry.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# manual_checkEntry.sh -- This function checks the documentation entry +# existence. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_checkEntry { + + # Check entry to edit and create it if it doesn't exist. + if [[ ! -f $ENTRY ]];then + + cli_printMessage "`gettext "The following documentation section will be created:"`" + cli_printMessage "$ENTRY" "AsResponseLine" + cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" + + manual_createEntry + + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_copyEntry.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_copyEntry.sh new file mode 100755 index 0000000..3d3e1d7 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_copyEntry.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# manual_copyEntry.sh -- This function copies documentation entries and +# update documentation structure to reflect changes. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_copyEntry { + + # Verify target directory. + cli_checkRepoDirTarget + + # Transform FLAG_TO path into a documentation entry. + FLAG_TO=$(manual_getEntry "${FLAG_TO}") + + # Print action preamble. + cli_printActionPreamble "${FLAG_TO}" 'doCreate' 'AsResponseLine' + + # Print action message. + cli_printMessage "$FLAG_TO" 'AsCreatingLine' + + # Copy documentation entry. + svn cp "${ENTRY}" "${FLAG_TO}" --quiet + + # Redefine documentation ENTRY variable in order to update + # documentation structure based on the new documentation entry + # specified by FLAG_TO path. At this point the new documentation + # entry should be created and available inside the working copy, + # so we are safe to update documentation structure using the new + # documentation entry as regular documentation entry. + ENTRY="${FLAG_TO}" + + # Update Texinfo menu information. + manual_updateMenu + + # Update Texinfo nodes information. + manual_updateNodes + + # Update Texinfo cross-reference information. + manual_restoreCrossReferences + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_createEntry.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_createEntry.sh new file mode 100755 index 0000000..0f61198 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_createEntry.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# manual_createEntry.sh -- This function creates a new documentation +# entry based on action value (ACTIONVAL). +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_createEntry { + + # Check chapter structure for this entry. + manual_checkChapter + + # Update chapter-menu for this entry. + manual_updateMenu + + # Update chapter-nodes (based on chapter-menu). + manual_updateNodes + + # Update old missing cross references. If for some reason a + # documentation entry is removed by mistake, and that mistake is + # fixing by adding the removed documentation entry back into the + # repository, rebuild the missing cross reference message to use + # the correct link to the documentation section. + manual_restoreCrossReferences + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_deleteCrossReferences.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_deleteCrossReferences.sh new file mode 100755 index 0000000..53f4c65 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_deleteCrossReferences.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# +# manual_deleteCrossReferences.sh -- This function looks inside +# texinfo source files, from section level on, and removes all cross +# referece definitions related to a documentation entry. Use this +# function in coordination with manual_deleteEntry function, in order +# to keep cross reference information, inside the documentation +# manual, syncronized. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_deleteCrossReferences { + + local -a PATTERN + local -a REPLACE + + # Build the node string using global entry (ENTRY) variable being + # processed currently. + local NODE=$(echo "$ENTRY" \ + | cut -d / -f8- \ + | tr '/' ' ' \ + | sed -r "s/(chapter-intro\.texi|\.texi)$//") + + # Define regular expression patterns for texinfo cross reference + # commands. + PATTERN[0]="@(pxref|xref|ref)\{(${NODE})\}" + PATTERN[1]="^(\* ${NODE}:(.*)?:(.*)?)$" + + # Define replacement string for missing entries. It is convenient + # to keep missing entries in documentation for documentation team + # to know. Removing the missing cross reference may intorudce + # confussion. Imagine that! you are spending lots of hours in an + # article and suddenly one of your cross refereces disappears with + # no visible reason, with the next working copy update you + # perform. That's frustrating. Instead, when centos-art.sh script + # finds a missing cross reference it removes the link and remark + # the issue for you to act on it. + REPLACE[0]='--- @strong{'`gettext "Removed"`'}(\1:\2) ---' + REPLACE[1]='@comment --- '`gettext "Removed"`'(\1) ---' + + # Sanitate all missing cross references, related to entry, in + # section texinfo files. Missing cross references, related to + # entry, in chapter texinfo files are already handled by + # manual_updateMenu, and manual_updateNode functions. If we don't + # sanitate missing cross refereces before info file is created, + # errors are displayed since makeinfo don't produce info output + # with broken cross refereces. + local ENTRIES=$(cli_getFilesList "${MANUAL_DIR}" '.*\.texi') + if [[ $ENTRIES != '' ]];then + sed -r -i \ + -e "s!${PATTERN[0]}!${REPLACE[0]}!Mg" \ + -e "s!${PATTERN[1]}!${REPLACE[1]}!g" \ + $ENTRIES + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_deleteEntry.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_deleteEntry.sh new file mode 100755 index 0000000..e9f4bb3 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_deleteEntry.sh @@ -0,0 +1,139 @@ +#!/bin/bash +# +# manual_deleteEntry.sh -- This function removes a documentation entry +# from documentation directory structure. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_deleteEntry { + + local ENTRIES='' + local ENTRYSTATUS='' + local LOCATION='' + + # Check if the entry has been already removed. + cli_checkFiles $ENTRY 'f' + + # Define root location to look for entries. + LOCATION=$(echo $ENTRY | sed -r 's!\.texi$!!') + + # Redefine location to match the chapter's root directory. This + # applies when you try to remove the whole chapter from the + # working copy (e.g., centos-art manual --delete=/home/centos/artwork/trunk/). + if [[ $ENTRY =~ "chapter-intro\.texi$" ]];then + LOCATION=$(dirname "$ENTRY") + fi + + # Define list of dependent entries. Dependent entries are stored + # inside a directory with the same name of the entry you are + # trying to remove. If such directory location doesn't exists, the + # related entry doesn't have dependent entries either. + if [[ -d $LOCATION ]];then + ENTRIES=$(cli_getFilesList $LOCATION ".*\.texi") + fi + + # Add entry being currently processed to list of files to precess. + ENTRIES="${ENTRIES} ${ENTRY}" + + # Remove duplicated lines from entries list, be sure there is just + # one path per line and they are ordered in reverse. At this + # point, it is hard to find duplicated lines since the list of + # entries is built from files and it is not possible to have two + # files in the very same directory using the same name exactly, so + # this could be considered a bit paranoid. ~:-) + ENTRIES=$(echo "$ENTRIES" | tr ' ' "\n" | sort -r | uniq) + + # Print action preamble. + cli_printActionPreamble "$ENTRIES" 'doDelete' 'AsResponseLine' + + # Process list of entries. + for ENTRY in $ENTRIES;do + + # Define the versioning status of entry. + if [[ -d $(dirname $ENTRY)/.svn ]];then + ENTRYSTATUS=$(cli_getRepoStatus "$ENTRY") + else + # At this point we don't know what the entry versioning + # status is, so consider the entry an unversion file. + ENTRYSTATUS='?' + fi + + # Verify entry inside the working copy. + if [[ "$ENTRYSTATUS" =~ '^(\?)?$' ]];then + + # Print action message. + cli_printMessage "$ENTRY" "AsDeletingLine" + + else + + # Do not remove a versioned documentation entry with + # changes inside. Print a message about it and stop script + # execution instead. + cli_printMessage "`gettext "There are changes that need to be committed first."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + + fi + + # Remove documentation entry. At this point, documentation + # entry can be under version control or not versioned at all. + # Here we need to decide how to remove documentation entries + # based on whether they are under version control or not. + if [[ "$ENTRYSTATUS" == ' ' ]];then + + # Documentation entry is under version control and there + # is no change to be committed up to central repository. + # We are safe to schedule it for deletion. + svn del "$ENTRY" --quiet + + elif [[ "$ENTRYSTATUS" == '?' ]];then + + # Documentation entry is not under version control, so we + # don't care about changes inside it. If you say + # centos-art.sh script to remove an unversion + # documentation entry it will do so, using convenctional + # `rm' command. + rm -r "$ENTRY" + + fi + + # Remove entry on section's menu and nodes to reflect the + # fact that documentation entry has been removed. + manual_updateMenu "remove-entry" + manual_updateNodes + + # Remove entry cross references from documentation manual. + manual_deleteCrossReferences + + done + + # Update chapter's menu and nodes in the master texinfo document. + # This is mainly applied when one of the chapters (e.g., trunk/, + # tags/, or branches/) is removed. + if [[ ! -d $MANUAL_DIR_CHAPTER ]];then + manual_updateChaptersMenu 'remove-entry' + manual_updateChaptersNodes + fi + + # Update documentation output-related files. + manual_updateOutputFiles + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_editEntry.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_editEntry.sh new file mode 100755 index 0000000..7bc2e81 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_editEntry.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# manual_editEntry.sh -- This function edits documentation entry based +# on entry pattern. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_editEntry { + + # Check chapter existence. In order to create/edit a section the + # chapter of that section needs to exist first. If the chapter + # hasn't been created, where are you going to store the section + # files? Put the chapter's checker here. + manual_checkChapter + + # Check section existence. + manual_checkEntry + + # Use default text editor to edit the documentation entry. + eval $EDITOR $ENTRY + + # Re-build output files to propagate recent changes. + manual_updateOutputFiles + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_getActions.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_getActions.sh new file mode 100755 index 0000000..5b7f2f3 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_getActions.sh @@ -0,0 +1,144 @@ +#!/bin/bash +# +# manual_getActions.sh -- This function interpretes arguments passed +# to `manual' functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_getActions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="read:,search:,edit:,delete:,update:,copy:,to:" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Define action to take for each option passed. + while true; do + case "$1" in + + --read ) + ACTIONVAL="$2" + ACTIONNAM="${FUNCNAM}_searchNode" + shift 2 + ;; + + --search ) + ACTIONVAL="$2" + ACTIONNAM="${FUNCNAM}_searchIndex" + shift 2 + ;; + + --edit ) + ACTIONVAL="$2" + ACTIONNAM="${FUNCNAM}_editEntry" + shift 2 + ;; + + --delete ) + ACTIONVAL="$2" + ACTIONNAM="${FUNCNAM}_deleteEntry" + shift 2 + ;; + + --update ) + ACTIONVAL="$2" + ACTIONNAM="${FUNCNAM}_updateOutputFiles" + shift 2 + ;; + + --copy ) + ACTIONVAL="$2" + ACTIONNAM="${FUNCNAM}_copyEntry" + shift 2 + ;; + + --to ) + FLAG_TO="$2" + shift 2 + ;; + + * ) + # Break options loop. + break + esac + done + + # Check action value passed through the command-line using source + # directory definition as reference. + cli_checkRepoDirSource + + # Define documentation entry. + ENTRY=$(manual_getEntry) + + # Define directory for documentation manual. This is the place the + # specific documentation manual we are working with is stored in. + MANUAL_DIR=$(echo $ENTRY | cut -d / -f-7) + + # Define directory to store documentation entries. At this point, + # we need to take a desition about documentation design, in order + # to answer the question: How do we assign chapters, sections and + # subsections automatically, based on the repository structure? + # and also, how such design could be adapted to changes in the + # repository structure? + # + # One solution would be: represent the repository's first level + # structure in three chapters only (i.e., trunk, branches, and + # tags) and handle everything else inside them as sections. Sub + # and subsub section will not have their own files, they will be + # written inside section files instead. + MANUAL_DIR_CHAPTER=$(echo $ENTRY | cut -d / -f-8) + + # Define chapter name for the documentation entry we are working + # with. + MANUAL_CHA_NAME=$(basename "$MANUAL_DIR_CHAPTER") + + # Define base name for documentation manual files. This is the + # main file name used to build texinfo related files (.info, .pdf, + # .xml, etc.). + MANUAL_BASEFILE=$(echo $ENTRY | cut -d / -f-7) + MANUAL_BASEFILE=${MANUAL_BASEFILE}/$(cli_getRepoName "${MANUAL_BASEFILE}" 'f') + + # Syncronize changes between the working copy and the central + # repository to bring down changes. + cli_commitRepoChanges ${MANUAL_DIR} + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Syncronize changes between the working copy and the central + # repository to commit up changes. + cli_commitRepoChanges ${MANUAL_DIR} + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_getEntry.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_getEntry.sh new file mode 100755 index 0000000..f974b32 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_getEntry.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# +# manual_getEntry.sh -- This function builds a documentation entry based +# on a location specified. Location specification can be both action +# value (ACTIONVAL) variable or a value passed as first positional +# parameter. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_getEntry { + + # Define variables as local to avoid conflicts outside. + local ENTRY='' + local LOCATION='' + + # Redefine location in order to make this function reusable not + # just for action value variable but whatever value passed as + # first possitional argument. + if [[ "$1" != '' ]];then + LOCATION="$1" + else + LOCATION="$ACTIONVAL" + fi + + # Define relative path of entry, from trunk directory on. + ENTRY=$(echo $LOCATION | sed -r "s!^${HOME}/artwork/!!") + + # Verify the entry relative path to find out which documentation + # manual we are acting on. As convenction, whatever documentation + # entry you provide outside trunk/Manuals/ directory structure is + # considered as you are documenting the repository directory + # structure. Otherwise, if an entry inside trunk/Manuals/ is + # provided, the directory structure provided is used as default + # documentation manual for actions like `--create' and `--update' + # to take place on. Other options like `--edit', `--delete' and + # `--read' cannot be applied to paths provided is inside + # trunk/Manuals/ such actions made manually. + if [[ ${ENTRY} =~ '^trunk/Manuals/.+$' ]];then + ENTRY=$(echo ${ENTRY} | sed 's!trunk/Manuals/!!') + else + ENTRY=$(dirname Repository/${ENTRY})/$(basename $LOCATION).texi + fi + + # Re-define entry to set absolute path to manuals base directory + # structure. + ENTRY=${MANUAL_BASEDIR}/${ENTRY} + + # Re-define documentation entry to handle chapter entries. Chapter + # entries are handled inside the chapter it refers to, not outside + # it. To store chapter-specific information, the special file + # chapter-intro.texi is used inside the chapter. + # TODO: automate the verification, in order to accept any other + # structure in the first level. + if [[ ${ENTRY} =~ "(trunk|branches|tags)\.texi$" ]];then + ENTRY=$(echo ${ENTRY} \ + | sed -r "s/(trunk|branches|tags)\.texi$/\1\/chapter-intro.texi/") + fi + + # Output entry's absolute path. + echo ${ENTRY} + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_getNode.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_getNode.sh new file mode 100755 index 0000000..487ece5 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_getNode.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# manual_getNode.sh -- This function cleans up the action value +# (ACTIONVAL) directory to make a node name from it. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_getNode { + + local NODE=$(echo "$ACTIONVAL" \ + | sed -r 's!^/home/centos/artwork/!!' \ + | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!') + + echo "$NODE" +} + diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_restoreCrossReferences.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_restoreCrossReferences.sh new file mode 100755 index 0000000..fb8ece9 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_restoreCrossReferences.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# manual_restoreCrossReferences.sh -- This function looks inside +# texinfo source files, from section level on, and restores any cross +# reference related to a documentation entry. This function is used in +# those cases where documentation entries are created/recreated to +# documentation structure. It is a verification that looks for +# matching documentation entries previously defined as removed by +# manual_deleteCrossReferences function. The +# manual_restoreCrossReferences function relays in the removed message +# format produced by manual_deleteCrossReferences function, in order +# to return them back into the link format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_restoreCrossReferences { + + local -a PATTERN + local -a REPLACE + + # Build the node string using global entry (ENTRY) variable being + # processed currently. + local NODE=$(echo "$ENTRY" \ + | cut -d / -f8- \ + | tr '/' ' ' \ + | sed -r "s/(${MANUALS_FILE[7]}|\.texi)$//") + + # Define regular expression patterns to match removed message + # format produced by message_removeCrossReferences function. + PATTERN[0]="--- @strong\{`gettext "Removed"`\}\((pxref|xref|ref):(${NODE})\) ---" + PATTERN[1]="^@comment --- `gettext "Removed"`\((\* ${NODE}:(.*)?:(.*)?)\) ---$" + + # Define replacement string to turn removed message back to cross + # reference link. + REPLACE[0]='@\1{\2}' + REPLACE[1]='\1' + + # Build list of source texinfo files to process, from section + # level on, and apply replacement string previously defined. At + # this point we don't touch chapter related texinfo files (i.e., + # repository-menu.texi and repository-nodes.texi) nor section + # related definition files (i.e., chapter-nodes.texi, + # chapter-menu.texi, chapter-index.texi) because they are handled + # by manual_updateChapterMenu, manual_updateChapterNode, + # manual_updateMenu, and manual_updateNodes functions + # respectively. If we don't sanitate messages built from broken + # cross reference messages, they may become obsolete since the + # documentation entry, they represent, can be recreated in the + # future and, at that time, the link wouldn't be broken any more, + # so we need to be aware of this. + local ENTRIES=$(cli_getFilesList "${MANUAL_DIR}" '.*\.texi') + if [[ $ENTRIES != '' ]];then + sed -r -i \ + -e "s!${PATTERN[0]}!${REPLACE[0]}!Mg" \ + -e "s!${PATTERN[1]}!${REPLACE[1]}!g" \ + $ENTRIES + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_searchIndex.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_searchIndex.sh new file mode 100644 index 0000000..09b9238 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_searchIndex.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# manual_searchIndex.sh -- This function does an index search inside the +# info document. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_searchIndex { + + /usr/bin/info --index-search="$FLAG_FILTER" --file=${MANUAL_BASEFILE}.info.bz2 + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_searchNode.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_searchNode.sh new file mode 100755 index 0000000..e3adba5 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_searchNode.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# manual_searchNode.sh -- This function does a node search inside the +# info document. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_searchNode { + + # Check entry inside documentation structure. If the entry + # exits use the info reader to open the info file at the + # specified node. Otherwise, ask the user for create it. + if [[ -f "$ENTRY" ]];then + /usr/bin/info --node="$(manual_getNode)" --file=${MANUAL_BASEFILE}.info.bz2 + else + manual_editEntry + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateChaptersFiles.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateChaptersFiles.sh new file mode 100755 index 0000000..6a38b6e --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateChaptersFiles.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# +# manual_updateChaptersFiles.sh -- This function updates chapter related +# files. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateChaptersFiles { + + # Define chapter's generic structure. + local CHAPTERBODY="\ + @node $MANUAL_CHA_NAME + @chapter $MANUAL_CHA_NAME + @cindex $(echo $MANUAL_CHA_NAME | tr '[[:upper:]]' '[[:lower:]]') + @include $MANUAL_CHA_NAME/chapter-intro.texi + @include $MANUAL_CHA_NAME/chapter-menu.texi + @include $MANUAL_CHA_NAME/chapter-nodes.texi" + + # Remove any space/tabs at the begining of @... lines. + CHAPTERBODY=$(echo "$CHAPTERBODY" | sed -r 's!^[[:space:]]+@!@!') + + # Create directory to store chapter files. + if [[ ! -d $MANUAL_DIR_CHAPTER ]];then + mkdir $MANUAL_DIR_CHAPTER + fi + + # Create files to store chapter information. If chapter files + # already exist, they will be re-written and any previous + # information inside them will be lost. + echo "$CHAPTERBODY" > $MANUAL_DIR_CHAPTER/chapter.texi + echo "" > $MANUAL_DIR_CHAPTER/chapter-menu.texi + echo "" > $MANUAL_DIR_CHAPTER/chapter-nodes.texi + + # Initialize chapter instroduction using template file. + cp ${FUNCCONFIG}/manual-cha-intro.texi $MANUAL_DIR_CHAPTER/chapter-intro.texi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateChaptersMenu.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateChaptersMenu.sh new file mode 100755 index 0000000..c3ec336 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateChaptersMenu.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# manual_updateChaptersMenu.sh - This function updates chapter menu. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateChaptersMenu { + + local ACTION=$1 + local MENUCHAPTERS='' + + # Build menu of chapters. The Index node is not included as other + # nodes are. The Index node is defined insde the master texinfo + # file (repository.texi). To create the final .info file + # correctly, the Index line in the menu should remain, even no + # other node exist. + if [[ -f ${MANUAL_BASEFILE}-menu.texi ]];then + MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.texi \ + | egrep -v "^(@(end )?menu$|\* Index::.*)$") + fi + + # Re-defined menu of chapters based on action. + case $ACTION in + 'remove-entry' ) + # Remove chapter from menu. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" \ + | egrep -v "^\* ${MANUAL_CHA_NAME}::[[:print:]]*$") + ;; + 'update-entry' | * ) + # Update chapter menu using texinfo format. + MENUCHAPTERS="${MENUCHAPTERS} + * ${MANUAL_CHA_NAME}::" + ;; + esac + + # Remove opening spaces/tabs and empty line from the menu of + # chapters. Empty lines may occur the first time the menu of + # chapters is created. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ + | egrep -v '^[[:space:]]*$') + + # Organize menu of chapters alphabetically and verify that no + # duplicated line be included on the list. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sort | uniq ) + + # Give format to final menu output. + MENUCHAPTERS="@menu + ${MENUCHAPTERS} + * Index:: + @end menu" + + # Strip opening space/tabs from final menu of chapters. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ + | egrep -v '^[[:space:]]*$') + + # Dump organized menu of chapters into file. + echo "${MENUCHAPTERS}" > ${MANUAL_BASEFILE}-menu.texi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateChaptersNodes.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateChaptersNodes.sh new file mode 100755 index 0000000..7ebfe77 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateChaptersNodes.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# manual_updateChaptersNodes.sh - This function updates nodes of +# chapters based on menu of chapters. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateChaptersNodes { + + # Build list "nodes of chapters" based on menu of chapters. + local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.texi \ + | egrep -v '^@(end )?menu$' \ + | egrep -v "^\* `gettext "Index"`::[[:print:]]*$" \ + | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \ + | sed -r 's! !_!g' | sort | uniq ) + + # Build list of texinfo inclusions to load chapters' nodes. + local FILENODE=$(\ + for CHAPTERNODE in ${CHAPTERNODES};do + + INCL=$(echo ${CHAPTERNODE} | sed -r "s!(${CHAPTERNODE})!\1/chapter\.texi!") + + # Output inclusion line using texinfo format. + echo "@include $INCL" + + done) + + # Dump organized nodes of chapters into file. + echo "$FILENODE" > ${MANUAL_BASEFILE}-nodes.texi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateMenu.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateMenu.sh new file mode 100755 index 0000000..b147742 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateMenu.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# manual_updateMenu.sh -- This function updates menu lines inside +# texinfo chapters. If this function is called with the +# 'remove-entry' string as first argument, then the menu line related +# to the entry being processed is removed. If this function is called +# with the 'update-entry' string as first argument, then the menu line +# related to the entry being processed is added to the menu. If no +# argument is passed to this function, the 'update-entry' action is +# assumed. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateMenu { + + # Specify which action to do inside chapter's menu. + local ACTION="$1" + + # Build the menu line related to the entry being processed + # currently. + local MENULINE=$(echo "$ENTRY" \ + | cut -d / -f8- \ + | tr '/' ' ' \ + | sed -r "s/(chapter-intro\.texi|\.texi)$//") + + # Give format to menu line using texinfo style. + MENULINE="* $MENULINE::" + + # Define chapter's menu. Remove `@menu', `@end menu', and empty lines + # from output. + local MENU=$(cat $MANUAL_DIR_CHAPTER/chapter-menu.texi \ + | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') + + # Re-defined chapter's menu based on action. + case $ACTION in + 'remove-entry' ) + # Remove menu line from chapter's menu. + MENU=$(echo "$MENU" | egrep -v "$MENULINE") + ;; + 'update-entry' | * ) + # Add menu line to chapter's menu. This is the default + # behaivour if no argument is passed to manual_updateMenu + # function. + MENU="$MENU + $MENULINE" + ;; + esac + + # Organize menu alphabetically, remove empty and duplicated lines. + # At this point, empty line may occur the first time the menu is + # created, don't let them to scape. + MENU=$(echo "$MENU" | egrep -v '^[[:space:]]*$' | sort | uniq ) + + # Rebuild chapter's menu structure adding '@menu' and '@end menu' + # lines back in menu. + MENU="@menu + $MENU + @end menu" + + # Remove opening spaces/tabs from final menu structure. + MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g') + + # Dump final menu structure back into chapter's menu file. + echo "$MENU" > $MANUAL_DIR_CHAPTER/chapter-menu.texi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateNodes.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateNodes.sh new file mode 100755 index 0000000..9f5bf43 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateNodes.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# manual_updateNodes.sh -- This function updates chapter's nodes +# definition using the chapter's menu as reference. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateNodes { + + # Retrive nodes' entries from chapter-menu.texi file. + local NODES=$(cat $MANUAL_DIR_CHAPTER/chapter-menu.texi \ + | sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \ + | egrep -v '^@(end )?menu$' | sed -r 's! !:!g' | sort | uniq) + + # Re-build node structure based on menu information. + for NODE in $NODES;do + + NODE=$(echo "$NODE" | sed -r 's!:! !g') + SECT=$(echo "$NODE" | sed -r 's! !/!g') + INCL=$(echo "$NODE" | sed -r 's! !/!g').texi + CIND=$(echo "$NODE") + + # Create an empty directory to store texinfo files. + if [[ ! -d ${MANUAL_DIR}/$(dirname "$INCL") ]];then + mkdir -p ${MANUAL_DIR}/$(dirname "$INCL") + fi + + # Create texinfo section file using its template. + if [[ ! -f ${MANUAL_DIR}/$INCL ]];then + cp ${FUNCCONFIG}/manual-section.texi ${MANUAL_DIR}/$INCL + fi + + # Output node information based on texinfo menu. + echo "@node $NODE" + echo "@section $SECT" + echo "@cindex $CIND" + echo "@include $INCL" + echo "" + + # Dump node information into chapter node file. + done > $MANUAL_DIR_CHAPTER/chapter-nodes.texi + +} + diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFileHtml.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFileHtml.sh new file mode 100755 index 0000000..326ac00 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFileHtml.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# manual_updateOutputFileHtml.sh -- This function exports +# documentation manual to HTML format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateOutputFileHtml { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}-html" 'AsUpdatingLine' + + # Check html output directory + [[ ! -d ${MANUAL_BASEFILE}-html ]] && mkdir -p ${MANUAL_BASEFILE}-html + + # Add html output directory into directory stack to make it the + # current working directory. Otherwise texi2html may produce + # incorrect paths to images included. + pushd ${MANUAL_BASEFILE}-html > /dev/null + + # Update html files. Use texi2html to export from texinfo file + # format to html using CentOS Web default visual style. + texi2html ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}-html --split section \ + --nosec-nav \ + --css-include=/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/stylesheet.css \ + -I=/home/centos/artwork + + # Apply html transformations. Html transformations rely on + # Texi2html default html output. The main goal of these html + # transformations is to build specific html structures that match + # specific css definitions. This way we extend the visual style of + # Texi2html default html output. + sed -r -i \ + -f /home/centos/artwork/trunk/Identity/Models/Css/Texi2html/transformations.sed \ + ${MANUAL_BASEFILE}-html/*.html + + # Remove html output directory from directory stack. + popd > /dev/null + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFileInfo.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFileInfo.sh new file mode 100755 index 0000000..0dd59b7 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFileInfo.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# manual_updateOutputFileInfo.sh -- This function exports +# documentation manual to info format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateOutputFileInfo { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" 'AsUpdatingLine' + + # Update info file. + /usr/bin/makeinfo ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.info + + # Compress info file. + if [[ $? -eq 0 ]];then + bzip2 -f ${MANUAL_BASEFILE}.info + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFilePdf.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFilePdf.sh new file mode 100755 index 0000000..ff2caac --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFilePdf.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# manual_updateOutputFilePdf.sh -- This function exports documentation +# manual to PDF format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateOutputFilePdf { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.pdf" 'AsUpdatingLine' + + # Update plaintext output directory. + /usr/bin/texi2pdf --quiet \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.pdf + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFilePlaintext.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFilePlaintext.sh new file mode 100755 index 0000000..9847825 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFilePlaintext.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# manual_updateOutputFilePlaintext.sh -- This function exports +# documentation manual to plain-text format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateOutputFilePlaintext { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.txt" 'AsUpdatingLine' + + # Update plaintext output directory. + /usr/bin/makeinfo --plaintext \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.txt + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFileXml.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFileXml.sh new file mode 100755 index 0000000..17b2704 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFileXml.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# manual_updateOutputFileXml.sh -- This function exports documentation +# manual to XML format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateOutputFileXml { + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.xml" 'AsUpdatingLine' + + # Update xml output format. + /usr/bin/makeinfo --xml \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.xml \ + +} diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFiles.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFiles.sh new file mode 100755 index 0000000..9535ccb --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_updateOutputFiles.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# manual_updateOutputFiles.sh -- This function exports documentation +# manual to different output formats. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateOutputFiles { + + # Verify documentation manual base file structure. + cli_checkFiles ${MANUAL_BASEFILE}.texi 'f' + + # Ouput separator line. + cli_printMessage '-' 'AsSeparatorLine' + + # Add the working copy root directory to directory stack to make + # path construction correctly. Otherwise, makeinfo may produce + # paths incorrectly. + pushd /home/centos/artwork > /dev/null + + manual_updateOutputFileInfo + manual_updateOutputFileHtml + manual_updateOutputFileXml + manual_updateOutputFilePdf + manual_updateOutputFilePlaintext + + # Remove the working copy root directory from directory stack. + popd > /dev/null + + # Output separator. + cli_printMessage "-" 'AsSeparatorLine' + +} diff --git a/Scripts/Bash/centos-art/Functions/Path/path.sh b/Scripts/Bash/centos-art/Functions/Path/path.sh new file mode 100755 index 0000000..4f3fe10 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Path/path.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# path.sh -- This function provides file manipulations to aliviate +# path maintainance inside the repository. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function path { + + # Define deafult value to target flag. The target flag (--to) + # controls final destination used by copy related actions. + local FLAG_TO='' + + # Define default value to syncronization flag. The syncronization + # flag (--sync) controls whether centos-art.sh script calls itself + # to create/delete parallel directories at the moment of + # create/delte action itself. + local FLAG_SYNC='false' + + # Define command-line interface. + path_getActions + +} diff --git a/Scripts/Bash/centos-art/Functions/Path/path_doCopy.sh b/Scripts/Bash/centos-art/Functions/Path/path_doCopy.sh new file mode 100755 index 0000000..b49cb66 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Path/path_doCopy.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# path_doCopy.sh -- This function duplicates files inside the working +# copy using subversion commands. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function path_doCopy { + + # Verify target directory. + cli_checkRepoDirTarget + + # Print action preamble. + cli_printActionPreamble "${FLAG_TO}" 'doCreate' 'AsResponseLine' + + # Verify relation between source and target locations. We cannot + # duplicate an entry if its parent directory doesn't exist as + # entry inside the working copy. + if [[ -f ${ACTIONVAL} ]];then + if [[ ! -d $(dirname "${FLAG_TO}") ]];then + mkdir -p $(dirname "${FLAG_TO}") + fi + svn add $(dirname "${FLAG_TO}") --quiet + fi + + # Print action message. + cli_printMessage "${FLAG_TO}" 'AsCreatingLine' + + # Copy parent directory. + svn copy ${ACTIONVAL} ${FLAG_TO} --quiet + + # Verify syncronization flag. + if [[ $FLAG_SYNC == 'true' ]];then + + # Copy parallel directories. + . /home/centos/bin/centos-art manual --copy="$ACTIONVAL" --to="$FLAG_TO" + . /home/centos/bin/centos-art render --copy="$ACTIONVAL" --to="$FLAG_TO" + . /home/centos/bin/centos-art locale --copy="$ACTIONVAL" --to="$FLAG_TO" + + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Path/path_doDelete.sh b/Scripts/Bash/centos-art/Functions/Path/path_doDelete.sh new file mode 100755 index 0000000..fad8ce4 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Path/path_doDelete.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# path_doDelete.sh -- This function deletes files inside the working +# copy using subversion commands. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function path_doDelete { + + # Verify target directory. + cli_checkRepoDirTarget + + # Print action preamble. + cli_printActionPreamble "$ACTIONVAL" 'doDelete' 'AsResponseLine' + + # Syncronize parallel directories related to action value. + . /home/centos/bin/centos-art manual --delete="$ACTIONVAL" + . /home/centos/bin/centos-art render --delete="$ACTIONVAL" + . /home/centos/bin/centos-art locale --delete="$ACTIONVAL" + + # Print action message. + cli_printMessage "${ACTIONVAL}" 'AsDeletingLine' + + # Perform action. + svn del ${ACTIONVAL} --quiet + +} diff --git a/Scripts/Bash/centos-art/Functions/Path/path_getActions.sh b/Scripts/Bash/centos-art/Functions/Path/path_getActions.sh new file mode 100755 index 0000000..7504f68 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Path/path_getActions.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# +# path_getActions.sh -- This function interpretes arguments passed to +# `path' functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function path_getActions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="copy:,move:,delete:,to:,sync" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Define action to take for each option passed. + while true; do + case "$1" in + + --copy ) + + # Define action value passed through the command-line. + ACTIONVAL="$2" + + # Define action name using action value as reference. + ACTIONNAM="${FUNCNAM}_doCopy" + + # Rotate positional parameters. + shift 2 + ;; + + --delete ) + + # Define action value passed through the command-line. + ACTIONVAL="$2" + + # Define action name using action value as reference. + ACTIONNAM="${FUNCNAM}_doDelete" + + # Rotate positional parameters. + shift 2 + ;; + + --to ) + + # Redefine target flag. + FLAG_TO="$2" + + # Verify target directory. + cli_checkRepoDirTarget + + # Rotate positional parameters. + shift 2 + ;; + + --sync ) + + # Redefine syncronization flag. + FLAG_SYNC='true' + + # Rotate positional parameters. + shift 1 + ;; + + * ) + # Break options loop. + break + esac + done + + # Check action value (ACTIONVAL) passed through the command-line + # using source directory definition as reference. + cli_checkRepoDirSource + + # Syncronize changes between the working copy and the central + # repository to bring down changes. + cli_commitRepoChanges "${ACTIOVAL} ${FLAG_TO}" + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Syncronize changes between the working copy and the central + # repository to commit up changes. + cli_commitRepoChanges "${ACTIOVAL} ${FLAG_TO}" + +} diff --git a/Scripts/Bash/centos-art/Functions/Shell/Config/tpl_forCopyright.sed b/Scripts/Bash/centos-art/Functions/Shell/Config/tpl_forCopyright.sed new file mode 100644 index 0000000..e8e5e2c --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Shell/Config/tpl_forCopyright.sed @@ -0,0 +1,38 @@ +# This file standardizes the look and feel of top comments used by +# scripts inside CentOS Artwork Repository. It contains the copyright +# note and the license under which the script is released. This files +# is used with the regular expression '.*\.sh$' only. +# --------------------------------------------------- +# $Id$ +# --------------------------------------------------- +/^# +Copyright .*$/a\ +# Copyright (C) =COPYRIGHT_YEAR== =COPYRIGHT_HOLDER=\ +# \ +# This program is free software; you can redistribute it and/or\ +# modify it under the terms of the GNU General Public License as\ +# published by the Free Software Foundation; either version 2 of the\ +# License, or (at your option) any later version.\ +# \ +# This program is distributed in the hope that it will be useful, but\ +# WITHOUT ANY WARRANTY; without even the implied warranty of\ +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\ +# General Public License for more details.\ +#\ +# You should have received a copy of the GNU General Public License\ +# along with this program; if not, write to the Free Software\ +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\ +# USA.\ +# \ +# ---------------------------------------------------------------------- + +# Remove previous comments. +/^# +Copyright .*$/,/^# -+$/{ +d +} + +# Remove more than one space after comments. +s/^# +/# / + +# Define first line +1c\ +#!/bin/bash diff --git a/Scripts/Bash/centos-art/Functions/Shell/shell.sh b/Scripts/Bash/centos-art/Functions/Shell/shell.sh new file mode 100755 index 0000000..f7d573d --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Shell/shell.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# shell.sh -- This function provides very basic string manipulations +# to help you maintain Bash scripts inside repository. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function shell { + + # Define command-line interface. + shell_getActions + +} diff --git a/Scripts/Bash/centos-art/Functions/Shell/shell_getActions.sh b/Scripts/Bash/centos-art/Functions/Shell/shell_getActions.sh new file mode 100755 index 0000000..c55606f --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Shell/shell_getActions.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# +# shell_getActions.sh -- This function interpretes arguments passed to +# `shell' functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function shell_getActions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="update-copyright:" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + + case "$1" in + + --update-copyright ) + + # Define action value. + ACTIONVAL="$2" + + # Define action name using action value as reference. + ACTIONNAM="${FUNCNAM}_updateCopyright" + + # Rotate positional parameters. + shift 2 + ;; + + * ) + # Break options loop. + break + esac + done + + # Check action value. Be sure the action value matches the + # convenctions defined for source locations inside the working + # copy. + cli_checkRepoDirSource + + # Syncronize changes between the working copy and the central + # repository to bring down changes. + cli_commitRepoChanges + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Syncronize changes between the working copy and the central + # repository to commit up changes. + cli_commitRepoChanges + +} diff --git a/Scripts/Bash/centos-art/Functions/Shell/shell_updateCopyright.sh b/Scripts/Bash/centos-art/Functions/Shell/shell_updateCopyright.sh new file mode 100755 index 0000000..050383f --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Shell/shell_updateCopyright.sh @@ -0,0 +1,143 @@ +#!/bin/bash +# +# shell_updateTopComment.sh -- This function replaces top comment +# section inside shell scripts (*.sh) with one of many pre-defined +# templates available. Use this function to maintain shell scripts top +# comments inside repository. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function shell_updateCopyright { + + local FILE='' + local COUNT=0 + local FILES='' + local INSTANCE='' + local TEMPLATES='' + local -a TITLE + local -a VALUE + local -a PATTERN + local -a PATTERN_MSG + local -a DEFAULT + local -a MARKER + + # Define absolute path to template file. + TEMPLATE="/home/centos/artwork/trunk/Scripts/Bash/Functions/Shell/Config/tpl_forCopyright.sed" + + # Check template file existence. + cli_checkFiles $TEMPLATE 'f' + + # Define file name to template instance. + INSTANCE=$(cli_getTemporalFile $TEMPLATE) + + # Define copyright information. + TITLE[0]="`gettext "Copyright holder"`" + TITLE[1]="`gettext "Copyright year"`" + + # Define translation marker. These values are used inside + # template file. + MARKER[0]='=COPYRIGHT_HOLDER=' + MARKER[1]='=COPYRIGHT_YEAR=' + + # Define pattern. These values are used as regular + # expression patterns for user's input further verification. + PATTERN[0]='^([[:alnum:] _-.]+)?$' + PATTERN[1]='^([[:digit:]]{4})?$' + + # Define pattern message. These values are used as output + # message when user's input doesn't match the related pattern. + PATTERN_MSG[0]="`gettext "Try using alphanumeric characters."`" + PATTERN_MSG[1]="`gettext "Try using numeric characters."`" + + # Define default values. + DEFAULT[0]="The CentOS Project. `gettext "All rights reserved."`" + DEFAULT[1]=$(date +%Y) + + # Initialize values using user's input. + cli_printMessage "`gettext "Enter the information you want to apply:"`" + while [[ $COUNT -ne ${#TITLE[*]} ]];do + + # Request value. + cli_printMessage "${TITLE[$COUNT]}" 'AsRequestLine' + read VALUE[$COUNT] + + # Sanitate values to exclude characters that could + # introduce possible markup malformations to final SVG files. + until [[ ${VALUE[$COUNT]} =~ ${PATTERN[$COUNT]} ]];do + cli_printMessage "${PATTERN_MSG[$COUNT]}" + cli_printMessage "${TITLE[$COUNT]}" 'AsRequestLine' + read VALUE[$COUNT] + done + + # Set default value to empty values. + if [[ ${VALUE[$COUNT]} == '' ]];then + VALUE[$COUNT]=${DEFAULT[$COUNT]} + fi + + # Increase counter. + COUNT=$(($COUNT + 1)) + + done + + # Create template instance. + cp $TEMPLATE $INSTANCE + + # Check template instance. We cannot continue if template instance + # couldn't be created. + cli_checkFiles $INSTANCE 'f' + + # Reset counter. + COUNT=0 + + while [[ $COUNT -ne ${#TITLE[*]} ]];do + + # Apply translation marker replacement. + sed -r -i "s!${MARKER[$COUNT]}!${VALUE[$COUNT]}!g" $INSTANCE + + # Increase counter. + COUNT=$(($COUNT + 1)) + + done + + # Define list of files to process + FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}.*\.sh") + + # Set action preamble. + cli_printActionPreamble "${FILES}" + + # Process list of files. + for FILE in $FILES;do + + # Output action message. + cli_printMessage $FILE 'AsUpdatingLine' + + # Apply template instance to file. + sed -r -i -f $INSTANCE $FILE + + done + + # Remove template instance. + if [[ -f ${INSTANCE} ]];then + rm ${INSTANCE} + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Svg/Config/tpl_forMetadata.sed b/Scripts/Bash/centos-art/Functions/Svg/Config/tpl_forMetadata.sed new file mode 100644 index 0000000..48bd70d --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Svg/Config/tpl_forMetadata.sed @@ -0,0 +1,68 @@ +# This file is the metadata information used by CentOS Artwork SIG on +# its scalable vector graphics (SVG) files. This files is used with +# the regular expression '.*\.svg$' only. +# --------------------------------------------------- +# $Id$ +# --------------------------------------------------- +/\ + \ + \ + image/svg+xml\ + \ + \ + =TITLE=\ + =DATE=\ + \ + \ + =CREATOR=\ + \ + \ + \ + \ + =RIGHTS=\ + \ + \ + \ + \ + =PUBLISHER=\ + \ + \ + =IDENTIFIER=\ + =SOURCE=\ + =RELATION=\ + =LANGUAGE=\ + \ + \ +=KEYWORDS=\ + \ + \ + =COVERAGE=\ + =DESCRIPTION=\ + \ + \ + =CONTRIBUTOR=\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + diff --git a/Scripts/Bash/centos-art/Functions/Svg/svg.sh b/Scripts/Bash/centos-art/Functions/Svg/svg.sh new file mode 100755 index 0000000..8ae161e --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Svg/svg.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# svg.sh -- This function provides very basic SVG manipulations to +# help you to maintain svg files inside the repository. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg { + + # Define command-line interface. + svg_getActions + +} diff --git a/Scripts/Bash/centos-art/Functions/Svg/svg_getActions.sh b/Scripts/Bash/centos-art/Functions/Svg/svg_getActions.sh new file mode 100755 index 0000000..62c5588 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Svg/svg_getActions.sh @@ -0,0 +1,98 @@ +#!/bin/bash +# +# svg_getActions.sh -- This function interpretes arguments passed to +# `svg' functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_getActions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="update-metadata:,vacuum-defs:" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + + case "$1" in + + --update-metadata ) + + # Define action value. + ACTIONVAL="$2" + + # Define action name using action value as reference. + ACTIONNAM="${FUNCNAM}_updateMetadata" + + # Rotate positional parameters. + shift 2 + ;; + + --vacuum-defs ) + + # Define action value. + ACTIONVAL="$2" + + # Define action name using action value as reference. + ACTIONNAM="${FUNCNAM}_vacuumDefs" + + # Rotate positional parameters. + shift 2 + ;; + + * ) + # Break options loop. + break + esac + done + + # Check action value. Be sure the action value matches the + # convenctions defined for source locations inside the working + # copy. + cli_checkRepoDirSource + + # Syncronize changes between the working copy and the central + # repository to bring down changes. + cli_commitRepoChanges + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Syncronize changes between the working copy and the central + # repository to commit up changes. + cli_commitRepoChanges + +} diff --git a/Scripts/Bash/centos-art/Functions/Svg/svg_updateMetadata.sh b/Scripts/Bash/centos-art/Functions/Svg/svg_updateMetadata.sh new file mode 100755 index 0000000..ab39f03 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Svg/svg_updateMetadata.sh @@ -0,0 +1,240 @@ +#!/bin/bash +# +# svg_updateMetadata.sh -- This function updates metadata values +# inside scalable vector graphic (SVG) files. First, we ask user to +# provide the information. If user doesn't provide the information, +# centos-art.sh script uses autogenerated values as default ---when +# possible--- taking as reference SVG file path. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_updateMetadata { + + local NAM='' + local URL='' + local KEYS='' + local FILE='' + local COUNT=0 + local FILES='' + local INSTANCE='' + local TEMPLATES='' + local -a TITLE + local -a VALUE + local -a PATTERN + local -a PATTERN_MSG + local -a MARKER + local -a DEFAULT + + # Define template file name. + TEMPLATE="/home/centos/artwork/trunk/Scripts/Bash/Functions/Svg/Config/tpl_forMetadata.sed" + + # Check template file existence. + cli_checkFiles $TEMPLATE 'f' + + # Define titles using Inkscape 0.46 metadata definition as reference. + TITLE[0]="`gettext "Title"`" + TITLE[1]="`gettext "Date"`" + TITLE[2]="`gettext "Creator"`" + TITLE[3]="`gettext "Rights"`" + TITLE[4]="`gettext "Publisher"`" + TITLE[5]="`gettext "Identifier"`" + TITLE[6]="`gettext "Source"`" + TITLE[7]="`gettext "Relation"`" + TITLE[8]="`gettext "Language"`" + TITLE[9]="`gettext "Keywords"`" + TITLE[10]="`gettext "Coverage"`" + TITLE[11]="`gettext "Description"`" + TITLE[12]="`gettext "Contributor"`" + + # Define markers. These values are used inside template. + MARKER[0]='=TITLE=' + MARKER[1]='=DATE=' + MARKER[2]='=CREATOR=' + MARKER[3]='=RIGHTS=' + MARKER[4]='=PUBLISHER=' + MARKER[5]='=IDENTIFIER=' + MARKER[6]='=SOURCE=' + MARKER[7]='=RELATION=' + MARKER[8]='=LANGUAGE=' + MARKER[9]='=KEYWORDS=' + MARKER[10]='=COVERAGE=' + MARKER[11]='=DESCRIPTION=' + MARKER[12]='=CONTRIBUTOR=' + + # Define pattern. These values are used as regular + # expression patterns for user's input further verification. + PATTERN[0]='^([[:alnum:] _-.]+)?$' + PATTERN[1]='^([0-9]{4}-(0[1-9]|1[0-2])-([0-2][1-9]|3[0-1]))?$' + PATTERN[2]=${PATTERN[0]} + PATTERN[3]=${PATTERN[0]} + PATTERN[4]=${PATTERN[0]} + PATTERN[5]='^(https://projects.centos.org/svn/artwork/[[:alnum:]/._-]+)?$' + PATTERN[6]=${PATTERN[5]} + PATTERN[7]=${PATTERN[5]} + PATTERN[8]='^([a-z]{2}(_[A-Z]{2})?)?$' + PATTERN[9]=${PATTERN[0]} + PATTERN[10]=${PATTERN[0]} + PATTERN[11]=${PATTERN[0]} + PATTERN[12]=${PATTERN[0]} + + # Define pattern message. These values are used as output + # message when user's input doesn't match the related pattern. + PATTERN_MSG[0]="`gettext "Try using alphanumeric characters."`" + PATTERN_MSG[1]="`gettext "Try using 'YYYY-MM-DD' date format."`" + PATTERN_MSG[2]=${PATTERN_MSG[0]} + PATTERN_MSG[3]=${PATTERN_MSG[0]} + PATTERN_MSG[4]=${PATTERN_MSG[0]} + PATTERN_MSG[5]="`gettext "Only locations under https://projects.centos.ort/svn/artwork are supported."`" + PATTERN_MSG[6]=${PATTERN_MSG[0]} + PATTERN_MSG[7]=${PATTERN_MSG[0]} + PATTERN_MSG[8]="`gettext "Try using 'LL' or 'LL_CC' locale format."`" + PATTERN_MSG[9]=${PATTERN_MSG[0]} + PATTERN_MSG[10]=${PATTERN_MSG[0]} + PATTERN_MSG[11]=${PATTERN_MSG[0]} + PATTERN_MSG[12]=${PATTERN_MSG[0]} + + # Define common default values. + DEFAULT[1]=$(date +%Y-%m-%d) + DEFAULT[2]="The CentOS Project" + DEFAULT[3]=${DEFAULT[2]} + DEFAULT[4]=${DEFAULT[2]} + DEFAULT[8]=$(cli_getCurrentLocale) + DEFAULT[10]=${DEFAULT[2]} + + # Initialize values using user's input. + cli_printMessage "`gettext "Enter metadata information you want to apply:"`" + while [[ $COUNT -ne ${#TITLE[*]} ]];do + + # Request value. + cli_printMessage "${TITLE[$COUNT]}" 'AsRequestLine' + read VALUE[$COUNT] + + # Sanitate values to exclude characters that could + # introduce possible markup malformations to final SVG files. + until [[ ${VALUE[$COUNT]} =~ ${PATTERN[$COUNT]} ]];do + cli_printMessage "${PATTERN_MSG[$COUNT]}" + cli_printMessage "${TITLE[$COUNT]}" 'AsRequestLine' + read VALUE[$COUNT] + done + + # Set default value to empty values. + if [[ ${VALUE[$COUNT]} == '' ]];then + VALUE[$COUNT]=${DEFAULT[$COUNT]} + fi + + # Increase counter. + COUNT=$(($COUNT + 1)) + + done + + # Build list of files to process. + FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}.*\.(svgz|svg)") + + # Set action preamble. + cli_printActionPreamble "${FILES}" + + # Process list of scalable vector graphics. + for FILE in $FILES;do + + # Output action message. + cli_printMessage $FILE 'AsUpdatingLine' + + # Build title from file path. + NAM=$(basename "$FILE") + + # Build url from file path. + URL=$(echo $FILE | sed 's!/home/centos!https://projects.centos.org/svn!') + + # Build keywords from file path. Do not include filename, it + # is already on title. + KEYS=$(dirname "$FILE" | cut -d/ -f6- | tr '/' '\n') + + # Build keywords using SVG standard format. Note that this + # information is inserted inside template file. The + # template file is a replacement set of sed commands + # so we need to escape the new line of each line using one + # backslash (\). As we are doing this inside bash, it is + # required to escape the backslash with another backslash so + # one of them passes literally to template file. + KEYS=$(\ + for KEY in $KEYS;do + echo " $KEY\\" + done) + + # Redefine template instance file name. + INSTANCE=$(cli_getTemporalFile $TEMPLATE) + + # Create template instance. + cp $TEMPLATE $INSTANCE + + # Check template instance. We cannot continue if the template + # instance couldn't be created. + cli_checkFiles $INSTANCE 'f' + + # Reset counter. + COUNT=0 + + while [[ $COUNT -ne ${#TITLE[*]} ]];do + + # Redefine file-specific values. + if [[ $COUNT -eq 0 ]];then + VALUE[$COUNT]=$NAM + elif [[ $COUNT -eq 5 ]];then + VALUE[$COUNT]=$URL + elif [[ $COUNT -eq 6 ]];then + VALUE[$COUNT]=$URL + elif [[ $COUNT -eq 7 ]];then + VALUE[$COUNT]=$URL + elif [[ $COUNT -eq 9 ]];then + VALUE[$COUNT]=$KEYS + fi + + # Apply translation marker replacement. + if [[ $COUNT -eq 9 ]];then + sed -i -r "/${MARKER[$COUNT]}/c\\${VALUE[$COUNT]}" $INSTANCE + else + sed -i -r "s!${MARKER[$COUNT]}!${VALUE[$COUNT]}!g" $INSTANCE + fi + + # Increase counter. + COUNT=$(($COUNT + 1)) + + done + + # Sanitate template instance. + sed -i -r -e 's/>$/>\\/g' $INSTANCE + + # Apply template instance to scalable vector graphic + # file. + sed -i -f $INSTANCE $FILE + + # Remove template instance. + if [[ -f $INSTANCE ]];then + rm $INSTANCE + fi + + # Sanitate scalable vector graphic. + sed -i -r '/^[[:space:]]*$/d' $FILE + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Svg/svg_vacuumDefs.sh b/Scripts/Bash/centos-art/Functions/Svg/svg_vacuumDefs.sh new file mode 100755 index 0000000..8c42754 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Svg/svg_vacuumDefs.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# svg_vacuumDefs.sh -- This function removes all unused items from the +# defs section of the SVG file massively. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_vacuumDefs { + + local FILE='' + local FILES='' + + # Build list of files to process. + FILES=$(cli_getFilesList "${ACTIONVAL}" "${FLAG_FILTER}.*\.(svgz|svg)") + + # Set action preamble. + cli_printActionPreamble "${FILES}" + + # Process list of files. + for FILE in $FILES;do + + # Output action message. + cli_printMessage "$FILE" 'AsUpdatingLine' + + # Vacuum unused svg definition using inkscape. + inkscape --vacuum-defs $FILE &> /dev/null + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify.sh b/Scripts/Bash/centos-art/Functions/Verify/verify.sh new file mode 100755 index 0000000..0265eae --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# verify.sh -- This function verifies your workstation for using +# centos-art.sh script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify { + + # Define command-line interface. + verify_getActions + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_doEnvironment.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_doEnvironment.sh new file mode 100755 index 0000000..10eddd5 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_doEnvironment.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# +# verify_doEnvironment.sh -- This function outputs a brief description +# of environment variables used by `centos-art.sh' script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_doEnvironment { + + local -a VARS + local -a INFO + local COUNT=0 + + # Define name of environment variables used by centos-art.sh + # script. + VARS[0]='EDITOR' + VARS[1]='TZ' + VARS[2]='TEXTDOMAIN' + VARS[3]='TEXTDOMAINDIR' + VARS[4]='LANG' + + # Define description of environment variables. + INFO[0]="`gettext "Default text editor"`" + INFO[1]="`gettext "Default time zone representation"`" + INFO[2]="`gettext "Default domain used to retrieve translated messages"`" + INFO[3]="`gettext "Default directory used to retrive translated messages"`" + INFO[4]="`gettext "Default locale information"`" + + until [[ $COUNT -eq ${#VARS[*]} ]];do + + # Let user to reduce output using regular expression as + # reference. + if [[ ${VARS[$COUNT]} =~ $FLAG_FILTER ]];then + + # Output list of environment variables using indirect + # expansion (what a beautiful feature!) to output variable + # value. + cli_printMessage "${INFO[$COUNT]}:" + cli_printMessage "${VARS[$COUNT]}=${!VARS[$COUNT]}" 'AsResponseLine' + + fi + + # Increment counter. + COUNT=$(($COUNT + 1)) + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_doLinkCheck.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_doLinkCheck.sh new file mode 100755 index 0000000..32088aa --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_doLinkCheck.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# +# verify_doLinkCheck.sh -- This function receives a list of required +# symbolic links and verifies them. This function enforces relation +# between link names and their targets (previously defined in +# verify_doLinks.sh function). +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_doLinkCheck { + + local -a LINKS_TARGET + local LINKS_COUNT=0 + + until [[ $LINKS_COUNT -eq ${#LINKS[*]} ]];do + + if [[ -h ${LINKS[$LINKS_COUNT]} ]]; then + + # At this point the required link does exist but we don't + # know if its target is the one it should be. Get target + # from required link in order to check it later. + LINKS_TARGET[$LINKS_COUNT]=$(stat --format='%N' ${LINKS[$LINKS_COUNT]} \ + | tr '`' ' ' | tr "'" ' ' | tr -s ' ' | cut -d' ' -f4) + + # Check required target from required link in order to + # know if it is indeed the one it should be. Otherwise add + # required link to list of missing links. + if [[ ${LINKS_TARGET[$LINKS_COUNT]} != ${TARGETS[$LINKS_COUNT]} ]] ;then + LINKS_MISSING[$LINKS_COUNT]=${LINKS[$LINKS_COUNT]} + LINKS_MISSING_ID="$LINKS_MISSING_ID $LINKS_COUNT" + fi + + else + + # At this point the required link doesn't exist at all. + # Add required link to list of missing links. + LINKS_MISSING[$LINKS_COUNT]=${LINKS[$LINKS_COUNT]} + LINKS_MISSING_ID="$LINKS_MISSING_ID $LINKS_COUNT" + + fi + + # Increase link counter. + LINKS_COUNT=$(($LINKS_COUNT + 1)) + + done + + # Stript out leading spaces from missing links ids. + LINKS_MISSING_ID=$(echo $LINKS_MISSING_ID | sed 's!^ +!!') + + # If there is no missing link, end script execution with a + # descriptive output. + if [[ ${#LINKS_MISSING[*]} -eq 0 ]];then + cli_printMessage "`gettext "The required links are already installed."`" + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_doLinkInstall.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_doLinkInstall.sh new file mode 100755 index 0000000..302a5f5 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_doLinkInstall.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# verify_doLinkInstall.sh -- This function receives a list of missing +# links and installs them using `ln'. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_doLinkInstall { + + local ID=0 + local LINKS_PARENT='' + local WARNING='' + + for ID in $LINKS_MISSING_ID;do + + # Verify parent directory of missing link names that have a + # file as target. If the parent directory doesn't exist, + # create it first before creating links inside it. Because + # links are not created yet, we use their related targets as + # reference to determine what type of link we are creating. + if [[ -f ${TARGETS[$ID]} ]];then + LINKS_PARENT=$(dirname "${LINKS[$ID]}") + cli_checkFiles $LINKS_PARENT 'd' + fi + + # Verify missing link that already exists as regular file. If + # a regular file exists with the same name of a required link, + # warn the user about it and continue with the next file in + # the list of missing links that need to be installed. + if [[ -f ${LINKS[$ID]} ]];then + WARNING=" (`gettext "Already exists as regular file."`)" + cli_printMessage "${LINKS[$ID]}${WARNING}" 'AsResponseLine' + continue + fi + + # Create symbolic link. + ln -s ${TARGETS[$ID]} ${LINKS[$ID]} + + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_doLinkReport.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_doLinkReport.sh new file mode 100755 index 0000000..a47255e --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_doLinkReport.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# verify_doLinkReport.sh -- This function outputs information about +# missing links that need to be installed and a confirmation question +# for users to accept the installation action. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_doLinkReport { + + local LINK='' + local LINKS_MISSING_MAX=0 + + # Define max number of missing links. + LINKS_MISSING_MAX=${#LINKS_MISSING[*]} + + # Output list header. + cli_printMessage "`ngettext "The following link will be installed" \ + "The following links will be installed" "$LINKS_MISSING_MAX"`:" + + # Output list body. + for LINK in ${LINKS_MISSING[@]};do + cli_printMessage "${LINK}" 'AsResponseLine' + done + + # Request confirmation for further link installation. + cli_printMessage "`gettext "Do you want to continue"`" 'AsYesOrNoRequestLine' + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_doLinks.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_doLinks.sh new file mode 100755 index 0000000..646377c --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_doLinks.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# verify_doLinks.sh -- This function verifies required links your +# workstation needs in order to run the centos-art command correctly. +# If any required link is missing, the `centos-art.sh' script asks you +# to confirm their installation. When installing links, the +# `centos-art.sh' script uses the `ln' command to achieve the task. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_doLinks { + + local -a LINKS + local -a TARGETS + local -a LINKS_MISSING + local LINKS_MISSING_ID='' + + # Define link names. + LINKS[0]=/home/centos/bin/centos-art + LINKS[1]=/home/centos/.fonts/denmark.ttf + LINKS[2]=/home/centos/.inkscape/palettes/CentOS.gpl + LINKS[3]=/home/centos/.$(rpm -q gimp | cut -d. -f-2)/palettes/CentOS.gpl + LINKS[4]=/home/centos/artwork/branches/Scripts + + # Define link targets. Use array index as reference to know + # relation between link names and targets. Be sure both link names + # and link targets use the same array index value. + TARGETS[0]=/home/centos/artwork/trunk/Scripts/Bash/centos-art.sh + TARGETS[1]=/home/centos/artwork/trunk/Identity/Fonts/Ttf/denmark.ttf + TARGETS[2]=/home/centos/artwork/trunk/Identity/Colors/CentOS.gpl + TARGETS[3]=${TARGETS[2]} + TARGETS[4]=/home/centos/artwork/trunk/Scripts/ + + verify_doLinkCheck + verify_doLinkReport + verify_doLinkInstall + + # At this point all required links must be installed. To confirm + # required links installation let's verify them once more. + verify_doLinks + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_doPackageCheck.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_doPackageCheck.sh new file mode 100755 index 0000000..1b675e5 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_doPackageCheck.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# +# verify_doPackageCheck.sh -- This function receives a list of +# packages and verifies if they are currently installed in your +# system. Third party package verification is also done here. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_doPackageCheck { + + local PACKAGE='' + + # Check package manager command existance. + cli_checkFiles '/bin/rpm' 'x' + + for PACKAGE in $PACKAGES;do + + # Query your system's RPM database. + rpm -q --queryformat "%{NAME}\n" $PACKAGE --quiet + + # Define missing packages. + if [[ $? -ne 0 ]];then + PACKAGES_MISSING[$PACKAGES_COUNT]=$PACKAGE + fi + + # Increase package counter. + PACKAGES_COUNT=$(($PACKAGES_COUNT + 1)) + + done + + # In there is no missing package, end script execution with a + # descriptive output. + if [[ ${#PACKAGES_MISSING[*]} -eq 0 ]];then + cli_printMessage "`gettext "The required packages are already installed."`" + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_doPackageInstall.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_doPackageInstall.sh new file mode 100755 index 0000000..da0d5e6 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_doPackageInstall.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# verify_doPackageInstall.sh -- This function receives a list of +# missing packages and installs them using sudo yum. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_doPackageInstall { + + # Verify `yum' command existence. + cli_checkFiles '/usr/bin/yum' 'x' + + # Use sudo to install packages in your system through yum. + sudo yum install ${PACKAGES_MISSING[*]} + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_doPackageReport.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_doPackageReport.sh new file mode 100755 index 0000000..95a755a --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_doPackageReport.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# verify_doPackageReport.sh -- This function receives one list of +# missing packages and another list of packages from third party +# repository that were marked as missing packages. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_doPackageReport { + + local PACKAGE='' + local WARNING='' + + cli_printMessage "`ngettext "The following package needs to be installed" \ + "The following packages need to be installed" \ + "$PACKAGES_COUNT"`:" + + for PACKAGE in ${PACKAGES_MISSING[@]};do + + # Is this package from third party? + if [[ $PACKAGE =~ $PACKAGES_THIRD_FLAG_FILTER ]];then + WARNING=" (`gettext "requires third party repository!"`)" + fi + + cli_printMessage "${PACKAGE}${WARNING}" 'AsResponseLine' + + done + + cli_printMessage "`gettext "Do you want to continue"`" 'AsYesOrNoRequestLine' + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_doPackages.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_doPackages.sh new file mode 100644 index 0000000..77ab1df --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_doPackages.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# verify_doPackages.sh -- This function verifies required packages +# your workstation needs in order to run the centos-art command +# correctly. If there are missing packages, the `centos-art.sh' script +# asks you to confirm their installation. When installing packages, +# the `centos-art.sh' script uses the yum application in order to +# achieve the task. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_doPackages { + + local PACKAGES='' + local PACKAGES_THIRD_FLAG_FILTER='' + local -a PACKAGES_MISSING + local PACKAGES_COUNT=0 + + # Define required packages needed by centos-art.sh script. + PACKAGES="bash inkscape ImageMagick netpbm netpbm-progs + syslinux gimp coreutils texinfo info tetex-latex tetex-fonts + tetex-doc tetex-xdvi tetex-dvips gettext texi2html" + + # Define, from required packages, packages being from third + # parties (i.e., packages not included in CentOS [base] + # repository.). + PACKAGES_THIRD_FLAG_FILTER="(inkscape|blender)" + + verify_doPackageCheck + verify_doPackageReport + verify_doPackageInstall + + # At this point we need to recheck installed packages in order to + # be sure the user decided not to continue when there are still + # missing packages to be install. For example this may happen + # when we try to install third party packages and there is no + # third party repository availabe to get those packages from. + verify_doPackages + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_getActions.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_getActions.sh new file mode 100755 index 0000000..d9b8b99 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_getActions.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +# verify_getActions.sh -- This function interpretes arguments passed +# to `verify' functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_getActions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="packages,links,environment" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + case "$1" in + + --packages ) + ACTIONNAM="${FUNCNAM}_doPackages" + break + ;; + + --links ) + ACTIONNAM="${FUNCNAM}_doLinks" + break + ;; + + --environment ) + ACTIONNAM="${FUNCNAM}_doEnvironment" + break + ;; + + * ) + break + esac + done + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_pathToCli.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_pathToCli.sh new file mode 100755 index 0000000..ad35b8e --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_pathToCli.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# verify_pathToCli.sh -- This function +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_pathToCli { + + # Define variables as local to avoid conflicts outside. + local -a REPODIRS + local -a REPOFILES + local -a REPOLINKS + local FILE='' + + # Define directories required by the centos-art.sh script command + # line interface. + REPODIRS[0]=/home/centos + REPODIRS[1]=/home/centos/bin + REPODIRS[2]=/home/centos/artwork/trunk/Scripts/Bash + + # Define files required by the centos-art.sh script command line + # interface. + REPOFILES[0]=${REPODIRS[2]}/centos-art.sh + + # Define symbolic links required by the centos-art.sh script + # command line interface. + REPOLINKS[0]=${REPODIRS[1]}/centos-art + + # Check defined directories. + for FILE in "${REPODIRS[@]}";do + cli_checkFiles $FILE 'd' + done + + # Check defined files. + for FILE in "${REPOFILES[@]}";do + cli_checkFiles $FILE 'f' + done + + # Check defined symbolic links. + for FILE in "${REPOLINKS[@]}";do + cli_checkFiles $FILE 'h' + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_pathToFonts.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_pathToFonts.sh new file mode 100644 index 0000000..90c1a23 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_pathToFonts.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# verify_pathToFonts.sh -- This function checks user's fonts +# directory. In order for some artworks to be rendered correctly, +# denmark font needs to be available. By default, denmark font doesn't +# come with CentOS distribution so create a symbolic link (from the +# one we have inside repository) to make it available if it isn't yet. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_pathToFonts { + + # Define variables as local to avoid conflicts outside. + local -a REPODIRS + local -a REPOFILES + local -a REPOLINKS + local FILE='' + + # Define font related directories. + REPODIRS[0]=/home/centos/.fonts + REPODIRS[1]=/home/centos/artwork/trunk/Identity/Fonts/Ttf + + # Define font related files. + REPOFILES[0]=${REPODIRS[1]}/denmark.ttf + + # Define font related symbolic links. + REPOLINKS[0]=${REPODIRS[0]}/denmark.ttf + + # Check defined directories. + for FILE in "${REPODIRS[@]}";do + cli_checkFiles $FILE 'd' + done + + # Check defined files. + for FILE in "${REPOFILES[@]}";do + cli_checkFiles $FILE 'f' + done + + # Check defined symbolic links. + for FILE in "${REPOLINKS[@]}";do + cli_checkFiles $FILE 'h' + done + +} diff --git a/Scripts/Bash/centos-art/Functions/Verify/verify_pathToInkscape.sh b/Scripts/Bash/centos-art/Functions/Verify/verify_pathToInkscape.sh new file mode 100755 index 0000000..69d5932 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/Verify/verify_pathToInkscape.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# +# verify_pathToInkscape.sh -- This function prepares user's +# ~/.inkscape configurations directory to use CentOS defaults (e.g., +# palettes, patterns, etc). +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function verify_pathToInkscape { + + # Define variables as local to avoid conflicts outside. + local -a REPODIRS + local -a REPOFILES + local -a REPOLINKS + local FILE='' + + # Define directories required by the centos-art.sh script command + # line interface. + REPODIRS[0]=/home/centos/.inkscape/palettes + REPODIRS[1]=/home/centos/artwork/trunk/Identity/Colors + + # Define files required by the centos-art.sh script command line + # interface. + REPOFILES[0]=${REPODIRS[1]}/CentOS.gpl + + # Define symbolic links required by the centos-art.sh script + # command line interface. + REPOLINKS[0]=${REPODIRS[0]}/CentOS.gpl + + # Check defined directories. + for FILE in "${REPODIRS[@]}";do + cli_checkFiles $FILE 'd' + done + + # Check defined files. + for FILE in "${REPOFILES[@]}";do + cli_checkFiles $FILE 'f' + done + + # Check defined symbolic links. + for FILE in "${REPOLINKS[@]}";do + cli_checkFiles $FILE 'h' + done + +} diff --git a/Scripts/Bash/centos-art/Functions/cli.sh b/Scripts/Bash/centos-art/Functions/cli.sh new file mode 100644 index 0000000..e4b1e4b --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli.sh @@ -0,0 +1,114 @@ +#!/bin/bash +# +# cli.sh -- This function initiates centos-art command-line interface. +# Variables defined in this function are accesible by all other +# functions. The cli function is the first script executed by +# centos-art command-line onces invoked. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli { + + # Initialize global variables. + local FUNCNAM='' + local FUNCDIR='' + local FUNCDIRNAM='' + local FUNCSCRIPT='' + local FUNCCONFIG='' + local ACTIONNAM='' + local ACTIONVAL='' + local ARGUMENTS='' + + # Initialize default value to verbosity flag. The verbosity flag + # (--quiet) controls whether centos-art.sh script prints messages + # or not. + local FLAG_QUIET='false' + + # Initialize default value to answer flag. The answer flag + # (--answer) controls whether centos-art.sh script does or does + # not pass confirmation request points. By default it doesn't. + local FLAG_ANSWER='false' + + # Initialize default value to filter flag. The filter flag + # (--filter) is used mainly to reduce the number of files to + # process. The value of this variable is interpreted as + # egrep-posix regular expression. As initial value, we use a + # regular expression that matches everything. + local FLAG_FILTER='.+' + + # Initialize default value to don't commit changes flag. The don't + # commit changes flag (--dont-commit-changes) controls whether + # centos-art.sh script syncronizes changes between Subversion + # central repository and working copy. + local FLAG_DONT_COMMIT_CHANGES='false' + + # Redefine positional parameters stored inside ARGUMENTS variable. + cli_doParseArgumentsReDef "$@" + + # Define function directory (FUNCDIR). The directory path where + # functionalities are stored inside the repository. + FUNCDIR=/home/centos/artwork/trunk/Scripts/Bash/Functions + + # Define function name (FUNCNAM) variable from first command-line + # argument. As convenction we use the first argument to determine + # the exact name of functionality to call. + FUNCNAM=$(cli_getRepoName "$1" 'f') + + # Define function directory. + FUNCDIRNAM=$(cli_getRepoName "$FUNCNAM" 'd') + + # Define function file name. + FUNCSCRIPT=${FUNCDIR}/${FUNCDIRNAM}/${FUNCNAM}.sh + + # Check function script existence. + cli_checkFiles $FUNCSCRIPT 'f' + + # Define function configuration directory. The function + # configuration directory is used to store functionality's + # related files. + FUNCCONFIG=${FUNCDIR}/${FUNCDIRNAM}/Config + + # Remove the first argument passed to centos-art.sh command-line + # in order to build optional arguments inside functionalities. We + # start counting from second argument (inclusive) on. + shift 1 + + # Redefine positional parameters stored inside ARGUMENTS variable. + cli_doParseArgumentsReDef "$@" + + # Parse positional parameters to retrive the value of common + # arguments (e.g., --answer-yes, --filter, --quiet, etc.). + cli_doParseArgumentsCommon + + # Define default text editors used by centos-art.sh script. + if [[ ! "$EDITOR" =~ '/usr/bin/(vim|emacs|nano)' ]];then + EDITOR='/usr/bin/vim' + fi + + # Check text editor execution rights. + cli_checkFiles $EDITOR 'x' + + # Go for function initialization. Keep the cli_getFunctions + # function calling after all variables and arguments definitions. + cli_getFunctions + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_checkFiles.sh b/Scripts/Bash/centos-art/Functions/cli_checkFiles.sh new file mode 100644 index 0000000..1e99667 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_checkFiles.sh @@ -0,0 +1,127 @@ +#!/bin/bash +# +# cli_checkFiles.sh -- This function standardizes file verifications +# inside centos-art.sh script. If file verification fails in anyway, +# centos-art.sh script complains about it and ends up script +# execution. +# +# Usage: +# +# cli_checkFiles FILE [TYPE] +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_checkFiles { + + # Get absolute path to file/directory. + local FILE="$1" + + # Get verification type. + local TYPE="$2" + + # Initialize message output. + local MESSAGE='' + + # Check number of paramaters passed to cli_checkFiles function. At + # least one argument should be passed. + if [[ $# -lt 1 ]];then + cli_printMessage "cli_checkFiles: `gettext "You need to provide one argument at least."`" 'AsErrorLine' + cli_printMessage "$(caller)" "AsToKnowMoreLine" + fi + + # Check value passed as file to cli_checkFiles function. The file + # value cannot be empty nor have extrange values. + cli_checkPathComponent "$FILE" '--default' + + # Perform file verification using FILE and TYPE variables. + case $TYPE in + + d | directory ) + # File exists and is a directory + if [[ ! -d $FILE ]];then + MESSAGE="`eval_gettext "The directory \\\"\\\$FILE\\\" doesn't exist."`" + fi + ;; + + f | regular-file ) + # File exists and is a regular file. + if [[ ! -f $FILE ]];then + MESSAGE="`eval_gettext "The file \\\"\\\$FILE\\\" is not a regular file."`" + fi + ;; + + h | symbolic-link ) + # File exists and is a symbolic link. + if [[ ! -h $FILE ]];then + MESSAGE="`eval_gettext "The file \\\"\\\$FILE\\\" is not a symbolic link."`" + fi + ;; + + x | execution ) + # To exist, file should be executable. + if [[ ! -x $FILE ]];then + MESSAGE="`eval_gettext "The file \\\"\\\$FILE\\\" is not executable."`" + fi + ;; + + fh ) + # To exist, file should be a regular file or a symbolic link. + if [[ ! -f $FILE ]];then + if [[ ! -h $FILE ]];then + MESSAGE="`eval_gettext "The path \\\"\\\$FILE\\\" doesn't exist."`" + fi + fi + ;; + + fd ) + # To exist, file should be a regular file or a directory. + if [[ ! -f $FILE ]];then + if [[ ! -d $FILE ]];then + MESSAGE="`eval_gettext "The path \\\"\\\$FILE\\\" doesn't exist."`" + fi + fi + ;; + + isInWorkingCopy ) + # To exist, file should be inside the working copy. + if [[ ! $FILE =~ "^/home/centos/artwork/.+$" ]];then + MESSAGE="`eval_gettext "The path \\\"\\\$FILE\\\" doesn't exist inside the working copy."`" + fi + ;; + + * ) + # File exists. + if [[ ! -a $FILE ]];then + MESSAGE="`eval_gettext "The path \\\"\\\$FILE\\\" doesn't exist."`" + fi + + esac + + # If file verification fails in anyway, output message information + # and end up script execution. Otherwise, continue with script + # normal flow. + if [[ "$MESSAGE" != '' ]];then + cli_printMessage "$MESSAGE" "AsErrorLine" + cli_printMessage "$(caller)" "AsToKnowMoreLine" + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_checkPathComponent.sh b/Scripts/Bash/centos-art/Functions/cli_checkPathComponent.sh new file mode 100755 index 0000000..1b7fb9d --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_checkPathComponent.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# +# cli_checkPathComponent.sh -- This function checks parts/components +# from repository paths. Generally, the path information is passed to +# the function's first positional argument and the part/component we +# want to check is passed to the function's second positional +# argument. If the second argument is not passed, then the first +# argument is assumed to be the part/component we want to check, and +# the action value (ACTIONVAL) variable is used instead as source path +# information. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id: cli_checkPathComponent.sh 958 2011-01-26 16:05:59Z al $ +# ---------------------------------------------------------------------- + +function cli_checkPathComponent { + + local -a PATTERNS + local LOCATION='' + local OPTION='' + local MESSAGE='' + + # Define location which we retrive information from. + if [[ "$#" -eq 1 ]];then + LOCATION="$ACTIONVAL" + OPTION="$1" + elif [[ "$#" -eq 2 ]];then + LOCATION="$1" + OPTION="$2" + else + cli_printMessage "cli_checkPathComponent: `gettext "Invalid arguments."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Define patterns. + PATTERNS[0]="^.+/$(cli_getPathComponent "${LOCATION}" '--release-pattern')/.*$" + PATTERNS[1]=$(cli_getPathComponent "${LOCATION}" '--release-architecture') + PATTERNS[2]=$(cli_getPathComponent "${LOCATION}" '--release-theme') + + # Identify which part of the release we want to output. + case "$OPTION" in + + '--release' ) + if [[ $LOCATION =~ ${PATTERN[0]} ]];then + MESSAGE="`eval_gettext "The release \\\`\\\$LOCATION' is not valid."`" + fi + ;; + + '--architecture' ) + if [[ $LOCATION =~ ${PATTERN[1]} ]];then + MESSAGE="`eval_gettext "The architecture \\\`\\\$LOCATION' is not valid."`" + fi + ;; + + '--theme' ) + if [[ $LOCATION =~ ${PATTERN[2]} ]];then + MESSAGE="`eval_gettext "The theme \\\`\\\$LOCATION' is not valid."`" + fi + ;; + + '--default' | * ) + if [[ $LOCATION == '' ]] \ + || [[ $LOCATION =~ '(\.\.(/)?)' ]] \ + || [[ ! $LOCATION =~ '^[A-Za-z0-9\.:/_-]+$' ]]; then + MESSAGE="`eval_gettext "The value \\\`\\\$LOCATION' is not valid."`" + fi + ;; + esac + + # Output message. + if [[ $MESSAGE != '' ]];then + cli_printMessage "$MESSAGE" 'AsErrorLine' + cli_printMessage "$(caller)" "AsToKnowMoreLine" + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_checkRepoDirSource.sh b/Scripts/Bash/centos-art/Functions/cli_checkRepoDirSource.sh new file mode 100755 index 0000000..cab663f --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_checkRepoDirSource.sh @@ -0,0 +1,98 @@ +#!/bin/bash +# +# cli_checkRepoDirSource.sh -- This function provides input validation +# to repository entries considered as source locations. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_checkRepoDirSource { + + # Check action value to be sure strage characters are kept far + # from path provided. + cli_checkPathComponent "$ACTIONVAL" '--default' + + # Redefine source value to build repository absolute path from + # repository top level on. As we are removing + # /home/centos/artwork/ from all centos-art.sh output (in order to + # save horizontal output space), we need to be sure that all + # strings begining with trunk/..., branches/..., and tags/... use + # the correct absolute path. That is, you can refer trunk's + # entries using both /home/centos/artwork/trunk/... or just + # trunk/..., the /home/centos/artwork/ part is automatically added + # here. + if [[ $ACTIONVAL =~ '^(trunk|branches|tags)' ]];then + ACTIONVAL=/home/centos/artwork/$ACTIONVAL + fi + + # Re-define source value to build repository absolute path from + # repository relative paths. This let us to pass repository + # relative paths as source value. Passing relative paths as + # source value may save us some typing; specially if we are stood + # a few levels up from the location we want to refer to as source + # value. There is no need to pass the absolute path to it, just + # refere it relatively. + if [[ -d ${ACTIONVAL} ]];then + + # Add directory to the top of the directory stack. + pushd "$ACTIONVAL" > /dev/null + + # Check directory existence inside the repository. + if [[ $(pwd) =~ '^/home/centos/artwork' ]];then + # Re-define source value using absolute path. + ACTIONVAL=$(pwd) + else + cli_printMessage "`eval_gettext "The location \\\`\\\$ACTIONVAL' is not valid."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Remove directory from the directory stack. + popd > /dev/null + + elif [[ -f ${ACTIONVAL} ]];then + + # Add directory to the top of the directory stack. + pushd "$(dirname "$ACTIONVAL")" > /dev/null + + # Check directory existence inside the repository. + if [[ $(pwd) =~ '^/home/centos/artwork' ]];then + # Re-define source value using absolute path. + ACTIONVAL=$(pwd)/$(basename "$ACTIONVAL") + else + cli_printMessage "`eval_gettext "The location \\\`\\\$ACTIONVAL' is not valid."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Remove directory from the directory stack. + popd > /dev/null + + else + + # At this there is no existent working copy entry, nor a valid + # url. The source value can only be considered as such if it + # is an existent working copy or valid url. So, print a + # message and stop script execution. + cli_printMessage "`eval_gettext "The location \\\`\\\$ACTIONVAL' is not valid."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_checkRepoDirTarget.sh b/Scripts/Bash/centos-art/Functions/cli_checkRepoDirTarget.sh new file mode 100755 index 0000000..77452aa --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_checkRepoDirTarget.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# +# cli_checkRepoDirTarget.sh -- This function provides input validation +# to repository entries considered as target location. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_checkRepoDirTarget { + + # Check target value before making an absolute path from it. + cli_checkPathComponent "$FLAG_TO" '--repo-directory' + + # Redefine target value to build repository absolute path from + # repository top level on. As we are removing + # /home/centos/artwork/ from all centos-art.sh output (in order to + # save horizontal output space), we need to be sure that all + # strings begining with trunk/..., branches/..., and tags/... use + # the correct absolute path. That is, you can refer trunk's + # entries using both /home/centos/artwork/trunk/... or just + # trunk/..., the /home/centos/artwork/ part is automatically added + # here. + if [[ $FLAG_TO =~ '^(trunk|branches|tags)/.+$' ]];then + FLAG_TO=/home/centos/artwork/$FLAG_TO + fi + + # Check target value. + if [[ -a ${FLAG_TO} ]];then + + # At this point target value does existent as working copy + # entry. We don't use existent locations as target. So, print + # a message and stop script execution. + cli_printMessage "`eval_gettext "The location \\\`\\\$FLAG_TO' already exists."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + + else + + # At this point existent locations inside working copy and + # invalid urls have been discarded. Assume a new target + # location has being specified. So, build the absolute path + # for it. + + # Add directory to the top of the directory stack. + pushd "$(dirname "$FLAG_TO")" > /dev/null + + # Check directory existence inside the repository. + if [[ $(pwd) =~ '^/home/centos/artwork' ]];then + # Re-define target value using absolute path. + FLAG_TO=$(pwd)/$(basename "$FLAG_TO") + fi + + # Remove directory from the directory stack. + popd > /dev/null + + # Verify target location. It is required that target location + # points to an entry under (trunk|branches|tags)/Identity/... + # directory structure *only*. Remember that Identity parent + # directory structure is the reference used to create parallel + # directories (i.e., documentation, configuration scripts, + # translations, etc.). We don't manipulate parallel + # directories with path ---or any other--- functionality + # directly. Consider manipulation of parallel directories as + # a consequence of a previous manipulation of Identity parent + # directory structure. + if [[ ! ${FLAG_TO} =~ '^.+/(trunk|branches|tags)/Identity/.+$' ]];then + cli_printMessage "`eval_gettext "cannot create \\\`\\\$FLAG_TO': It isn't an identity directory structure."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_commitRepoChanges.sh b/Scripts/Bash/centos-art/Functions/cli_commitRepoChanges.sh new file mode 100755 index 0000000..3e5366d --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_commitRepoChanges.sh @@ -0,0 +1,208 @@ +#!/bin/bash +# +# cli_commitRepoChanges.sh -- This function looks for revision changes +# inside absolute path passed as action value and ask you to commit +# them up to central repository. Use this function before or after +# whatever function that makes changes to files inside the working +# copy. It is better to commit small changes than long ones. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_commitRepoChanges { + + # Verify don't commit changes flag. + if [[ $FLAG_DONT_COMMIT_CHANGES == 'true' ]];then + return + fi + + local -a FILES + local -a INFO + local -a FILESNUM + local COUNT=0 + local UPDATEOUT='' + local PREDICATE='' + local LOCALFILES='' + local CHNGDIRECTION='' + local CHNGTOTAL=0 + local LOCATIONS='' + + # Define location. If function arguments are provided to + # cli_commitRepoChanges assume them as path location to work with. + # Function arguments can contain more than one path enclosed by + # quotation mark. In that case all paths are used as location to + # work with. If function arguments are not provided, the + # ACTIONVAL variable default value is used instead. + if [[ "$@" != '' ]];then + LOCATIONS="$@" + else + LOCATIONS="$ACTIONVAL" + fi + + # Verify locations. The location value may point to the working + # copy in the workstation, or to a URL in the central repository. + # The cli_commitRepoChanges function performs actions over working + # copy files only. So, we need to exclude all URL from location + # inside this function. Whatever action you perform over URL will + # take place immediatly through direct commit. + LOCATIONS=$(echo -e "$LOCATIONS" | sed -r "s! +!\n!g" \ + | egrep '^/home/centos/artwork/(trunk|branches|tags)/.+$') + + # Outout separator line. + cli_printMessage '-' 'AsSeparatorLine' + + # Update working copy. + cli_printMessage "`gettext "Bringing changes from the repository into the working copy"`" 'AsResponseLine' + UPDATEOUT=$(svn update ${LOCATIONS}) + + # Check working copy. + cli_printMessage "`gettext "Checking changes in the working copy"`" 'AsResponseLine' + STATUSOUT=$(svn status ${LOCATIONS}) + + # Outout separator line. + cli_printMessage '-' 'AsSeparatorLine' + + # Define path of files considered recent modifications from + # central repository to working copy. + FILES[0]=$(echo "$UPDATEOUT" | egrep "^A.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[1]=$(echo "$UPDATEOUT" | egrep "^D.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[2]=$(echo "$UPDATEOUT" | egrep "^U.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[3]=$(echo "$UPDATEOUT" | egrep "^C.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[4]=$(echo "$UPDATEOUT" | egrep "^G.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + + # Define path fo files considered recent modifications from + # working copy up to central repository. + FILES[5]=$(echo "$STATUSOUT" | egrep "^M.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[6]=$(echo "$STATUSOUT" | egrep "^\?.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[7]=$(echo "$STATUSOUT" | egrep "^D.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + FILES[8]=$(echo "$STATUSOUT" | egrep "^A.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") + + # Define description of files considered recent modifications from + # central repository to working copy. + INFO[0]="`gettext "Added"`" + INFO[1]="`gettext "Deleted"`" + INFO[2]="`gettext "Updated"`" + INFO[3]="`gettext "Conflicted"`" + INFO[4]="`gettext "Merged"`" + + # Define description of files considered recent modifications from + # working copy up to central repository. + INFO[5]="`gettext "Modified"`" + INFO[6]="`gettext "Unversioned"`" + INFO[7]=${INFO[1]} + INFO[8]=${INFO[0]} + + while [[ $COUNT -ne ${#FILES[*]} ]];do + + # Get total number of files. Avoid counting empty line. + if [[ "${FILES[$COUNT]}" == '' ]];then + FILESNUM[$COUNT]=0 + else + FILESNUM[$COUNT]=$(echo "${FILES[$COUNT]}" | wc -l) + fi + + # Calculate total amount of changes. + CHNGTOTAL=$(($CHNGTOTAL + ${FILESNUM[$COUNT]})) + + # Build report predicate. Use report predicate to show any + # information specific to the number of files found. For + # example, you can use this section to show warning messages, + # notes, and so on. By default we use the word `file' or + # `files' at ngettext's consideration followed by change + # direction. + if [[ ${FILESNUM[$COUNT]} -lt 1 ]];then + PREDICATE[$COUNT]=`gettext "file"` + else + PREDICATE[$COUNT]=`ngettext "file" "files" ${FILESNUM[$COUNT]}` + fi + + # Redefine report predicate to add direction of changes. + if [[ $COUNT -le 4 ]]; then + # Consider recent modifications from central repository + # down to working copy. + CHNGDIRECTION="`gettext "from the repository."`" + elif [[ $COUNT -gt 4 ]];then + # Consider recent modifications from working copy up to + # central repository. + CHNGDIRECTION="`gettext "from the working copy."`" + fi + + # Redefine report predicate using change direction. + PREDICATE[$COUNT]="${PREDICATE[$COUNT]} ${CHNGDIRECTION}" + + # Output report line. + cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}" 'AsRegularLine' + + # Increase counter. + COUNT=$(($COUNT + 1)) + + done + + # Outout separator line. + cli_printMessage '-' 'AsSeparatorLine' + + # Check total amount of changes. If there is no change, there is + # nothing more to do here except to return flow control to this + # function caller. + if [[ $CHNGTOTAL -eq 0 ]];then + return 0 + fi + + # In case new unversioned files exist, ask user to add them into + # the repository. This may happen when new documentation entries + # are created. + if [[ ${FILESNUM[6]} -gt 0 ]];then + cli_printMessage "`ngettext "The following file is unversioned" \ + "The following files are unversioned" ${FILESNUM[6]}`:" + for FILE in ${FILES[6]};do + cli_printMessage $FILE 'AsResponseLine' + done + cli_printMessage "`ngettext "Do you want to add it now?" \ + "Do you want to add them now?" ${FILESNUM[6]}`" 'AsYesOrNoRequestLine' + svn add ${FILES[6]} --quiet + fi + + # Reset counter. + COUNT=0 + + # Unify local changes into a common variable so common actions can + # be applied to them. + while [[ $COUNT -ne ${#FILES[*]} ]];do + LOCALFILES="$LOCALFILES ${FILES[$COUNT]}" + COUNT=$(($COUNT + 1 )) + done + + # Check list of changed files. If there are changes in the working + # copy, ask the user to verify, and later, commit them up to + # central repository. + if [[ $LOCALFILES != '' ]];then + + # Verify changes. + cli_printMessage "`gettext "Do you want to see changes now?"`" "AsYesOrNoRequestLine" + svn diff $LOCALFILES | less + + # Commit changes. + cli_printMessage "`gettext "Do you want to commit changes now?"`" "AsYesOrNoRequestLine" + svn commit $LOCALFILES + + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_doParseArguments.sh b/Scripts/Bash/centos-art/Functions/cli_doParseArguments.sh new file mode 100755 index 0000000..1f9126e --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_doParseArguments.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# cli_doParseArguments.sh -- This function redefines arguments +# (ARGUMENTS) global variable using getopt(1) output. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_doParseArguments { + + local ARG1='' + local ARG2='' + local COUNT=0 + + # Verify no option has been passed twice in the command-line. + for ARG1 in $ARGUMENTS;do + ARG1=$(echo $ARG1 | sed -r "s!^'(--[[:alpha:]-]+)=?.+'!\1!") + for ARG2 in $ARGUMENTS;do + ARG2=$(echo $ARG2 | sed -r "s!^'(--[[:alpha:]-]+)=?.+'!\1!") + if [[ $ARG1 == $ARG2 ]];then + COUNT=$(($COUNT + 1)) + fi + #echo "$ARG1 : $ARG2 : $COUNT" + if [[ $COUNT -gt 1 ]];then + cli_printMessage "`eval_gettext "The option \\\`\\\$ARG1' can't be duplicated."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + done + COUNT=0 + done + + # Reset positional parameters using optional arguments. + eval set -- "$ARGUMENTS" + + # Parse optional arguments using getopt. + ARGUMENTS=$(getopt -o "$ARGSS" -l "$ARGSL" -n $CLINAME -- "$@") + + # Be sure getout parsed arguments successfully. + if [[ $? != 0 ]]; then + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_doParseArgumentsCommon.sh b/Scripts/Bash/centos-art/Functions/cli_doParseArgumentsCommon.sh new file mode 100755 index 0000000..e31d91f --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_doParseArgumentsCommon.sh @@ -0,0 +1,199 @@ +#!/bin/bash +# +# cli_doParseArgumentsCommon.sh -- This function parses positional +# parameters to divide arguments in common argumetns and specific +# arguments. Common arguments might be used by all specific +# functionalities. There is no need to have all common argument +# definitions duplicated in each specific functionality individually. +# Once the value of common arguments have been retrived in FLAG_ +# variables they are removed from ARGUMENTS positional parameters, in +# order to leave the specific arguments that specific functionalities +# most interpret. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_doParseArgumentsCommon { + + local -a SHORT + local -a LONG + local -a REQUIRED + local ARGUMENT='' + local ARGUMENTS_DEFAULT='' + local COMMONS='' + local COMMON='' + local ARGSS='' + local ARGSL='' + local PATTERN='' + local COUNT=0 + + # Define local array to store short definition of common arguments. + SHORT[0]='f' + SHORT[1]='q' + SHORT[2]='y' + SHORT[3]='c' + + # Define local array to store long definition of common arguments. + LONG[0]='filter' + LONG[1]='quiet' + LONG[2]='answer' + LONG[3]='dont-commit-changes' + + # Define local array to store definition of whether the common + # argument is required [one colon], optional [two colons] or not + # required at all [empty]). + REQUIRED[0]=':' + REQUIRED[1]='' + REQUIRED[2]=':' + REQUIRED[3]='' + + # Save default arguments passed to centos-art.sh command-line. + # Since ARGUMENTS variable is used as convenction when arguments + # are redefined (see cli_doParseArgumentsReDef), it is required to + # use an intermediate-pattern variable in order to create the + # common and non-comon arguments information from it. + ARGUMENTS_DEFAULT=$ARGUMENTS + + # Build list of common arguments. + for ARGUMENT in $ARGUMENTS_DEFAULT;do + + while [[ $COUNT -lt ${#LONG[*]} ]];do + + # Define option pattern. + PATTERN="^'(--${LONG[$COUNT]}|-${SHORT[$COUNT]})" + + # Check argument against common argument pattern. + if [[ $ARGUMENT =~ "${PATTERN}" ]];then + if [[ $COMMONS == '' ]];then + COMMONS="${ARGUMENT}" + else + COMMONS="${COMMONS} ${ARGUMENT}" + fi + fi + + # Increment counter. + COUNT=$(($COUNT + 1)) + + done + + # Reset counter. + COUNT=0 + + done + + # Reset positional paramenters to start using common arguments and + # this way be able of performing common arguments verification + # independently from non-common arguments verification (which is + # done inside specific functionalities). + eval set -- "$COMMONS" + + # Redefine positional parameters stored inside ARGUMENTS variable + # to use common arguments only. + cli_doParseArgumentsReDef "$@" + + # Define short and long arguments variables using getopt format. + # This information is passed to getopt in order to now which the + # common arguments are. + while [[ $COUNT -lt ${#LONG[*]} ]];do + + # Define short arguments. + if [[ $ARGSS == '' ]];then + ARGSS=${SHORT[$COUNT]}${REQUIRED[$COUNT]} + else + ARGSS="${ARGSS},${SHORT[$COUNT]}${REQUIRED[$COUNT]}" + fi + + # Define long arguments. + if [[ $ARGSL == '' ]];then + ARGSL=${LONG[$COUNT]}${REQUIRED[$COUNT]} + else + ARGSL="${ARGSL},${LONG[$COUNT]}${REQUIRED[$COUNT]}" + fi + + # Increment counter. + COUNT=$(($COUNT + 1)) + + done + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Define action to take for each option passed. + while true; do + case "$1" in + + --filter ) + FLAG_FILTER="$2" + shift 2 + ;; + + --quiet ) + FLAG_QUIET="true" + shift 1 + ;; + + --answer ) + FLAG_ANSWER="$2" + shift 2 + ;; + + --dont-commit-changes ) + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + * ) + break + ;; + esac + done + + # Redefine ARGUMENTS to use no-common arguments. Common arguments + # has been already parsed, so free specific functions from parsing + # them (there is no need to parse them twice). + if [[ ${COMMONS} != '' ]];then + + # Escape special regular expression characters that might be + # passed through common arguments like `--filter' in order to + # interpreted them literally. Otherwise they might be + # interpreted when they be stript out from default arguments. + COMMONS=$(echo ${COMMONS} | sed -r 's!(\(|\[|\{|\.|\+|\*)!\\\1!g') + + # Stript out common arguments from default arguments one by + # one to avoid order restrictions when removing them from + # string of default arguments. + for COMMON in ${COMMONS};do + ARGUMENTS_DEFAULT=$(echo ${ARGUMENTS_DEFAULT} | sed -r "s!${COMMON}!!g") + done + + fi + + # Use just default arguments. No common argument was passed. + eval set -- "${ARGUMENTS_DEFAULT}" + + # Redefine positional parameters stored inside ARGUMENTS variable. + cli_doParseArgumentsReDef "$@" + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_doParseArgumentsReDef.sh b/Scripts/Bash/centos-art/Functions/cli_doParseArgumentsReDef.sh new file mode 100755 index 0000000..e163b8c --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_doParseArgumentsReDef.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# cli_doParseArgumentsReDef.sh -- This function initiates/reset +# positional parameters based on `$@' variable. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_doParseArgumentsReDef { + + local ARG + + # Clean up arguments global variable. + ARGUMENTS='' + + # Fill up arguments global variable with current positional + # parameter information. To avoid interpretation problems, use + # single quotes to enclose each argument (ARG) from command-line + # idividually. + for ARG in "$@"; do + ARGUMENTS="$ARGUMENTS '$ARG'" + done + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getCopyrightInfo.sh b/Scripts/Bash/centos-art/Functions/cli_getCopyrightInfo.sh new file mode 100755 index 0000000..4e2bab0 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getCopyrightInfo.sh @@ -0,0 +1,187 @@ +#!/bin/bash +# +# cli_getCopyrightInfo.sh -- This function outputs copyright +# information defined by design model the artistic motif images are +# produced from. As convenction, we use the file `copyright.txt' to +# store design model copyright information, in the root directory of +# design model directory structure. +# +# The copyright information is printed to show the fact that the +# person how creates something has the creation rights over that +# something he/she creates. An so, the legal power to release his/her +# creation under the ethical terms of whatever license he/she +# considers more appropriate, in order to distribute his/her creation. +# +# Inside CentOS Artwork Repository, we print copyright information in +# the following image-related components: +# +# 1. The artistic motifs, to define the visual style of themes. +# +# The copyright information of artistic motifs is owned by the +# person who creates the artistic motif (i.e., the artistic motif +# author). The copyright information of artistic motifs is +# specified in the `authors.txt' file placed inside the artistic +# motif directory structure. The copyright information of +# artistic motifs is printed in imagesunder +# trunk/Identity/Themes/Motifs/$THEME/Concept directory structure +# only. +# +# 2. The design models, to define the characteristics of themes. +# +# The copyright information of design models is owned by the +# person who creates the design model (i.e., the design model +# author). The copyright information of design models is +# specified in the metadata of each scalable vector graphic that +# make a design model on its own. The copyright information of +# design models is not printed in images. +# +# 3. The CentOS themes, to cover each visual manifestation of The +# CentOS Project corporate visual identity. A CentOS theme is +# made of many different images connected among themselves by +# mean of a uniform visual pattern (artistic motif + design +# model). +# +# The copyright information of CentOS themes is owned by The +# CentOS Project. Instead of printing the copyright information +# over all images inside one CentOS theme, the copyright +# information of CentOS themes is printed only on images related +# to Anaconda progress first slides. +# +# The copyright information printed on Anaconda progress first +# slides is used to print the creation rights of The CentOS +# Project over its creation (i.e., The CentOS Distribution) not +# The CentOS Theme itself. +# +# At this point, we've defined who owns the creation rights of image +# components. Now, it is important to remark that if we need to show +# one creation copyright, in different places, all references to the +# same cration copyright information should be the same. Cannot be any +# ambiguity among them. The best way to reach this is having just one +# unique definition, and build images using that unique copyright +# definition as reference. +# +# Another relevant point, we need to be aware of, is that related to +# the licenses. As creators has the creation rights, they have the +# right to distribute their work as their consideration. If creators +# release their creations under the terms of a privatizing license, +# that creation will be almost useless for The CentOS Community. So, +# in order for creations to be useful in The CentOS Community, +# creators should distribution their creations under the terms of a +# license that grants the freedom of using, studying, changing and +# releasing improved versions of them. Likewise, the license should +# prevent any privatizing practice or any kind of darkness that put in +# risk the freedom of The CentOS Community. +# +# What license should be used to distribute images (and the components +# used to build them) is a decision for The CentOS Community to take. +# The license adopted, by The CentOS Community, specifies the ethical +# terms The CentOS Community is agree to work with. It is a reference +# we all have to agree with and follow in the sake of our community +# and ourselves freedom. That's why license selection has to be a +# collective decision, and also be constantly in question. +# +# I'm not a lawyer. So, I can't give details of something I don't know +# certainly. All I've done so far is using my intuition and basic +# understanding of what copyright and license is. So, if you have a +# deeper understanding and experience in such legal topics, please +# feel free to make your own revisions to ideas described here. +# +# In the sake of covering copyright information and license needs +# inside centos-art.sh script, all images produced by `centos-art.sh' +# script will be released using the copyright information of his/her +# creator (see above) and the license Creative Common +# Attribution-ShareAlike 3.0 License +# (http://creativecommons.org/licenses/by-sa/3.0/). +# +# The Creative Common Attribution-ShareAlike 3.0 License has been +# adopted in The CentOS Wiki (http://wiki.centos.org/) and seems to be +# good as well to distribute image-specific creations under CentOS +# Artwork Repository. Of course, as licenses are always questionable, +# the one we've choosed could be changed in the future after a +# collective discussion in the CentOS mailing list, in order to better +# reflect the ethical feelings of our community. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getCopyrightInfo { + + case "$1" in + + '--license' ) + + # Output default license name used by all image-based + # creations inside CentOS Artwork Repository. + echo "Creative Common Attribution-ShareAlike 3.0" + ;; + + '--license-url' ) + + # Ouput default license url used by all image-based + # creations inside CentOS Artwork Repository. + echo "http://creativecommons.org/licenses/by-sa/3.0/" + ;; + + '--copyright-year' ) + + local FILE='' + local YEAR='' + + # Define default copyright file. The place the copyright + # information is retrived from. + FILE="$(echo $TEMPLATE \ + | sed -r "s!(Themes/Models/${THEMEMODEL}).+!\1/copyright.txt!")" + + # Define default copyright year. + if [[ -f $FILE ]];then + YEAR=$(cli_readFileContent "${FILE}" '--copyright-year') + else + YEAR=$(date +%Y) + fi + + # Output default copyright year. + echo $YEAR + ;; + + '--copyright-holder' | * ) + + local FILE='' + local HOLDER='' + + # Define default copyright file. The place the copyright + # information is retrived from. + FILE="$(echo $TEMPLATE \ + | sed -r "s!(Themes/Models/${THEMEMODEL}).+!\1/copyright.txt!")" + + # Define default copyright holder. + if [[ -f $FILE ]];then + HOLDER=$(cli_readFileContent "${FILE}" '--copyright-holder') + else + HOLDER="The CentOS Project. `gettext "All rights reserved."`" + fi + + # Output default copyright holder. + echo $HOLDER + ;; + + esac + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getCountryCodes.sh b/Scripts/Bash/centos-art/Functions/cli_getCountryCodes.sh new file mode 100755 index 0000000..d32822d --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getCountryCodes.sh @@ -0,0 +1,277 @@ +#!/bin/bash +# +# cli_getCountryCodes.sh -- This function outputs a list with country +# codes as defined in ISO3166 standard. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getCountryCodes { + + local FILTER="$(echo $1 | cut -d_ -f2)" + + COUNTRYCODES='AD + AE + AF + AG + AI + AL + AM + AN + AO + AQ + AR + AS + AT + AU + AW + AZ + BA + BB + BD + BE + BF + BG + BH + BI + BJ + BM + BN + BO + BR + BS + BT + BV + BW + BY + BZ + CA + CC + CD + CF + CG + CH + CI + CK + CL + CM + CN + CO + CR + CS + CU + CV + CX + CY + CZ + DE + DJ + DK + DM + DO + DZ + EC + EE + EG + EH + ER + ES + ET + FI + FJ + FK + FM + FO + FR + GA + GB + GD + GE + GF + GH + GI + GL + GM + GN + GP + GQ + GR + GS + GT + GU + GW + GY + HK + HM + HN + HR + HT + HU + ID + IE + IL + IN + IO + IQ + IR + IS + IT + JM + JO + JP + KE + KG + KH + KI + KM + KN + KP + KR + KW + KY + KZ + LA + LB + LC + LI + LK + LR + LS + LT + LU + LV + LY + MA + MC + MD + MG + MH + MK + ML + MM + MN + MO + MP + MQ + MR + MS + MT + MU + MV + MW + MX + MY + MZ + NA + NC + NE + NF + NG + NI + NL + NO + NP + NR + NU + NZ + OM + PA + PE + PF + PG + PH + PK + PL + PM + PN + PR + PS + PT + PW + PY + QA + RE + RO + RU + RW + SA + SB + SC + SD + SE + SG + SH + SI + SJ + SK + SL + SM + SN + SO + SR + ST + SV + SY + SZ + TC + TD + TF + TG + TH + TJ + TK + TL + TM + TN + TO + TR + TT + TV + TW + TZ + UA + UG + UM + US + UY + UZ + VA + VC + VE + VG + VI + VN + VU + WF + WS + YE + YT + ZA + ZM + ZW' + + if [[ $FILTER != '' ]];then + echo $COUNTRYCODES | egrep "$FILTER" + else + echo "$COUNTRYCODES" + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getCountryName.sh b/Scripts/Bash/centos-art/Functions/cli_getCountryName.sh new file mode 100755 index 0000000..4c82e00 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getCountryName.sh @@ -0,0 +1,759 @@ +#!/bin/bash +# +# cli_getCountryName.sh -- This function reads one language locale +# code in the format LL_CC and outputs the name of its related +# country. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getCountryName { + + local LOCALECODE="$(echo $1 | cut -d_ -f2)" + local COUNTRYNAME="" + + case $LOCALECODE in + + 'AD' ) + COUNTRYNAME="`gettext "Andorra"`" + ;; + 'AE' ) + COUNTRYNAME="`gettext "United Arab Emirates"`" + ;; + 'AF' ) + COUNTRYNAME="`gettext "Afghanistan"`" + ;; + 'AG' ) + COUNTRYNAME="`gettext "Antigua and Barbuda"`" + ;; + 'AI' ) + COUNTRYNAME="`gettext "Anguilla"`" + ;; + 'AL' ) + COUNTRYNAME="`gettext "Albania"`" + ;; + 'AM' ) + COUNTRYNAME="`gettext "Armenia"`" + ;; + 'AN' ) + COUNTRYNAME="`gettext "Netherlands Antilles"`" + ;; + 'AO' ) + COUNTRYNAME="`gettext "Angola"`" + ;; + 'AQ' ) + COUNTRYNAME="`gettext "Antarctica"`" + ;; + 'AR' ) + COUNTRYNAME="`gettext "Argentina"`" + ;; + 'AS' ) + COUNTRYNAME="`gettext "Samoa (American)"`" + ;; + 'AT' ) + COUNTRYNAME="`gettext "Austria"`" + ;; + 'AU' ) + COUNTRYNAME="`gettext "Australia"`" + ;; + 'AW' ) + COUNTRYNAME="`gettext "Aruba"`" + ;; + 'AZ' ) + COUNTRYNAME="`gettext "Azerbaijan"`" + ;; + 'BA' ) + COUNTRYNAME="`gettext "Bosnia and Herzegovina"`" + ;; + 'BB' ) + COUNTRYNAME="`gettext "Barbados"`" + ;; + 'BD' ) + COUNTRYNAME="`gettext "Bangladesh"`" + ;; + 'BE' ) + COUNTRYNAME="`gettext "Belgium"`" + ;; + 'BF' ) + COUNTRYNAME="`gettext "Burkina Faso"`" + ;; + 'BG' ) + COUNTRYNAME="`gettext "Bulgaria"`" + ;; + 'BH' ) + COUNTRYNAME="`gettext "Bahrain"`" + ;; + 'BI' ) + COUNTRYNAME="`gettext "Burundi"`" + ;; + 'BJ' ) + COUNTRYNAME="`gettext "Benin"`" + ;; + 'BM' ) + COUNTRYNAME="`gettext "Bermuda"`" + ;; + 'BN' ) + COUNTRYNAME="`gettext "Brunei"`" + ;; + 'BO' ) + COUNTRYNAME="`gettext "Bolivia"`" + ;; + 'BR' ) + COUNTRYNAME="`gettext "Brazil"`" + ;; + 'BS' ) + COUNTRYNAME="`gettext "Bahamas"`" + ;; + 'BT' ) + COUNTRYNAME="`gettext "Bhutan"`" + ;; + 'BV' ) + COUNTRYNAME="`gettext "Bouvet Island"`" + ;; + 'BW' ) + COUNTRYNAME="`gettext "Botswana"`" + ;; + 'BY' ) + COUNTRYNAME="`gettext "Belarus"`" + ;; + 'BZ' ) + COUNTRYNAME="`gettext "Belize"`" + ;; + 'CA' ) + COUNTRYNAME="`gettext "Canada"`" + ;; + 'CC' ) + COUNTRYNAME="`gettext "Cocos (Keeling) Islands"`" + ;; + 'CD' ) + COUNTRYNAME="`gettext "Congo (Dem. Rep.)"`" + ;; + 'CF' ) + COUNTRYNAME="`gettext "Central African Rep."`" + ;; + 'CG' ) + COUNTRYNAME="`gettext "Congo (Rep.)"`" + ;; + 'CH' ) + COUNTRYNAME="`gettext "Switzerland"`" + ;; + 'CI' ) + COUNTRYNAME="`gettext "Co^te d'Ivoire"`" + ;; + 'CK' ) + COUNTRYNAME="`gettext "Cook Islands"`" + ;; + 'CL' ) + COUNTRYNAME="`gettext "Chile"`" + ;; + 'CM' ) + COUNTRYNAME="`gettext "Cameroon"`" + ;; + 'CN' ) + COUNTRYNAME="`gettext "China"`" + ;; + 'CO' ) + COUNTRYNAME="`gettext "Colombia"`" + ;; + 'CR' ) + COUNTRYNAME="`gettext "Costa Rica"`" + ;; + 'CS' ) + COUNTRYNAME="`gettext "Serbia and Montenegro"`" + ;; + 'CU' ) + COUNTRYNAME="`gettext "Cuba"`" + ;; + 'CV' ) + COUNTRYNAME="`gettext "Cape Verde"`" + ;; + 'CX' ) + COUNTRYNAME="`gettext "Christmas Island"`" + ;; + 'CY' ) + COUNTRYNAME="`gettext "Cyprus"`" + ;; + 'CZ' ) + COUNTRYNAME="`gettext "Czech Republic"`" + ;; + 'DE' ) + COUNTRYNAME="`gettext "Germany"`" + ;; + 'DJ' ) + COUNTRYNAME="`gettext "Djibouti"`" + ;; + 'DK' ) + COUNTRYNAME="`gettext "Denmark"`" + ;; + 'DM' ) + COUNTRYNAME="`gettext "Dominica"`" + ;; + 'DO' ) + COUNTRYNAME="`gettext "Dominican Republic"`" + ;; + 'DZ' ) + COUNTRYNAME="`gettext "Algeria"`" + ;; + 'EC' ) + COUNTRYNAME="`gettext "Ecuador"`" + ;; + 'EE' ) + COUNTRYNAME="`gettext "Estonia"`" + ;; + 'EG' ) + COUNTRYNAME="`gettext "Egypt"`" + ;; + 'EH' ) + COUNTRYNAME="`gettext "Western Sahara"`" + ;; + 'ER' ) + COUNTRYNAME="`gettext "Eritrea"`" + ;; + 'ES' ) + COUNTRYNAME="`gettext "Spain"`" + ;; + 'ET' ) + COUNTRYNAME="`gettext "Ethiopia"`" + ;; + 'FI' ) + COUNTRYNAME="`gettext "Finland"`" + ;; + 'FJ' ) + COUNTRYNAME="`gettext "Fiji"`" + ;; + 'FK' ) + COUNTRYNAME="`gettext "Falkland Islands"`" + ;; + 'FM' ) + COUNTRYNAME="`gettext "Micronesia"`" + ;; + 'FO' ) + COUNTRYNAME="`gettext "Faeroe Islands"`" + ;; + 'FR' ) + COUNTRYNAME="`gettext "France"`" + ;; + 'GA' ) + COUNTRYNAME="`gettext "Gabon"`" + ;; + 'GB' ) + COUNTRYNAME="`gettext "Britain (UK)"`" + ;; + 'GD' ) + COUNTRYNAME="`gettext "Grenada"`" + ;; + 'GE' ) + COUNTRYNAME="`gettext "Georgia"`" + ;; + 'GF' ) + COUNTRYNAME="`gettext "French Guiana"`" + ;; + 'GH' ) + COUNTRYNAME="`gettext "Ghana"`" + ;; + 'GI' ) + COUNTRYNAME="`gettext "Gibraltar"`" + ;; + 'GL' ) + COUNTRYNAME="`gettext "Greenland"`" + ;; + 'GM' ) + COUNTRYNAME="`gettext "Gambia"`" + ;; + 'GN' ) + COUNTRYNAME="`gettext "Guinea"`" + ;; + 'GP' ) + COUNTRYNAME="`gettext "Guadeloupe"`" + ;; + 'GQ' ) + COUNTRYNAME="`gettext "Equatorial Guinea"`" + ;; + 'GR' ) + COUNTRYNAME="`gettext "Greece"`" + ;; + 'GS' ) + COUNTRYNAME="`gettext "South Georgia and the South Sandwich Islands"`" + ;; + 'GT' ) + COUNTRYNAME="`gettext "Guatemala"`" + ;; + 'GU' ) + COUNTRYNAME="`gettext "Guam"`" + ;; + 'GW' ) + COUNTRYNAME="`gettext "Guinea-Bissau"`" + ;; + 'GY' ) + COUNTRYNAME="`gettext "Guyana"`" + ;; + 'HK' ) + COUNTRYNAME="`gettext "Hong Kong"`" + ;; + 'HM' ) + COUNTRYNAME="`gettext "Heard Island and McDonald Islands"`" + ;; + 'HN' ) + COUNTRYNAME="`gettext "Honduras"`" + ;; + 'HR' ) + COUNTRYNAME="`gettext "Croatia"`" + ;; + 'HT' ) + COUNTRYNAME="`gettext "Haiti"`" + ;; + 'HU' ) + COUNTRYNAME="`gettext "Hungary"`" + ;; + 'ID' ) + COUNTRYNAME="`gettext "Indonesia"`" + ;; + 'IE' ) + COUNTRYNAME="`gettext "Ireland"`" + ;; + 'IL' ) + COUNTRYNAME="`gettext "Israel"`" + ;; + 'IN' ) + COUNTRYNAME="`gettext "India"`" + ;; + 'IO' ) + COUNTRYNAME="`gettext "British Indian Ocean Territory"`" + ;; + 'IQ' ) + COUNTRYNAME="`gettext "Iraq"`" + ;; + 'IR' ) + COUNTRYNAME="`gettext "Iran"`" + ;; + 'IS' ) + COUNTRYNAME="`gettext "Iceland"`" + ;; + 'IT' ) + COUNTRYNAME="`gettext "Italy"`" + ;; + 'JM' ) + COUNTRYNAME="`gettext "Jamaica"`" + ;; + 'JO' ) + COUNTRYNAME="`gettext "Jordan"`" + ;; + 'JP' ) + COUNTRYNAME="`gettext "Japan"`" + ;; + 'KE' ) + COUNTRYNAME="`gettext "Kenya"`" + ;; + 'KG' ) + COUNTRYNAME="`gettext "Kyrgyzstan"`" + ;; + 'KH' ) + COUNTRYNAME="`gettext "Cambodia"`" + ;; + 'KI' ) + COUNTRYNAME="`gettext "Kiribati"`" + ;; + 'KM' ) + COUNTRYNAME="`gettext "Comoros"`" + ;; + 'KN' ) + COUNTRYNAME="`gettext "St Kitts and Nevis"`" + ;; + 'KP' ) + COUNTRYNAME="`gettext "Korea (North)"`" + ;; + 'KR' ) + COUNTRYNAME="`gettext "Korea (South)"`" + ;; + 'KW' ) + COUNTRYNAME="`gettext "Kuwait"`" + ;; + 'KY' ) + COUNTRYNAME="`gettext "Cayman Islands"`" + ;; + 'KZ' ) + COUNTRYNAME="`gettext "Kazakhstan"`" + ;; + 'LA' ) + COUNTRYNAME="`gettext "Laos"`" + ;; + 'LB' ) + COUNTRYNAME="`gettext "Lebanon"`" + ;; + 'LC' ) + COUNTRYNAME="`gettext "St Lucia"`" + ;; + 'LI' ) + COUNTRYNAME="`gettext "Liechtenstein"`" + ;; + 'LK' ) + COUNTRYNAME="`gettext "Sri Lanka"`" + ;; + 'LR' ) + COUNTRYNAME="`gettext "Liberia"`" + ;; + 'LS' ) + COUNTRYNAME="`gettext "Lesotho"`" + ;; + 'LT' ) + COUNTRYNAME="`gettext "Lithuania"`" + ;; + 'LU' ) + COUNTRYNAME="`gettext "Luxembourg"`" + ;; + 'LV' ) + COUNTRYNAME="`gettext "Latvia"`" + ;; + 'LY' ) + COUNTRYNAME="`gettext "Libya"`" + ;; + 'MA' ) + COUNTRYNAME="`gettext "Morocco"`" + ;; + 'MC' ) + COUNTRYNAME="`gettext "Monaco"`" + ;; + 'MD' ) + COUNTRYNAME="`gettext "Moldova"`" + ;; + 'MG' ) + COUNTRYNAME="`gettext "Madagascar"`" + ;; + 'MH' ) + COUNTRYNAME="`gettext "Marshall Islands"`" + ;; + 'MK' ) + COUNTRYNAME="`gettext "Macedonia"`" + ;; + 'ML' ) + COUNTRYNAME="`gettext "Mali"`" + ;; + 'MM' ) + COUNTRYNAME="`gettext "Myanmar (Burma)"`" + ;; + 'MN' ) + COUNTRYNAME="`gettext "Mongolia"`" + ;; + 'MO' ) + COUNTRYNAME="`gettext "Macao"`" + ;; + 'MP' ) + COUNTRYNAME="`gettext "Northern Mariana Islands"`" + ;; + 'MQ' ) + COUNTRYNAME="`gettext "Martinique"`" + ;; + 'MR' ) + COUNTRYNAME="`gettext "Mauritania"`" + ;; + 'MS' ) + COUNTRYNAME="`gettext "Montserrat"`" + ;; + 'MT' ) + COUNTRYNAME="`gettext "Malta"`" + ;; + 'MU' ) + COUNTRYNAME="`gettext "Mauritius"`" + ;; + 'MV' ) + COUNTRYNAME="`gettext "Maldives"`" + ;; + 'MW' ) + COUNTRYNAME="`gettext "Malawi"`" + ;; + 'MX' ) + COUNTRYNAME="`gettext "Mexico"`" + ;; + 'MY' ) + COUNTRYNAME="`gettext "Malaysia"`" + ;; + 'MZ' ) + COUNTRYNAME="`gettext "Mozambique"`" + ;; + 'NA' ) + COUNTRYNAME="`gettext "Namibia"`" + ;; + 'NC' ) + COUNTRYNAME="`gettext "New Caledonia"`" + ;; + 'NE' ) + COUNTRYNAME="`gettext "Niger"`" + ;; + 'NF' ) + COUNTRYNAME="`gettext "Norfolk Island"`" + ;; + 'NG' ) + COUNTRYNAME="`gettext "Nigeria"`" + ;; + 'NI' ) + COUNTRYNAME="`gettext "Nicaragua"`" + ;; + 'NL' ) + COUNTRYNAME="`gettext "Netherlands"`" + ;; + 'NO' ) + COUNTRYNAME="`gettext "Norway"`" + ;; + 'NP' ) + COUNTRYNAME="`gettext "Nepal"`" + ;; + 'NR' ) + COUNTRYNAME="`gettext "Nauru"`" + ;; + 'NU' ) + COUNTRYNAME="`gettext "Niue"`" + ;; + 'NZ' ) + COUNTRYNAME="`gettext "New Zealand"`" + ;; + 'OM' ) + COUNTRYNAME="`gettext "Oman"`" + ;; + 'PA' ) + COUNTRYNAME="`gettext "Panama"`" + ;; + 'PE' ) + COUNTRYNAME="`gettext "Peru"`" + ;; + 'PF' ) + COUNTRYNAME="`gettext "French Polynesia"`" + ;; + 'PG' ) + COUNTRYNAME="`gettext "Papua New Guinea"`" + ;; + 'PH' ) + COUNTRYNAME="`gettext "Philippines"`" + ;; + 'PK' ) + COUNTRYNAME="`gettext "Pakistan"`" + ;; + 'PL' ) + COUNTRYNAME="`gettext "Poland"`" + ;; + 'PM' ) + COUNTRYNAME="`gettext "St Pierre and Miquelon"`" + ;; + 'PN' ) + COUNTRYNAME="`gettext "Pitcairn"`" + ;; + 'PR' ) + COUNTRYNAME="`gettext "Puerto Rico"`" + ;; + 'PS' ) + COUNTRYNAME="`gettext "Palestine"`" + ;; + 'PT' ) + COUNTRYNAME="`gettext "Portugal"`" + ;; + 'PW' ) + COUNTRYNAME="`gettext "Palau"`" + ;; + 'PY' ) + COUNTRYNAME="`gettext "Paraguay"`" + ;; + 'QA' ) + COUNTRYNAME="`gettext "Qatar"`" + ;; + 'RE' ) + COUNTRYNAME="`gettext "Reunion"`" + ;; + 'RO' ) + COUNTRYNAME="`gettext "Romania"`" + ;; + 'RU' ) + COUNTRYNAME="`gettext "Russia"`" + ;; + 'RW' ) + COUNTRYNAME="`gettext "Rwanda"`" + ;; + 'SA' ) + COUNTRYNAME="`gettext "Saudi Arabia"`" + ;; + 'SB' ) + COUNTRYNAME="`gettext "Solomon Islands"`" + ;; + 'SC' ) + COUNTRYNAME="`gettext "Seychelles"`" + ;; + 'SD' ) + COUNTRYNAME="`gettext "Sudan"`" + ;; + 'SE' ) + COUNTRYNAME="`gettext "Sweden"`" + ;; + 'SG' ) + COUNTRYNAME="`gettext "Singapore"`" + ;; + 'SH' ) + COUNTRYNAME="`gettext "St Helena"`" + ;; + 'SI' ) + COUNTRYNAME="`gettext "Slovenia"`" + ;; + 'SJ' ) + COUNTRYNAME="`gettext "Svalbard and Jan Mayen"`" + ;; + 'SK' ) + COUNTRYNAME="`gettext "Slovakia"`" + ;; + 'SL' ) + COUNTRYNAME="`gettext "Sierra Leone"`" + ;; + 'SM' ) + COUNTRYNAME="`gettext "San Marino"`" + ;; + 'SN' ) + COUNTRYNAME="`gettext "Senegal"`" + ;; + 'SO' ) + COUNTRYNAME="`gettext "Somalia"`" + ;; + 'SR' ) + COUNTRYNAME="`gettext "Suriname"`" + ;; + 'ST' ) + COUNTRYNAME="`gettext "Sao Tome and Principe"`" + ;; + 'SV' ) + COUNTRYNAME="`gettext "El Salvador"`" + ;; + 'SY' ) + COUNTRYNAME="`gettext "Syria"`" + ;; + 'SZ' ) + COUNTRYNAME="`gettext "Swaziland"`" + ;; + 'TC' ) + COUNTRYNAME="`gettext "Turks and Caicos Islands"`" + ;; + 'TD' ) + COUNTRYNAME="`gettext "Chad"`" + ;; + 'TF' ) + COUNTRYNAME="`gettext "French Southern and Antarctic Lands"`" + ;; + 'TG' ) + COUNTRYNAME="`gettext "Togo"`" + ;; + 'TH' ) + COUNTRYNAME="`gettext "Thailand"`" + ;; + 'TJ' ) + COUNTRYNAME="`gettext "Tajikistan"`" + ;; + 'TK' ) + COUNTRYNAME="`gettext "Tokelau"`" + ;; + 'TL' ) + COUNTRYNAME="`gettext "Timor-Leste"`" + ;; + 'TM' ) + COUNTRYNAME="`gettext "Turkmenistan"`" + ;; + 'TN' ) + COUNTRYNAME="`gettext "Tunisia"`" + ;; + 'TO' ) + COUNTRYNAME="`gettext "Tonga"`" + ;; + 'TR' ) + COUNTRYNAME="`gettext "Turkey"`" + ;; + 'TT' ) + COUNTRYNAME="`gettext "Trinidad and Tobago"`" + ;; + 'TV' ) + COUNTRYNAME="`gettext "Tuvalu"`" + ;; + 'TW' ) + COUNTRYNAME="`gettext "Taiwan"`" + ;; + 'TZ' ) + COUNTRYNAME="`gettext "Tanzania"`" + ;; + 'UA' ) + COUNTRYNAME="`gettext "Ukraine"`" + ;; + 'UG' ) + COUNTRYNAME="`gettext "Uganda"`" + ;; + 'UM' ) + COUNTRYNAME="`gettext "US minor outlying islands"`" + ;; + 'US' ) + COUNTRYNAME="`gettext "United States"`" + ;; + 'UY' ) + COUNTRYNAME="`gettext "Uruguay"`" + ;; + 'UZ' ) + COUNTRYNAME="`gettext "Uzbekistan"`" + ;; + 'VA' ) + COUNTRYNAME="`gettext "Vatican City"`" + ;; + 'VC' ) + COUNTRYNAME="`gettext "St Vincent"`" + ;; + 'VE' ) + COUNTRYNAME="`gettext "Venezuela"`" + ;; + 'VG' ) + COUNTRYNAME="`gettext "Virgin Islands (UK)"`" + ;; + 'VI' ) + COUNTRYNAME="`gettext "Virgin Islands (US)"`" + ;; + 'VN' ) + COUNTRYNAME="`gettext "Vietnam"`" + ;; + 'VU' ) + COUNTRYNAME="`gettext "Vanuatu"`" + ;; + 'WF' ) + COUNTRYNAME="`gettext "Wallis and Futuna"`" + ;; + 'WS' ) + COUNTRYNAME="`gettext "Samoa (Western)"`" + ;; + 'YE' ) + COUNTRYNAME="`gettext "Yemen"`" + ;; + 'YT' ) + COUNTRYNAME="`gettext "Mayotte"`" + ;; + 'ZA' ) + COUNTRYNAME="`gettext "South Africa"`" + ;; + 'ZM' ) + COUNTRYNAME="`gettext "Zambia"`" + ;; + 'ZW' ) + COUNTRYNAME="`gettext "Zimbabwe"`" + ;; + * ) + COUNTRYNAME="`gettext "Unknown"`" + + esac + + echo $COUNTRYNAME + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getCurrentLocale.sh b/Scripts/Bash/centos-art/Functions/cli_getCurrentLocale.sh new file mode 100755 index 0000000..3a44fb3 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getCurrentLocale.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# cli_getCurrentLocale.sh -- This function checks LANG environment +# variable and returns the current locale information in the LL_CC +# format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getCurrentLocale { + + local CURRENTLOCALE='' + local OPTION="$1" + + # Redefine current locale using LL_CC format. + CURRENTLOCALE=$(echo $LANG | sed -r 's!(^[a-z]{2,3}_[A-Z]{2}).+$!\1!') + + # Define centos-art.sh script default current locale. If + # centos-art.sh script doesn't support current system locale, use + # English language from United States as default current locale. + if [[ $CURRENTLOCALE == '' ]];then + CURRENTLOCALE='en_US' + fi + + # Output current locale. + case $OPTION in + + '--langcode-only' ) + echo "${CURRENTLOCALE}" | cut -d_ -f1 + ;; + + '--langcode-and-countrycode'| * ) + echo "${CURRENTLOCALE}" + ;; + esac +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getFilesList.sh b/Scripts/Bash/centos-art/Functions/cli_getFilesList.sh new file mode 100755 index 0000000..679cec5 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getFilesList.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# cli_getFilesList.sh -- This function defines the list of FILES to +# process. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getFilesList { + + local LOCATION='' + local FILTER='' + local FILES='' + + # If first argument is provided to cli_getFilesList, use it as + # default location. Otherwise, if first argument is not provided, + # location takes the action value (ACTIONVAL) as default. + if [[ "$1" != '' ]];then + LOCATION="$1" + else + LOCATION="$ACTIONVAL" + fi + + # If second argument is provided to cli_getFilesList, use it as + # default extension to look for files. Otherwise, if second + # argument is not provided, use flag filter instead. + if [[ "$2" != '' ]];then + FILTER="$2" + else + FILTER="$FLAG_FILTER" + fi + + # Define filter as regular expression pattern. When we use regular + # expressions with find, regular expressions are evaluated against + # the whole file path. This way, when the regular expression is + # specified, we need to build it in a way that matches the whole + # path. Doing so, everytime we pass the `--filter' option in the + # command-line might be a tedious task. Instead, in the sake of + # reducing some typing, we prepare the regular expression here to + # match the whole path using the regular expression provided by + # the user as pattern. + FILTER="^${LOCATION}/${FILTER}$" + + # Define list of files to process. + if [[ -d $LOCATION ]];then + FILES=$(find $LOCATION -regextype posix-egrep -type f -regex "${FILTER}" | sort) + elif [[ -f $LOCATION ]];then + FILES=$LOCATION + fi + + # Output list of files to process. + echo "$FILES" + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getFunctions.sh b/Scripts/Bash/centos-art/Functions/cli_getFunctions.sh new file mode 100644 index 0000000..375b552 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getFunctions.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# cli_getFunctions.sh -- This function loads funtionalities supported by +# centos-art.sh script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getFunctions { + + # Define variables as local to avoid conflicts outside. + local FUNCNAMCALL='' + local FUNCFILES='' + + # Build action-specifc script file list. + FUNCFILES=$(ls ${FUNCDIR}/${FUNCDIRNAM}/${FUNCNAM}*.sh) + + for FILE in $FUNCFILES;do + + if [[ -x ${FILE} ]];then + + # Initialize action-specific functions. + . $FILE + + # Export action-specific functions to current shell script + # environment. + FUNCNAMCALL=$(grep '^function ' $FILE | cut -d' ' -f2) + export -f $FUNCNAMCALL + + else + + cli_printMessage "`eval_gettext "The \\\$FILE hasn't execution rights."`" 'AsErrorLine' + cli_printMessage "$(caller)" "AsToKnowMoreLine" + + fi + + done + + # Execute action passed to centos-art.sh script. + if [[ $FUNCNAM != '' ]];then + eval $FUNCNAM + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getLangCodes.sh b/Scripts/Bash/centos-art/Functions/cli_getLangCodes.sh new file mode 100755 index 0000000..2c46d9b --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getLangCodes.sh @@ -0,0 +1,223 @@ +#!/bin/bash +# +# cli_getLangCodes.sh -- This function outputs a list with language +# codes as defined in ISO639 standard. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getLangCodes { + + local FILTER="$(echo $1 | cut -d_ -f1)" + + LANGCODES="aa + ab + ae + af + ak + am + an + ar + as + av + ay + az + ba + be + bg + bh + bi + bm + bn + bo + br + bs + ca + ce + ch + co + cr + cs + cu + cv + cy + da + de + dv + dz + ee + el + en + eo + es + et + eu + fa + ff + fi + fj + fo + fr + fy + ga + gd + gl + gn + gu + gv + ha + he + hi + ho + hr + ht + hu + hy + hz + ia + id + ie + ig + ii + ik + io + is + it + iu + ja + jv + ka + kg + ki + kj + kk + kl + km + kn + ko + kr + ks + ku + kv + kw + ky + la + lb + lg + li + ln + lo + lt + lu + lv + mg + mh + mi + mk + ml + mn + mo + mr + ms + mt + my + na + nb + nd + ne + ng + nl + nn + no + nr + nv + ny + oc + oj + om + or + os + pa + pi + pl + ps + pt + qu + rm + rn + ro + ru + rw + sa + sc + sd + se + sg + si + sk + sl + sm + sn + so + sq + sr + ss + st + su + sv + sw + ta + te + tg + th + ti + tk + tl + tn + to + tr + ts + tt + tw + ty + ug + uk + ur + uz + ve + vi + vo + wa + wo + xh + yi + yo + za + zh + zu" + + if [[ $FILTER != '' ]];then + echo "$LANGCODES" | egrep "$FILTER" | sed -r 's![[:space:]]+!!g' + else + echo "$LANGCODES" + fi + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getLangName.sh b/Scripts/Bash/centos-art/Functions/cli_getLangName.sh new file mode 100755 index 0000000..e49f116 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getLangName.sh @@ -0,0 +1,781 @@ +#!/bin/bash +# +# cli_getLangName.sh -- This function reads one language locale code +# in the format LL_CC and outputs its language name. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getLangName { + + local LANGCODE="$(echo "$1" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]')" + local LANGNAME='' + + case $LANGCODE in + + 'aa' ) + LANGNAME="`gettext "Afar"`" + ;; + + 'ab' ) + LANGNAME="`gettext "Abkhazian"`" + ;; + + 'ae' ) + LANGNAME="`gettext "Avestan"`" + ;; + + 'af' ) + LANGNAME="`gettext "Afrikaans"`" + ;; + + 'ak' ) + LANGNAME="`gettext "Akan"`" + ;; + + 'am' ) + LANGNAME="`gettext "Amharic"`" + ;; + + 'an' ) + LANGNAME="`gettext "Aragonese"`" + ;; + + 'ar' ) + LANGNAME="`gettext "Arabic"`" + ;; + + 'as' ) + LANGNAME="`gettext "Assamese"`" + ;; + + 'av' ) + LANGNAME="`gettext "Avaric"`" + ;; + + 'ay' ) + LANGNAME="`gettext "Aymara"`" + ;; + + 'az' ) + LANGNAME="`gettext "Azerbaijani"`" + ;; + + 'ba' ) + LANGNAME="`gettext "Bashkir"`" + ;; + + 'be' ) + LANGNAME="`gettext "Byelorussian"`" + ;; + + 'bg' ) + LANGNAME="`gettext "Bulgarian"`" + ;; + + 'bh' ) + LANGNAME="`gettext "Bihari"`" + ;; + + 'bi' ) + LANGNAME="`gettext "Bislama"`" + ;; + + 'bm' ) + LANGNAME="`gettext "Bambara"`" + ;; + + 'bn' ) + LANGNAME="`gettext "Bengali"`" + ;; + + 'bo' ) + LANGNAME="`gettext "Tibetan"`" + ;; + + 'br' ) + LANGNAME="`gettext "Breton"`" + ;; + + 'bs' ) + LANGNAME="`gettext "Bosnian"`" + ;; + + 'ca' ) + LANGNAME="`gettext "Catalan"`" + ;; + + 'ce' ) + LANGNAME="`gettext "Chechen"`" + ;; + + 'ch' ) + LANGNAME="`gettext "Chamorro"`" + ;; + + 'co' ) + LANGNAME="`gettext "Corsican"`" + ;; + + 'cr' ) + LANGNAME="`gettext "Cree"`" + ;; + + 'cs' ) + LANGNAME="`gettext "Czech"`" + ;; + + 'cu' ) + LANGNAME="`gettext "Church Slavic"`" + ;; + + 'cv' ) + LANGNAME="`gettext "Chuvash"`" + ;; + + 'cy' ) + LANGNAME="`gettext "Welsh"`" + ;; + + 'da' ) + LANGNAME="`gettext "Danish"`" + ;; + + 'de' ) + LANGNAME="`gettext "German"`" + ;; + + 'dv' ) + LANGNAME="`gettext "Divehi"`" + ;; + + 'dz' ) + LANGNAME="`gettext "Dzongkha"`" + ;; + + 'ee' ) + LANGNAME="`gettext "E'we"`" + ;; + + 'el' ) + LANGNAME="`gettext "Greek"`" + ;; + + 'en' ) + LANGNAME="`gettext "English"`" + ;; + + 'eo' ) + LANGNAME="`gettext "Esperanto"`" + ;; + + 'es' ) + LANGNAME="`gettext "Spanish"`" + ;; + + 'et' ) + LANGNAME="`gettext "Estonian"`" + ;; + + 'eu' ) + LANGNAME="`gettext "Basque"`" + ;; + 'fa' ) + LANGNAME="`gettext "Persian"`" + ;; + + 'ff' ) + LANGNAME="`gettext "Fulah"`" + ;; + + 'fi' ) + LANGNAME="`gettext "Finnish"`" + ;; + + 'fj' ) + LANGNAME="`gettext "Fijian"`" + ;; + + 'fo' ) + LANGNAME="`gettext "Faroese"`" + ;; + + 'fr' ) + LANGNAME="`gettext "French"`" + ;; + + 'fy' ) + LANGNAME="`gettext "Frisian"`" + ;; + + 'ga' ) + LANGNAME="`gettext "Irish"`" + ;; + + 'gd' ) + LANGNAME="`gettext "Scots"`" + ;; + + 'gl' ) + LANGNAME="`gettext "Gallegan"`" + ;; + + 'gn' ) + LANGNAME="`gettext "Guarani"`" + ;; + + 'gu' ) + LANGNAME="`gettext "Gujarati"`" + ;; + + 'gv' ) + LANGNAME="`gettext "Manx"`" + ;; + + 'ha' ) + LANGNAME="`gettext "Hausa"`" + ;; + + 'he' ) + LANGNAME="`gettext "Hebrew"`" + ;; + + 'hi' ) + LANGNAME="`gettext "Hindi"`" + ;; + + 'ho' ) + LANGNAME="`gettext "Hiri Motu"`" + ;; + + 'hr' ) + LANGNAME="`gettext "Croatian"`" + ;; + + 'ht' ) + LANGNAME="`gettext "Haitian"`" + ;; + + 'hu' ) + LANGNAME="`gettext "Hungarian"`" + ;; + + 'hy' ) + LANGNAME="`gettext "Armenian"`" + ;; + + 'hz' ) + LANGNAME="`gettext "Herero"`" + ;; + + 'ia' ) + LANGNAME="`gettext "Interlingua"`" + ;; + + 'id' ) + LANGNAME="`gettext "Indonesian"`" + ;; + + 'ie' ) + LANGNAME="`gettext "Interlingue"`" + ;; + + 'ig' ) + LANGNAME="`gettext "Igbo"`" + ;; + + 'ii' ) + LANGNAME="`gettext "Sichuan Yi"`" + ;; + + 'ik' ) + LANGNAME="`gettext "Inupiak"`" + ;; + + 'io' ) + LANGNAME="`gettext "Ido"`" + ;; + + 'is' ) + LANGNAME="`gettext "Icelandic"`" + ;; + + 'it' ) + LANGNAME="`gettext "Italian"`" + ;; + + 'iu' ) + LANGNAME="`gettext "Inuktitut"`" + ;; + + 'ja' ) + LANGNAME="`gettext "Japanese"`" + ;; + + 'jv' ) + LANGNAME="`gettext "Javanese"`" + ;; + + 'ka' ) + LANGNAME="`gettext "Georgian"`" + ;; + + 'kg' ) + LANGNAME="`gettext "Kongo"`" + ;; + + 'ki' ) + LANGNAME="`gettext "Kikuyu"`" + ;; + + 'kj' ) + LANGNAME="`gettext "Kuanyama"`" + ;; + + 'kk' ) + LANGNAME="`gettext "Kazakh"`" + ;; + + 'kl' ) + LANGNAME="`gettext "Kalaallisut"`" + ;; + + 'km' ) + LANGNAME="`gettext "Khmer"`" + ;; + + 'kn' ) + LANGNAME="`gettext "Kannada"`" + ;; + + 'ko' ) + LANGNAME="`gettext "Korean"`" + ;; + + 'kr' ) + LANGNAME="`gettext "Kanuri"`" + ;; + + 'ks' ) + LANGNAME="`gettext "Kashmiri"`" + ;; + + 'ku' ) + LANGNAME="`gettext "Kurdish"`" + ;; + + 'kv' ) + LANGNAME="`gettext "Komi"`" + ;; + + 'kw' ) + LANGNAME="`gettext "Cornish"`" + ;; + + 'ky' ) + LANGNAME="`gettext "Kirghiz"`" + ;; + + 'la' ) + LANGNAME="`gettext "Latin"`" + ;; + + 'lb' ) + LANGNAME="`gettext "Letzeburgesch"`" + ;; + + 'lg' ) + LANGNAME="`gettext "Ganda"`" + ;; + + 'li' ) + LANGNAME="`gettext "Limburgish"`" + ;; + + 'ln' ) + LANGNAME="`gettext "Lingala"`" + ;; + + 'lo' ) + LANGNAME="`gettext "Lao"`" + ;; + + 'lt' ) + LANGNAME="`gettext "Lithuanian"`" + ;; + + 'lu' ) + LANGNAME="`gettext "Luba-Katanga"`" + ;; + + 'lv' ) + LANGNAME="`gettext "Latvian"`" + ;; + + 'mg' ) + LANGNAME="`gettext "Malagasy"`" + ;; + + 'mh' ) + LANGNAME="`gettext "Marshall"`" + ;; + + 'mi' ) + LANGNAME="`gettext "Maori"`" + ;; + + 'mk' ) + LANGNAME="`gettext "Macedonian"`" + ;; + + 'ml' ) + LANGNAME="`gettext "Malayalam"`" + ;; + + 'mn' ) + LANGNAME="`gettext "Mongolian"`" + ;; + + 'mo' ) + LANGNAME="`gettext "Moldavian"`" + ;; + + 'mr' ) + LANGNAME="`gettext "Marathi"`" + ;; + + 'ms' ) + LANGNAME="`gettext "Malay"`" + ;; + + 'mt' ) + LANGNAME="`gettext "Maltese"`" + ;; + + 'my' ) + LANGNAME="`gettext "Burmese"`" + ;; + + 'na' ) + LANGNAME="`gettext "Nauru"`" + ;; + + 'nb' ) + LANGNAME="`gettext "Norwegian Bokmaal"`" + ;; + + 'nd' ) + LANGNAME="`gettext "Ndebele, North"`" + ;; + + 'ne' ) + LANGNAME="`gettext "Nepali"`" + ;; + + 'ng' ) + LANGNAME="`gettext "Ndonga"`" + ;; + + 'nl' ) + LANGNAME="`gettext "Dutch"`" + ;; + + 'nn' ) + LANGNAME="`gettext "Norwegian Nynorsk"`" + ;; + + 'no' ) + LANGNAME="`gettext "Norwegian"`" + ;; + + 'nr' ) + LANGNAME="`gettext "Ndebele, South"`" + ;; + + 'nv' ) + LANGNAME="`gettext "Navajo"`" + ;; + + 'ny' ) + LANGNAME="`gettext "Chichewa"`" + ;; + + 'oc' ) + LANGNAME="`gettext "Occitan"`" + ;; + + 'oj' ) + LANGNAME="`gettext "Ojibwa"`" + ;; + + 'om' ) + LANGNAME="`gettext "(Afan) Oromo"`" + ;; + + 'or' ) + LANGNAME="`gettext "Oriya"`" + ;; + + 'os' ) + LANGNAME="`gettext "Ossetian; Ossetic"`" + ;; + + 'pa' ) + LANGNAME="`gettext "Panjabi; Punjabi"`" + ;; + + 'pi' ) + LANGNAME="`gettext "Pali"`" + ;; + + 'pl' ) + LANGNAME="`gettext "Polish"`" + ;; + + 'ps' ) + LANGNAME="`gettext "Pashto, Pushto"`" + ;; + + 'pt' ) + LANGNAME="`gettext "Portuguese"`" + ;; + + 'qu' ) + LANGNAME="`gettext "Quechua"`" + ;; + + 'rm' ) + LANGNAME="`gettext "Rhaeto-Romance"`" + ;; + + 'rn' ) + LANGNAME="`gettext "Rundi"`" + ;; + + 'ro' ) + LANGNAME="`gettext "Romanian"`" + ;; + + 'ru' ) + LANGNAME="`gettext "Russian"`" + ;; + + 'rw' ) + LANGNAME="`gettext "Kinyarwanda"`" + ;; + + 'sa' ) + LANGNAME="`gettext "Sanskrit"`" + ;; + + 'sc' ) + LANGNAME="`gettext "Sardinian"`" + ;; + + 'sd' ) + LANGNAME="`gettext "Sindhi"`" + ;; + + 'se' ) + LANGNAME="`gettext "Northern Sami"`" + ;; + + 'sg' ) + LANGNAME="`gettext "Sango; Sangro"`" + ;; + + 'si' ) + LANGNAME="`gettext "Sinhalese"`" + ;; + + 'sk' ) + LANGNAME="`gettext "Slovak"`" + ;; + + 'sl' ) + LANGNAME="`gettext "Slovenian"`" + ;; + + 'sm' ) + LANGNAME="`gettext "Samoan"`" + ;; + + 'sn' ) + LANGNAME="`gettext "Shona"`" + ;; + + 'so' ) + LANGNAME="`gettext "Somali"`" + ;; + + 'sq' ) + LANGNAME="`gettext "Albanian"`" + ;; + + 'sr' ) + LANGNAME="`gettext "Serbian"`" + ;; + + 'ss' ) + LANGNAME="`gettext "Swati; Siswati"`" + ;; + + 'st' ) + LANGNAME="`gettext "Sesotho; Sotho, Southern"`" + ;; + + 'su' ) + LANGNAME="`gettext "Sundanese"`" + ;; + + 'sv' ) + LANGNAME="`gettext "Swedish"`" + ;; + + 'sw' ) + LANGNAME="`gettext "Swahili"`" + ;; + + 'ta' ) + LANGNAME="`gettext "Tamil"`" + ;; + + 'te' ) + LANGNAME="`gettext "Telugu"`" + ;; + + 'tg' ) + LANGNAME="`gettext "Tajik"`" + ;; + + 'th' ) + LANGNAME="`gettext "Thai"`" + ;; + + 'ti' ) + LANGNAME="`gettext "Tigrinya"`" + ;; + + 'tk' ) + LANGNAME="`gettext "Turkmen"`" + ;; + + 'tl' ) + LANGNAME="`gettext "Tagalog"`" + ;; + + 'tn' ) + LANGNAME="`gettext "Tswana; Setswana"`" + ;; + + 'to' ) + LANGNAME="`gettext "Tonga (?)"`" + ;; + + 'tr' ) + LANGNAME="`gettext "Turkish"`" + ;; + + 'ts' ) + LANGNAME="`gettext "Tsonga"`" + ;; + + + 'tt' ) + LANGNAME="`gettext "Tatar"`" + ;; + + 'tw' ) + LANGNAME="`gettext "Twi"`" + ;; + + 'ty' ) + LANGNAME="`gettext "Tahitian"`" + ;; + + 'ug' ) + LANGNAME="`gettext "Uighur"`" + ;; + + 'uk' ) + LANGNAME="`gettext "Ukrainian"`" + ;; + + 'ur' ) + LANGNAME="`gettext "Urdu"`" + ;; + + 'uz' ) + LANGNAME="`gettext "Uzbek"`" + ;; + + 've' ) + LANGNAME="`gettext "Venda"`" + ;; + + 'vi' ) + LANGNAME="`gettext "Vietnamese"`" + ;; + + 'vo' ) + LANGNAME="`gettext "Volapuk; Volapuk"`" + ;; + + 'wa' ) + LANGNAME="`gettext "Walloon"`" + ;; + + 'wo' ) + LANGNAME="`gettext "Wolof"`" + ;; + + 'xh' ) + LANGNAME="`gettext "Xhosa"`" + ;; + + 'yi' ) + LANGNAME="`gettext "Yiddish (formerly ji)"`" + ;; + + 'yo' ) + LANGNAME="`gettext "Yoruba"`" + ;; + + 'za' ) + LANGNAME="`gettext "Zhuang"`" + ;; + + 'zh' ) + LANGNAME="`gettext "Chinese"`" + ;; + + 'zu' ) + LANGNAME="`gettext "Zulu"`" + ;; + + * ) + LANGNAME="`gettext "Unknown"`" + + esac + + echo $LANGNAME; +} + diff --git a/Scripts/Bash/centos-art/Functions/cli_getLocales.sh b/Scripts/Bash/centos-art/Functions/cli_getLocales.sh new file mode 100755 index 0000000..e72fc3d --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getLocales.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# cli_getLocales.sh -- This function outputs/verifies locale codes in +# LL and LL_CC format. Combine both ISO639 and ISO3166 specification +# in order to build the final locale list. This function defines which +# translation locales are supported inside CentOS Artwork Repository. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getLocales { + + # Print locales supported by centos-art.sh script. + locale -a | egrep '^[a-z]{2,3}_[A-Z]{2}$' | sort | uniq + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getPathComponent.sh b/Scripts/Bash/centos-art/Functions/cli_getPathComponent.sh new file mode 100755 index 0000000..6d0d078 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getPathComponent.sh @@ -0,0 +1,230 @@ +#!/bin/bash +# +# cli_getPathComponent.sh -- This function evaluates one repository +# path and output parts/components from it. Generally, the path +# information is passed to the function's first positional argument +# and the part/component we want to retrive is passed to the +# function's second positional argument. If second argument is not +# passed, then first argument is assumed to be the part/component we +# want to retrive, and action value (ACTIONVAL) variable is used +# instead as source path information. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getPathComponent { + + local -a PATTERN + local LOCATION='' + local OPTION='' + + # Define location which we retrive information from. + if [[ "$#" -eq 1 ]];then + LOCATION="$ACTIONVAL" + OPTION="$1" + elif [[ "$#" -eq 2 ]];then + LOCATION="$1" + OPTION="$2" + else + cli_printMessage "cli_getPathComponent: `gettext "Invalid arguments."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Define release pattern. + PATTERN[0]="(([[:digit:]]+)(\.([[:digit:]]+)){,1})" + + # Define architecture pattern. Make it match the architectures the + # CentOS distribution is able to be installed on. + PATTERN[1]="(i386|x86_64)" + + # Define theme pattern for trunk, branches, and tags directory + # structures. + # + # trunk: + # ------ + # Themes are made of `Models' and `Motifs'. `Models' controls the + # `Motifs' characteristcs and it is not rendereable. On the other + # hand, `Motifs' controls the theme visual style and do is + # renderable. Since we only need to know the theme name when we + # render something, we take the `Motifs' directory structure as + # reference to find out the theme name we are producing images + # for. + # + # `Motifs' are organized by names, so when we say `a theme name' + # we are really saying `the artistic motif name of a theme', but + # for short `theme name' is used instead. `Models' are also + # organized by names, but we do never use model names to name a + # thame. We always say the `theme models' or `the models of the + # theme` to refere the theme component that controls the + # characteristics of artistic motifs. We never name a thame as its + # model. We use artistic motifs name for such purpose. + # + # Inside artistic motif names, we organize different versions of + # the same artistic motif by means of numerical worklines. + # Worklines, inside trunk, have an integer numerical form and + # begin at `1'. They increment one unit each time a new/fresh + # visual style ---for the same artistic motif--- is conceived. + # + # For example, the Flame theme uses the flame filter of Gimp to + # produce different fractal patterns randomly. We use the flame + # filter to produce different visual styles under the same theme + # since all patterns we produce are based on the same pattern + # (i.e., the random fractal pattern of Gimp's flame filter). This + # way, if you no longer want to produce visual styles from flame + # filter, it is time to create a new artistic motif name for it. + # + # This schema is very convenient for designers and packagers, + # since different designers can create their own worklines and go + # on with them until CentOS distribution release date is close. At + # that time, a workline is selected and tagged for packaging. + # Translators and programmers can continue working indepently, and + # without affection, in their own directory structures. + # + # Example: + # +------> theme name + # |-->| + # trunk/.../Themes/Motifs/Flame/1 + # trunk/.../Themes/Motifs/Flame/2 + # trunk/.../Themes/Motifs/Flame/3 + # | + # +----> theme release version + # + # Sometimes we only need to retrive the theme name, but othertimes + # both the theme name and its work-line is required as well. + # + # branches: + # --------- + # The branch development line is treated just as trunk development + # line does, but we rarely use it since it could be confusing to + # know whether a tag was created from trunk or branches. + # + # Conceive an enumeration schema in order to differentiate + # branches from trunk is not convenient either, it would introduce + # an intermediate point to the final production of tags we would + # need to be aware of. Instead of such configuration, we prefer + # to go straightforward from trunk to tags. + # + # Intermediate branches for quality assurance might be good in + # some situations, but not when we produce themes. We need a + # simple structure, where we could design, render content (using + # centos-art.sh), and release for testing (through tags). If + # something goes wrong in the released tag, it would be fixed in + # trunk and later released in another tagged relase. + # + # Of course, care should be taken to avoid making of trunk + # development line a chaotic place. Everbody should know exactly + # what they are doing therein. We need to design protections to + # isolate possible damages and that way, we could know exactly + # what and where we need to concentrate in and put our time on. + # + # In resume, do not use branches if you don't need to. Use trunk + # development line instead. + # + # tags: + # ----- + # The tag frozen line is mainly used to perform theme releases. + # + # Example: + # +------> theme name + # |-->| + # tags/.../Themes/Motifs/Flame/1.0 + # trunk/.../Themes/Motifs/Flame/1 |--> minor update + # |----> major udpate + # + # Tags have the format X.Z, where X is the first number in the + # name (e.g., `1') and represents the trunk/branches artistic + # motif version. The Z represents the second number in the name + # (e.g., `0') which is the tag version itself. + # + # Tag versions start at `0' and increment one unit each time a new + # tag is created from the same artistic motif version. When a new + # tag is created for the same artistic motif version, the first + # number in the tag name remains intact. The first number in the + # tag name only changes when we create a new tag for a new + # artistic motif version. + # + # Consider the following relations: + # + # trunk/.../Themes/Motifs/Flame/1 + # tags/.../Themes/Motifs/Flame/1.0 + # tags/.../Themes/Motifs/Flame/1.1 + # tags/.../Themes/Motifs/Flame/1.2 + # + # trunk/.../Themes/Motifs/Flame/2 + # tags/.../Themes/Motifs/Flame/2.0 + # tags/.../Themes/Motifs/Flame/2.1 + # tags/.../Themes/Motifs/Flame/2.2 + # + # trunk/.../Themes/Motifs/TreeFlower/1 + # ... + # and so on. + # + # Tag versions are created to release fixes and improvements, Tags + # are immutable (i.e., once tags are created, they shouldn't be + # modified.). + PATTERN[2]="^.+/Identity/Themes/Motifs/(([A-Za-z0-9]+)/${PATTERN[0]})/.+$" + + # Identify which part of the release we want to output. + case "$OPTION" in + + '--release' ) + echo "$LOCATION" | sed -r "s!.+/${PATTERN[0]}/?!\1!" + ;; + + '--release-major' ) + echo "$LOCATION" | sed -r "s!.+/${PATTERN[0]}/?!\2!" + ;; + + '--release-minor' ) + echo "$LOCATION" | sed -r "s!.+/${PATTERN[0]}/?!\4!" + ;; + + '--release-pattern' ) + echo "${PATTERN[0]}" + ;; + + '--architecture' ) + echo "$LOCATION" | sed -r "s!${PATTERN[1]}!\1!" + ;; + + '--architecture-pattern' ) + echo "${PATTERN[1]}" + ;; + + '--theme' ) + echo "$LOCATION" | sed -r "s!${PATTERN[2]}!\1!" + ;; + + '--theme-name' ) + echo "$LOCATION" | sed -r "s!${PATTERN[2]}!\2!" + ;; + + '--theme-release' ) + echo "$LOCATION" | sed -r "s!${PATTERN[2]}!\3!" + ;; + + '--theme-pattern' ) + echo "${PATTERN[2]}" + ;; + + esac + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getRepoName.sh b/Scripts/Bash/centos-art/Functions/cli_getRepoName.sh new file mode 100755 index 0000000..5d85cd3 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getRepoName.sh @@ -0,0 +1,153 @@ +#!/bin/bash +# +# cli_getRepoName.sh -- This function sets naming convenction. Inside +# CentOS Artowrk Repository, regular files are written in lower case +# and directories are written in lower case but with the first letter +# in upper case. Use this function to sanitate the name of regular +# files and directory components of paths you work with. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getRepoName { + + local NAME="$1" + local TYPE="$2" + local DIRS='' + local DIR='' + local CLEANDIRS='' + local PREFIXDIR='' + + case $TYPE in + + 'f' | 'basename' ) + + # Reduce the path passed to use just the non-directory + # part of it (i.e., the last component in the path; _not_ + # the last "real" directory in the path). + NAME=$(basename $NAME) + + # Clean value. + NAME=$(echo $NAME \ + | tr -s ' ' '_' \ + | tr '[:upper:]' '[:lower:]') + ;; + + 'd' | 'dirname' ) + + # Reduce path information passed to use just the directory + # part of it. Of course, this is applied only if there is + # a directory part in the path. However, if there is no + # directory part but there is a non-empty value in the + # path, assume that value as directory part and clean it + # up. + if [[ $NAME =~ '.+/.+' ]];then + + # When path information is reduced, we need to take + # into account that absolute path may be provided. + # Absolute paths include directory structures outside + # the repository directory structure we don't want to + # sanitate (e.g., /home/, /home/centos/, + # /home/centos/artwork, /home/centos/artwork/turnk/, + # trunk/, etc.). In these cases, it is required that + # those path component remain untouched. So, in the + # sake of keeping path components, outside repository + # directory structure untouched, we use the PREFIXDIR + # variable to temporarly store the prefix directory + # structure we don't want to sanitate. + PREFIXDIR=$(echo $NAME \ + | sed -r "s,^((${HOME}/artwork/)?(trunk|branches|tags)/).+$,\1,") + + # ... and remove it from the path information we do + # want to sanitate. + DIRS=$(dirname "$NAME" \ + | sed -r "s!^${PREFIXDIR}!!" \ + | tr '/' ' ') + + else + + # At this point, there is not directory part in the + # information passed, so use the value passed as + # directory part as such. + DIRS=$NAME + + fi + + for DIR in $DIRS;do + + # Sanitate directory component. + if [[ $DIR =~ '^[a-z]' ]];then + DIR=$(echo ${DIR} \ + | tr -s ' ' '_' \ + | tr '[:upper:]' '[:lower:]' \ + | sed -r 's/^([[:alpha:]])/\u\1/') + fi + + # Rebuild path using sanitated values. + CLEANDIRS="${CLEANDIRS}/$DIR" + + done + + # Redefine path using sanitated values. + NAME=$(echo ${CLEANDIRS} | sed -r "s!^/!!") + + # Add prefix directory information to sanitated path + # information. + if [[ "$PREFIXDIR" != '' ]];then + NAME=${PREFIXDIR}${NAME} + fi + ;; + + 'fd' | 'basename-to-dirname' ) + + # Retrive non-directory part. + NAME=$(cli_getRepoName $NAME 'f') + + # Retrive cleaned directory part from non-directory part. + NAME=$(cli_getRepoName $NAME 'd') + ;; + + 'df' | 'dirname-to-basename' ) + + # Retrive cleaned directory part from non-directory part. + NAME=$(cli_getRepoName $NAME 'd') + + # Retrive non-directory part. + NAME=$(cli_getRepoName $NAME 'f') + ;; + + 'dfd' | 'dirname-to-basename-to-dirname' ) + + # Retrive cleaned directory part from non-directory part. + NAME=$(cli_getRepoName $NAME 'd') + + # Retrive non-directory part. + NAME=$(cli_getRepoName $NAME 'f') + + # Retrive cleaned directory part from non-directory part. + NAME=$(cli_getRepoName $NAME 'd') + ;; + esac + + # Output clean path information. + echo $NAME + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getRepoParallelDirs.sh b/Scripts/Bash/centos-art/Functions/cli_getRepoParallelDirs.sh new file mode 100755 index 0000000..16cb0a1 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getRepoParallelDirs.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# cli_getRepoParallelDirs.sh -- This function returns the parallel +# directories related to the first positional paramenter passed as +# parent directory. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getRepoParallelDirs { + + local BOND='' + local TDIR='' + local -a PDIRS + + # Define bond string using first positional parameter as + # reference. + if [[ "$1" != '' ]];then + BOND="$1" + elif [[ "$ACTIONVAL" != '' ]];then + BOND="$ACTIONVAL" + else + cli_printMessage "cli_getRepoParallelDirs: `gettext "The bond string is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Define repository top level directory. + TDIR=$(cli_getRepoTLDir ${BOND}) + + # Define parallel directory base structures. + PDIRS[0]=Manuals/$(cli_getCurrentLocale)/Texinfo/Repository/$(cli_getRepoTLDir "${BOND}" '--relative') + PDIRS[1]=Scripts/Bash/Functions/Render/Config + PDIRS[2]=Locales + + # Redefine bond string without its top level directory structure. + BOND=$(echo $BOND | sed -r "s,^${TDIR}/(.+)$,\1,") + + # Concatenate repository top level directory, parallel directory + # base structure, and bond information; in order to produce the + # final parallel directory path. + for PDIR in "${PDIRS[@]}";do + echo ${TDIR}/${PDIR}/${BOND} + done + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getRepoStatus.sh b/Scripts/Bash/centos-art/Functions/cli_getRepoStatus.sh new file mode 100755 index 0000000..a7b42db --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getRepoStatus.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# cli_getRepoStatus.sh -- This function requests the working copy +# using the svn status command and returns the first character in the +# output line, as described in svn help status, for the LOCATION +# specified. Use this function to perform verifications based a +# repository LOCATION status. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getRepoStatus { + + local LOCATION="$1" + local STATUS='' + + # Define regular expression pattern to retrive first column, + # returned by subversion status command. This column is one + # character column as describes `svn help status' command. + local PATTERN='^( |A|C|D|I|M|R|X|\?|!|~).+$' + + # Verify the file used as source to retrive its status + # information. We only use regular files or directories inside the + # working copy. + cli_checkFiles "$LOCATION" 'fd' + cli_checkFiles "$LOCATION" 'isInWorkingCopy' + + # Use subversion `status' command to retrive the first character + # in the output. Discard standard error output. + STATUS="$(svn status "$LOCATION" | sed -r "s/${PATTERN}/\1/" 2>/dev/null)" + + # Outout status information. + echo -n "$STATUS" + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getRepoTLDir.sh b/Scripts/Bash/centos-art/Functions/cli_getRepoTLDir.sh new file mode 100755 index 0000000..ce6ed8f --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getRepoTLDir.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# +# cli_getRepoTLDir.sh -- This function returns the repository top +# level absolute path. The repository top level absolute path may be +# /home/centos/artwork/trunk, /home/centos/artwork/branches, or +# /home/centos/artwork/tags. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getRepoTLDir { + + local PATTERN='' + local REPLACE='' + local LOCATION='' + + # Define location. If first argument is provided use it as default + # location. Otherwise, if first argument is not provided, + # location takes the action value (ACTIONVAL) as default. + if [[ "$1" != '' ]];then + LOCATION="$1" + else + LOCATION="$ACTIONVAL" + fi + + # Verify location. + if [[ $LOCATION =~ '^/home/centos/artwork/(trunk|branches|tags)/.+$' ]];then + case "$2" in + -r|--relative ) + PATTERN='^/home/centos/artwork/(trunk|branches|tags)/.+$' + REPLACE='\1' + ;; + -a|--absolute|* ) + PATTERN='^(/home/centos/artwork/(trunk|branches|tags))/.+$' + REPLACE='\1' + ;; + esac + else + cli_printMessage "cli_getRepoTLDir: `eval_gettext "The location \\\`\\\$LOCATION' is not valid."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Print location. + echo $LOCATION | sed -r "s!${PATTERN}!${REPLACE}!g" + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_getTemporalFile.sh b/Scripts/Bash/centos-art/Functions/cli_getTemporalFile.sh new file mode 100755 index 0000000..51ff71a --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_getTemporalFile.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# +# cli_getTemporalFile.sh -- This function returns absolute path to +# temporal file. Use this function whenever you need to create +# temporal files inside centos-art.sh script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_getTemporalFile { + + # Check amount arguments passed to this function. + if [[ $# -ne 1 ]];then + cli_printMessage "cli_getTemporalFile: `gettext "First argument is required."`" + cli_printMessage "$(caller)" 'ToKnowMoreLine' + fi + + # Define default basename for temporal file. This is required when + # svg instances are created previous to be parsed by inkscape in + # order to be exported as png. In such cases .svg file exention is + # required in order to avoid inkscape complains. + local NAME="$1" + if [[ "$NAME" == '' ]];then + cli_printMessage "cli_getTemporalFile: `gettext "First argument cannot be empty."`" + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + else + NAME="-$(cli_getCurrentLocale)-$(cli_getRepoName "$1" 'f')" + fi + + # Define default source location where temporal files will be stored. + local TMPDIR='/tmp' + + # Define default prefix for temporal file. + local PREFIX='centos-art.sh-' + + # Define unique identifier for temporal file. + local UUID=$(cat /proc/sys/kernel/random/uuid) + + # Join default source location and filename to build final + # temporal file absolute path. + local TMPFILE=$(echo -n "${TMPDIR}/${PREFIX}${UUID}${NAME}") + + # Output absolute path to final temporal file. + echo $TMPFILE + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_printActionPreamble.sh b/Scripts/Bash/centos-art/Functions/cli_printActionPreamble.sh new file mode 100755 index 0000000..aade07a --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_printActionPreamble.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# +# cli_printActionPreamble -- This function standardizes action +# preamble messages. Action preamble messages provides a confirmation +# message that illustrate what files will be affected in the action. +# +# Generally, actions are applied to parent directories. Each parent +# directory has parallel directories associated. If one parent +# directory is created/deleted, the parallel directories associated do +# need to be created/deleted too. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_printActionPreamble { + + local FILE='' + local COUNT=0 + local FILES="$1" + local ACTION="$2" + local FORMAT="$3" + + # Check list of files to process. If we have an empty list of + # files, inform about it and stop script execution. Otherwise + # print list of files. + if [[ "$FILES" == '' ]];then + cli_printMessage "`gettext "There is no file to process."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Verify that all function parameters are passed. If they are not, + # there is nothing else to do here. + if [[ $# -ne 3 ]];then + return + fi + + # Redefine total number of directories. + COUNT=$(echo "$FILES" | sed -r "s! +!\n!g" | wc -l) + + # Redefine preamble messages based on action. + case $ACTION in + + 'doCreate' ) + ACTION="`ngettext "The following entry will be created" \ + "The following entries will be created" $COUNT`:" + ;; + + 'doDelete' ) + ACTION="`ngettext "The following entry will be deleted" \ + "The following entries will be deleted" $COUNT`:" + ;; + + 'doLocale' ) + ACTION="`ngettext "Translatable strings will be retrived from the following entry" \ + "Translatable strings will be retrived from the following entries" $COUNT`:" + ;; + + 'doEdit' ) + ACTION="`ngettext "The following file will be edited" \ + "The following files will be edited" $COUNT`:" + ;; + + esac + + # Print preamble message. + cli_printMessage "$ACTION" + for FILE in $FILES;do + cli_printMessage "$FILE" "$FORMAT" + done + cli_printMessage "`gettext "Do you want to continue"`" 'AsYesOrNoRequestLine' + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_printMessage.sh b/Scripts/Bash/centos-art/Functions/cli_printMessage.sh new file mode 100755 index 0000000..05db63a --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_printMessage.sh @@ -0,0 +1,178 @@ +#!/bin/bash +# +# cli_printMessage.sh -- This function outputs information in +# predifined formats to standard error. This function is the standard +# way to output information inside centos-art.sh script. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_printMessage { + + local MESSAGE="$1" + local FORMAT="$2" + + # Reduce paths inside output messages. The main purpose for this + # is to free horizontal space in output messages. + MESSAGE=$(echo "$MESSAGE" \ + | sed -r 's!/home/centos/artwork/(trunk|branches|tags)/!\1/!g') + + # Remove blank spaces from lines' begining. + MESSAGE=$(echo "$MESSAGE" | sed -r 's!^[[:space:]]+!!') + + # Define message formats. + case $FORMAT in + + 'AsUpdatingLine' ) + cli_printMessage "`gettext "Updating"`: $MESSAGE" + ;; + + 'AsDeletingLine' ) + cli_printMessage "`gettext "Deleting"`: $MESSAGE" + ;; + + 'AsCheckingLine' ) + cli_printMessage "`gettext "Checking"`: $MESSAGE" + ;; + + 'AsCreatingLine' ) + cli_printMessage "`gettext "Creating"`: $MESSAGE" + ;; + + 'AsSavedAsLine' ) + cli_printMessage "`gettext "Saved as"`: $MESSAGE" + ;; + + 'AsLinkToLine' ) + cli_printMessage "`gettext "Linked to"`: $MESSAGE" + ;; + + 'AsMovedToLine' ) + cli_printMessage "`gettext "Moved to"`: $MESSAGE" + ;; + + 'AsTranslationLine' ) + cli_printMessage "`gettext "Translation"`: $MESSAGE" + ;; + + 'AsDesignLine' ) + cli_printMessage "`gettext "Design"`: $MESSAGE" + ;; + + 'AsConfigurationLine' ) + cli_printMessage "`gettext "Configuration"`: $MESSAGE" + cli_printMessage '-' 'AsSeparatorLine' + ;; + + 'AsPaletteLine' ) + cli_printMessage "`gettext "Palette"`: $MESSAGE" + ;; + + 'AsResponseLine' ) + cli_printMessage "--> $MESSAGE" + ;; + + 'AsRequestLine' ) + cli_printMessage "${MESSAGE}: " 'AsNoTrailingNewLine' + ;; + + 'AsErrorLine' ) + # This option is used to print error messsages. + echo "${CLINAME}: ${MESSAGE}" > /dev/stderr + ;; + + 'AsToKnowMoreLine' ) + # This option receives the output of bash's caller + # built-in as message value and produces the documentation + # entry from it. + MESSAGE=$(cli_getRepoName "$(echo $MESSAGE | cut -d ' ' -f2-)" 'd') + cli_printMessage '-' 'AsSeparatorLine' + cli_printMessage "`gettext "To know more, run the following command"`:" + cli_printMessage "centos-art manual --read='$MESSAGE'" + cli_printMessage '-' 'AsSeparatorLine' + exit # <-- ATTENTION: Do not remove this line. We use this + # option as convenction to end script + # execution. + ;; + + 'AsYesOrNoRequestLine' ) + + # Define positive answer. + local Y="`gettext "yes"`" + + # Define negative answer. + local N="`gettext "no"`" + + if [[ $FLAG_ANSWER == 'false' ]];then + + # Print the question. + cli_printMessage "$MESSAGE [${Y}/${N}]: " 'AsNoTrailingNewLine' + + # Wait for user's answer to be entered. + read FLAG_ANSWER + + fi + + # Verify user's answer. Only positive answer let the + # script flow to continue. Otherwise, if something + # different from possitive answer is passed, the + # script terminates its execution immediatly. + if [[ ! ${FLAG_ANSWER} =~ "^${Y}" ]];then + exit + fi + ;; + + 'AsSeparatorLine' ) + + if [[ "$FLAG_QUIET" == 'false' ]];then + + # Define separator width. + local MAX=70 + + # Draw separator. + until [[ $MAX -eq 0 ]];do + printf "${MESSAGE}" > /dev/stderr + MAX=$(($MAX - 1)) + done + + # Output newline to end separator. + echo "" > /dev/stderr + + fi + ;; + + 'AsNoTrailingNewLine' ) + if [[ "$FLAG_QUIET" == 'false' ]];then + printf "$MESSAGE" > /dev/stderr + fi + ;; + + 'AsRegularLine' | * ) + if [[ "$FLAG_QUIET" == 'false' ]];then + echo "$MESSAGE" \ + | awk -f /home/centos/artwork/trunk/Scripts/Bash/Styles/output_forTwoColumns.awk \ + > /dev/stderr + fi + ;; + + esac + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_readFileContent.sh b/Scripts/Bash/centos-art/Functions/cli_readFileContent.sh new file mode 100644 index 0000000..ab4edaf --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_readFileContent.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# +# cli_readFileContent.sh -- This function outputs content of files, +# passed as first argument, to standard output as specified by second +# argument. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_readFileContent { + + local FILES="$1" + local PATTERN='Copyright (\(C\)|©) [0-9]+(-[0-9]+)? .+' + + # Verify existence of files but don't stop if it doesn't exist. + cli_checkFiles "$FILES" + + # Print content of files to standard output. + case "$2" in + + '--copyright-line' ) + cat "$FILES" | egrep "^ +${PATTERN}$" | head -n 1 | sed -r 's!^ +!!' + ;; + + '--last-line' ) + cat "$FILES" | tail -n 1 + ;; + + '--copyright-year' ) + if [[ $(cli_readFileContent "$FILES" '--copyright-line') =~ "^${PATTERN}$" ]];then + cli_readFileContent "$FILES" '--copyright-line' | cut -d' ' -f3 + fi + ;; + + '--copyright-holder' ) + if [[ $(cli_readFileContent "$FILES" '--copyright-line') =~ "^${PATTERN}$" ]];then + cli_readFileContent "$FILES" '--copyright-line' | cut -d' ' -f4- + fi + ;; + + '--all-lines' | * ) + cat "$FILES" + ;; + + esac + +} diff --git a/Scripts/Bash/centos-art/Functions/cli_replaceTMarkers.sh b/Scripts/Bash/centos-art/Functions/cli_replaceTMarkers.sh new file mode 100755 index 0000000..0b2da89 --- /dev/null +++ b/Scripts/Bash/centos-art/Functions/cli_replaceTMarkers.sh @@ -0,0 +1,142 @@ +#!/bin/bash +# +# cli_replaceTMarkers.sh -- This function standardizes +# replacements for common translation markers. Raplacements are +# applied to temporal instances used to produce the final file. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function cli_replaceTMarkers { + + # Initialize variables. + local -a SRC + local -a DST + local COUNT=0 + local COUNTSRC=0 + local COUNTDST=0 + local LOCATION='' + + # Define source location on which sed replacements take place. + LOCATION="$1" + + # Verify file source location. + cli_checkFiles "$LOCATION" 'f' + + # Define translation markers. The translation marker definition + # order is important. Note that when we render concept directory + # structure, we make two replacements to produce the final + # copyright note. First, we replace =COPYRIGHT= translation marker + # and later the =THEMENAME= translation maker (not the oposite). + SRC[0]='=COPYRIGHT_YEAR=' + SRC[1]='=COPYRIGHT_HOLDER=' + SRC[2]='=LICENSE=' + SRC[3]='=LICENSE_URL=' + SRC[4]='=THEME=' + SRC[5]='=THEMENAME=' + SRC[6]='=THEMERELEASE=' + SRC[7]='=RELEASE=' + SRC[8]='=MAJOR_RELEASE=' + SRC[9]='=MINOR_RELEASE=' + SRC[10]='=URL=' + SRC[11]='=ARCH=' + SRC[12]='=URL_WIKI=' + SRC[13]='=URL_LISTS=' + SRC[14]='=URL_FORUMS=' + SRC[15]='=URL_MIRRORS=' + SRC[16]='=URL_DOCS=' + SRC[17]='=MAIL_DOCS=' + SRC[18]='=LOCALE_LL=' + + # Define replacements for translation markers. + DST[0]="$(cli_getCopyrightInfo '--copyright-year')" + DST[1]="$(cli_getCopyrightInfo '--copyright-holder')" + DST[2]="$(cli_getCopyrightInfo '--license')" + DST[3]="$(cli_getCopyrightInfo '--license-url')" + DST[4]="$(cli_getPathComponent "$OUTPUT" '--theme')" + DST[5]="$(cli_getPathComponent "$OUTPUT" '--theme-name')" + DST[6]="$(cli_getPathComponent "$OUTPUT" '--theme-release')" + DST[7]="$(cli_getPathComponent "$FLAG_RELEASE" '--release')" + DST[8]="$(cli_getPathComponent "$FLAG_RELEASE" '--release-major')" + DST[9]="$(cli_getPathComponent "$FLAG_RELEASE" '--release-minor')" + DST[10]="http://=LOCALE_LL=.centos.org/" + DST[11]="$(cli_getPathComponent "$FLAG_ARCHITECTURE" '--architecture')" + DST[12]="=URL=wiki/" + DST[13]="=URL=lists/" + DST[14]="=URL=forums/" + DST[15]="=URL=mirrors/" + DST[16]="=URL=docs/" + DST[17]="centos-docs@$(cli_getCurrentLocale '--langcode-only').centos.org" + DST[18]="$(cli_getCurrentLocale '--langcode-only')" + + # Do replacement of nested translation markers. + while [[ $COUNTDST -lt ${#DST[@]} ]];do + + # Verify existence of translation markers. If there is no + # translation marker on replacement, continue with the next + # one in the list. + if [[ ! ${DST[$COUNTDST]} =~ '=[A-Z_]+=' ]];then + # Increment destination counter. + COUNTDST=$(($COUNTDST + 1)) + # The current replacement value doesn't have translation + # marker inside, so skip it and evaluate the next + # replacement value in the list. + continue + fi + + while [[ $COUNTSRC -lt ${#SRC[*]} ]];do + + # Update replacements. + DST[$COUNTDST]=$(echo ${DST[$COUNTDST]} \ + | sed -r "s!${SRC[$COUNTSRC]}!${DST[$COUNTSRC]}!g") + + # Increment source counter. + COUNTSRC=$(($COUNTSRC + 1)) + + done + + # Reset source counter + COUNTSRC=0 + + # Increment destination counter. + COUNTDST=$(($COUNTDST + 1)) + + done + + # Apply replacements for translation markers. + while [[ ${COUNT} -lt ${#SRC[*]} ]];do + + # Use sed to replace translation markers inside the design + # model instance. + sed -r -i "s!${SRC[$COUNT]}!${DST[$COUNT]}!g" ${LOCATION} + + # Increment counter. + COUNT=$(($COUNT + 1)) + + done + + # Unset specific translation markers and specific replacement + # variables in order to clean them up. Otherwise, undesired values + # may ramain from one file to another. + unset SRC + unset DST + +} diff --git a/Scripts/Bash/centos-art/Styles/output_forTwoColumns.awk b/Scripts/Bash/centos-art/Styles/output_forTwoColumns.awk new file mode 100644 index 0000000..208e3dc --- /dev/null +++ b/Scripts/Bash/centos-art/Styles/output_forTwoColumns.awk @@ -0,0 +1,37 @@ +#!/usr/bin/gawk +# +# output_forRendering.awk -- This file provides the output format for +# all rendering actions inside centos-art.sh script. +# +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +BEGIN { FS=": " } + +{ + if ( $0 ~ /^-+$/ ) + print $0 + else + printf "%-15s\t%s\n", $1, $2 + +} + +END {} diff --git a/Scripts/Bash/centos-art/Styles/renameFile.sh b/Scripts/Bash/centos-art/Styles/renameFile.sh new file mode 100755 index 0000000..91d0dfe --- /dev/null +++ b/Scripts/Bash/centos-art/Styles/renameFile.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# renameFiles.sh -- Rename files names, inside svn repository, +# massively. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id: renameFile.sh 12 2010-09-10 09:55:08Z al $ +# ---------------------------------------------------------------------- + + +if [ ! $# = 4 ];then + cli_printMessage "`gettext "Syntax: ./update-filenames.sh "`" + exit; +fi + +ROOTDIR="$1" +FILTER="$2" +PATTERN="$3" +VALUE="$4" + +for FILE in `find $ROOTDIR -regex $FILTER`;do + DIR=`dirname $FILE` + FILE=`basename $FILE` + svn mv $DIR/$FILE $DIR/`echo $FILE | sed -r "s!$PATTERN!$VALUE!"` +done diff --git a/Scripts/Bash/centos-art/init.sh b/Scripts/Bash/centos-art/init.sh new file mode 100755 index 0000000..22ce82f --- /dev/null +++ b/Scripts/Bash/centos-art/init.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# centos-art.sh -- The CentOS Artwork Repository automation tool +# initialization script. +# +# This is the first script that centos-art command initiates. This +# script contains a serie of desition about which configuration script +# to load based. To determine which configuration script to load, the +# absolute path from which the command centos-art was initially called +# is used as reference. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id: centos-art.sh 70 2010-09-18 04:38:43Z al $ +# ---------------------------------------------------------------------- + +# Initizalize centos-art.sh gettext internazionalization. +. gettext.sh +export TEXTDOMAIN=centos-art.sh +export TEXTDOMAINDIR=/home/centos/artwork/trunk/Locales/Scripts/centos-art.sh/ + +# Initialize centos-art.sh personal information. +export CLINAME='centos-art' +export CLIVERSION='1.0 (beta)' + +# Initialize centos-art.sh function scripts. +FILES=$(ls /home/centos/artwork/trunk/Scripts/Bash/Functions/{cli,cli_*}.sh) +for FILE in $FILES;do + if [[ -x $FILE ]];then + . $FILE + FUNCTION=$(grep '^function ' $FILE | cut -d' ' -f2) + export -f $FUNCTION + else + echo `gettext "The $FILE needs to have execution rights."` + exit + fi +done + +# Unset all variables not considered global in order to start cli +# execution with a clean environment. +unset FILE +unset FILES +unset FUNCTION + +# Initialize command line interface. +cli "$@" diff --git a/Scripts/Python/centos-art/centos-art.py b/Scripts/Python/centos-art/centos-art.py new file mode 100755 index 0000000..744776e --- /dev/null +++ b/Scripts/Python/centos-art/centos-art.py @@ -0,0 +1,78 @@ +#!/usr/bin/python +# +# centos-art-cli.py - The CentOS Artwork Repository ToolBox (art) +# command line interface. +# +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +#------------------------------------------------------------ +# $Id: centos-art.py 6245 2010-08-12 14:44:19Z al $ +#----------------------------------------------------------- +""" +The CentOS Artwork Repository Toolbox (art) command line interface. + +This script provides a command line interface (cli) to operate local +working copies of CentOS Artwork Repository. Most of the actions this +script can perform relay on CentOS Artwork Repository files and +directories standard structure. The CentOS Artwork Repository standard +structure is described inside the `Repo' class as docstrings. The +`Repo' class is available in the repository.py file. + +In order to make this script available along CentOS Artwork Repository +you need create a link to the file art-cli.py inside /home/centos/bin/ +directory. For example: + + $ mkdir /home/centos/bin/ + $ cd /home/centos/bin/ + $ ln -s /home/centos/artwork/trunk/Scripts/Python/centos-art-cli.py centos-art + +Note that we used the `centos' lower-case word as username. This is a +convention[1] that let us create a common absolute path for people to +store the CentOS Artwork Repository working copy. + + [1:] Absolute paths are used Inkscape to import raster images + inside SVG files--well, to link them really. If everyone + downloading a working copy of CentOS Artwork Repository uses its + one absolute path there is no way to garantee that all images + imported inside SVG design templates will be displayed correctly + in all downloaded working copies. That is because, there is no way + to garantee that everyone's working copy is placed in the same + absolute path the raster image was imported the first time. So the + absolute path name convenction is needed. + +The centos-art-cli.py script let you to: + + * Render images and texts using common design models and + translations. + + * Navigate the repository structure. + + * Get information about repository structures. + + * Test themes. + +""" + +#from repository import Repo +from framework import Framework + +def main(): + fw = Framework() + fw.list('Brands') + +if __name__ == '__main__': main() diff --git a/Scripts/Python/centos-art/framework.py b/Scripts/Python/centos-art/framework.py new file mode 100755 index 0000000..92e512a --- /dev/null +++ b/Scripts/Python/centos-art/framework.py @@ -0,0 +1,90 @@ +# framework - The CentOS Artwork Repository framework structure. +# +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +#------------------------------------------------------------ +# $Id: framework.py 6045 2010-07-13 08:11:03Z al $ +#----------------------------------------------------------- +""" +The CentOS Artwork Repository framework structure. + +""" + +import string +import os +import re + +from repository import Repo + +class Framework: + """ + This structure provides attributes and methods needed by CentOS + artwork repository framework structures. + """ + + def __init__(self): + self.fw = {} + + def find(self,id): + """ + Return a dictionary object containing information about + frameworks. This function explores the repository structure + looking for framework directories. Framework directories are + defined as regular directories containing at least the + subdirectory `tpl/' in its first level. + """ + repo = Repo() + rootdir = str(repo.abspath + repo.workline[0]) + template = re.compile('^.*/tpl/?$') + for root, dirs, files in os.walk(rootdir): + if id in root and template.match(root): + print root + #pathid = self.getPathId(root) + #self.fw[pathid] = self.add(pathid) + + def getPathId(self, path): + """ + Return the framework's path id by cleaning up its string path. + """ + # Remove absolute path and workline from string path. + # Remove theme directory from string path. + # Remove template directory from string path. + pass + + def add(self, pathid): + """ + Return the framework's templates, translations and manuals paths. + """ + templates = str('trunk/' + pathid + '/tpl') + translations = str('trunk/Translations/' + pathid) + manuals = str('trunk/Manuals/' + pathid) + return (templates, translations, manuals) + + def list(self, id): + """ + Print available frameworks and its paths. + """ + self.find(id) + for k, v in self.fw.iteritems(): + pathid = k + templates, translations, manuals = v + print '%12s: %s' % ('Id', pathid) + print '%12s: %s' % ('Templates', templates) + print '%12s: %s' % ('Translations', translations) + print '%12s: %s' % ('Manuals', manuals) + print '-'*66 diff --git a/Scripts/Python/centos-art/repository.py b/Scripts/Python/centos-art/repository.py new file mode 100755 index 0000000..de71d4e --- /dev/null +++ b/Scripts/Python/centos-art/repository.py @@ -0,0 +1,70 @@ +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +#------------------------------------------------------------ +# $Id: repository.py 6036 2010-07-09 21:20:27Z al $ +#----------------------------------------------------------- +""" +The CentOS Artwork Repository. + +The CentOS Artwork Repository is a subversion-based file structure +organized to produce the CentOS project's corporate visual identity. +The CentOS Project corporate visual identity is the ``persona'' of the +organization known as The CentOS Project. + +The CentOS Project corporate visual identity plays a significant role +in the way the CentOS Project, as organization, presents itself to +both internal and external stakeholders. In general terms, the CentOS +Project corporate visual identity expresses the values and ambitions +of the CentOS Project organization, its business, and its +characteristics. The CentOS Project corporate visual identity +provides visibility, recognizability, reputation, structure and +identification to the CentOS Project organization by means of +corporate design, corporate communication, and corporate behaviour. + +The CentOS Project settles down its corporate visual identity on a +``monolithic corporate visual identity structure''. In this structure +The CentOS Project uses one unique name and one unique visual style in +all its manifestations. + +Inside CentOS Artwork Repository, visual manifestations are organized +in the categories: distributions, websites, and promotion. + +Inside CentOS Artwork Repository, corporate visual identity is +oraganized in the work lines: graphic-design, translations, and +programming (scripts). Each work line is a group of people that, based +on standard patterns, can work indepently and coordinated one another. + +In the structure just mentioned, graphic designers provide the design +models and visual styles (motifs) needed to cover each each visual +manifestation; translators create the language-specific contents; and +programmers gear everything together in order to produce specific +design models on various visual styles, languages, and major releases, +automatically. +""" + +class Repo: + """ + This class provides attributes and methods needed to implement the + base repository structure. + """ + + def __init__(self): + # Define repository's working copy absolute path. + self.abspath = '/home/centos/artwork/' + # Define repository's working line. + self.workline = ('trunk/', 'branches/', 'tags/') diff --git a/Scripts/centos-art.py/centos-art.py b/Scripts/centos-art.py/centos-art.py deleted file mode 100755 index 744776e..0000000 --- a/Scripts/centos-art.py/centos-art.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/python -# -# centos-art-cli.py - The CentOS Artwork Repository ToolBox (art) -# command line interface. -# -# Copyright (C) 2009-2010 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -#------------------------------------------------------------ -# $Id: centos-art.py 6245 2010-08-12 14:44:19Z al $ -#----------------------------------------------------------- -""" -The CentOS Artwork Repository Toolbox (art) command line interface. - -This script provides a command line interface (cli) to operate local -working copies of CentOS Artwork Repository. Most of the actions this -script can perform relay on CentOS Artwork Repository files and -directories standard structure. The CentOS Artwork Repository standard -structure is described inside the `Repo' class as docstrings. The -`Repo' class is available in the repository.py file. - -In order to make this script available along CentOS Artwork Repository -you need create a link to the file art-cli.py inside /home/centos/bin/ -directory. For example: - - $ mkdir /home/centos/bin/ - $ cd /home/centos/bin/ - $ ln -s /home/centos/artwork/trunk/Scripts/Python/centos-art-cli.py centos-art - -Note that we used the `centos' lower-case word as username. This is a -convention[1] that let us create a common absolute path for people to -store the CentOS Artwork Repository working copy. - - [1:] Absolute paths are used Inkscape to import raster images - inside SVG files--well, to link them really. If everyone - downloading a working copy of CentOS Artwork Repository uses its - one absolute path there is no way to garantee that all images - imported inside SVG design templates will be displayed correctly - in all downloaded working copies. That is because, there is no way - to garantee that everyone's working copy is placed in the same - absolute path the raster image was imported the first time. So the - absolute path name convenction is needed. - -The centos-art-cli.py script let you to: - - * Render images and texts using common design models and - translations. - - * Navigate the repository structure. - - * Get information about repository structures. - - * Test themes. - -""" - -#from repository import Repo -from framework import Framework - -def main(): - fw = Framework() - fw.list('Brands') - -if __name__ == '__main__': main() diff --git a/Scripts/centos-art.py/framework.py b/Scripts/centos-art.py/framework.py deleted file mode 100755 index 92e512a..0000000 --- a/Scripts/centos-art.py/framework.py +++ /dev/null @@ -1,90 +0,0 @@ -# framework - The CentOS Artwork Repository framework structure. -# -# Copyright (C) 2009-2010 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -#------------------------------------------------------------ -# $Id: framework.py 6045 2010-07-13 08:11:03Z al $ -#----------------------------------------------------------- -""" -The CentOS Artwork Repository framework structure. - -""" - -import string -import os -import re - -from repository import Repo - -class Framework: - """ - This structure provides attributes and methods needed by CentOS - artwork repository framework structures. - """ - - def __init__(self): - self.fw = {} - - def find(self,id): - """ - Return a dictionary object containing information about - frameworks. This function explores the repository structure - looking for framework directories. Framework directories are - defined as regular directories containing at least the - subdirectory `tpl/' in its first level. - """ - repo = Repo() - rootdir = str(repo.abspath + repo.workline[0]) - template = re.compile('^.*/tpl/?$') - for root, dirs, files in os.walk(rootdir): - if id in root and template.match(root): - print root - #pathid = self.getPathId(root) - #self.fw[pathid] = self.add(pathid) - - def getPathId(self, path): - """ - Return the framework's path id by cleaning up its string path. - """ - # Remove absolute path and workline from string path. - # Remove theme directory from string path. - # Remove template directory from string path. - pass - - def add(self, pathid): - """ - Return the framework's templates, translations and manuals paths. - """ - templates = str('trunk/' + pathid + '/tpl') - translations = str('trunk/Translations/' + pathid) - manuals = str('trunk/Manuals/' + pathid) - return (templates, translations, manuals) - - def list(self, id): - """ - Print available frameworks and its paths. - """ - self.find(id) - for k, v in self.fw.iteritems(): - pathid = k - templates, translations, manuals = v - print '%12s: %s' % ('Id', pathid) - print '%12s: %s' % ('Templates', templates) - print '%12s: %s' % ('Translations', translations) - print '%12s: %s' % ('Manuals', manuals) - print '-'*66 diff --git a/Scripts/centos-art.py/repository.py b/Scripts/centos-art.py/repository.py deleted file mode 100755 index de71d4e..0000000 --- a/Scripts/centos-art.py/repository.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (C) 2009-2010 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -#------------------------------------------------------------ -# $Id: repository.py 6036 2010-07-09 21:20:27Z al $ -#----------------------------------------------------------- -""" -The CentOS Artwork Repository. - -The CentOS Artwork Repository is a subversion-based file structure -organized to produce the CentOS project's corporate visual identity. -The CentOS Project corporate visual identity is the ``persona'' of the -organization known as The CentOS Project. - -The CentOS Project corporate visual identity plays a significant role -in the way the CentOS Project, as organization, presents itself to -both internal and external stakeholders. In general terms, the CentOS -Project corporate visual identity expresses the values and ambitions -of the CentOS Project organization, its business, and its -characteristics. The CentOS Project corporate visual identity -provides visibility, recognizability, reputation, structure and -identification to the CentOS Project organization by means of -corporate design, corporate communication, and corporate behaviour. - -The CentOS Project settles down its corporate visual identity on a -``monolithic corporate visual identity structure''. In this structure -The CentOS Project uses one unique name and one unique visual style in -all its manifestations. - -Inside CentOS Artwork Repository, visual manifestations are organized -in the categories: distributions, websites, and promotion. - -Inside CentOS Artwork Repository, corporate visual identity is -oraganized in the work lines: graphic-design, translations, and -programming (scripts). Each work line is a group of people that, based -on standard patterns, can work indepently and coordinated one another. - -In the structure just mentioned, graphic designers provide the design -models and visual styles (motifs) needed to cover each each visual -manifestation; translators create the language-specific contents; and -programmers gear everything together in order to produce specific -design models on various visual styles, languages, and major releases, -automatically. -""" - -class Repo: - """ - This class provides attributes and methods needed to implement the - base repository structure. - """ - - def __init__(self): - # Define repository's working copy absolute path. - self.abspath = '/home/centos/artwork/' - # Define repository's working line. - self.workline = ('trunk/', 'branches/', 'tags/') diff --git a/Scripts/centos-art.sh/Functions/About/Config/authors.txt b/Scripts/centos-art.sh/Functions/About/Config/authors.txt deleted file mode 100644 index 7d73104..0000000 --- a/Scripts/centos-art.sh/Functions/About/Config/authors.txt +++ /dev/null @@ -1,4 +0,0 @@ -Alain Reguera Delgado -Ralph Angenendt -Karanbirn Singh -Marcus Moeller diff --git a/Scripts/centos-art.sh/Functions/About/Config/copying.txt b/Scripts/centos-art.sh/Functions/About/Config/copying.txt deleted file mode 100644 index 58298c2..0000000 --- a/Scripts/centos-art.sh/Functions/About/Config/copying.txt +++ /dev/null @@ -1,18 +0,0 @@ -centos-art.sh -- The CentOS Artowrk Repository automation tool. - -Copyright (C) 2009-2011 Alain Reguera Delgado - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -USA. diff --git a/Scripts/centos-art.sh/Functions/About/Config/history.txt b/Scripts/centos-art.sh/Functions/About/Config/history.txt deleted file mode 100644 index 1b98ad5..0000000 --- a/Scripts/centos-art.sh/Functions/About/Config/history.txt +++ /dev/null @@ -1,136 +0,0 @@ -$Id$ -This file records noteworthy changes of CentOS Artwork Repository. - - Copyright (C) 2009-2011 Alain Reguera Delgado - - Copying and distribution of this file, with or without modification, are - permitted in any medium without royalty provided the copyright notice and - this notice are preserved. - -------------------------------------------------------------------------------- -(2011) - - - Unify common arguments for all specific functionalities (e.g, --answer, - --quiet, --filter, etc.) and leave just specific arguments for specific - functions to parse. There is no need to duplicate common arguments - definitions inside every specific functionality. - - - The `.sed' translation files are no longer used, scalable vector - graphics are used instead. Translation messages take place by means of - xml2po and gettext. With xml2po translatable strings are retrived from - `.svg' files and stored inside gettext `.pot' and `.po' files for - translators to edit. Finally, xml2po is used again to build the temporal - design model translated instance which the final `.png' image is built - from. - - - The `trunk/Translation' directory structure is removed. The - `trunk/Locales' directory structure is used instead to store locale - information. - -------------------------------------------------------------------------------- -(2010) - - - Inside centos-art.sh script, functionalities start to get - identified and separated one from another. For example, when - images are rendered, there is no need to load manual - functionality. There are now common functionalities and specific - functionalities. Common functionalities are loaded when the - script is initiated and are available to specific - functionalities. - - - The directory structure is optimized to implements the corporate - identity concepts and the centos-art.sh script. The CentOS - Artwork Repository directory structure places the organizational - convenctions that centos-art.sh script needs to do what we - expect from it to do. - - - The following functionalities start to take form as part of - centos-art.sh script: - - `trunk/Scripts/Bash/Functions/Render/render.sh' - - To produce translated images using Inkscape and Sed - replacement commands. - - `trunk/Scripts/Bash/Functions/Manual/manual.sh' - - To produce documentation using Texinfo. Almost all - LaTeX-based documents were moved to Texinfo format and - handled by manual functionality. - - `trunk/Scripts/Bash/Functions/Locale/locale.sh' - - To translate centos-art.sh command-line interface messages - using gettext. - - `trunk/Scripts/Functions/Shell/shell.sh' - - To perform massive actions inside shell scripts. For - example, update top-commentaries massively. - - `trunk/Scripts/Functions/Svg/svg.sh' - - To perform massive actions inside SVG files. - - `trunk/Scripts/Functions/Html/html.sh' - - To perform massive actions inside HTML files. - - `trunk/Scripts/Functions/Path/path.sh' - - To automate manipulation of files, branches, and tags. - - `trunk/Scripts/Functions/About/about.sh' - - To print license, authors, history, copying, etc. - -------------------------------------------------------------------------------- -(2009) - - - The rendering script starts to evolve into centos-art.sh script, a - command-line interface to manipulate the CentOS Artwork Repository. - - - Corporate identity concepts taken from Wikipedia and related books are - introduced as development reference. The main goal of centos-art.sh - turns to: automate production of a monolithic corporate visual identity - structure based on CentOS Mission and CentOS Release Schema. - - - Alain Reguera Delgado is out of Internet for an undefined amount of - time, but continues developing CentOS Artwork Repository and its - automation tool (i.e., the centos-art.sh script) off-line. - - - Documentation begins to take form in LaTeX format. - -------------------------------------------------------------------------------- -(2008) - - - The CentOS Artwork Repository started at CentOS Developers - mailing list. - - - Alain Reguera Delgado shares ideas in a thread about Anaconda - progress slide images and the possibility of automating their - construction. - - - Ralph Angenendt rises up his hand asking: Do you have something - to show? - - - Alain Reguera Delgado posts a Bash script to produce slide - images in different languages ---together with the proposition - of creating a Subversion centralized repository where - translations and image production could be distributed inside - CentOS Community---. - - - Karanbirn Sighn considers the idea intresting and provides the - infrastructure to support the effort as the CentOS Artwork SIG. - - https://projects.centos.org/svn/artwork/ - https://projects.centos.org/trac/artwork/ - - - Alain Reguera Delagdo uploads the rendering script to CentOS - Artwork Repository. - - - Ralph Angenendt documents the rendering script. - - - With the rendering script and its documentation available, - translators start to download working copies of CentOS Artwork - Repository to produce slide images in their own languages. diff --git a/Scripts/centos-art.sh/Functions/About/Config/license.txt b/Scripts/centos-art.sh/Functions/About/Config/license.txt deleted file mode 100644 index 5b6e7c6..0000000 --- a/Scripts/centos-art.sh/Functions/About/Config/license.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/Scripts/centos-art.sh/Functions/About/about.sh b/Scripts/centos-art.sh/Functions/About/about.sh deleted file mode 100755 index 77ea1d2..0000000 --- a/Scripts/centos-art.sh/Functions/About/about.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# license.sh -- This function outputs centos-art.sh about messages. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function about { - - # Define command-line interface. - about_getActions - -} diff --git a/Scripts/centos-art.sh/Functions/About/about_getActions.sh b/Scripts/centos-art.sh/Functions/About/about_getActions.sh deleted file mode 100755 index 15d714b..0000000 --- a/Scripts/centos-art.sh/Functions/About/about_getActions.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# -# about_getActions.sh -- This function interpretes arguments passed to -# about functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function about_getActions { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="license,history,authors,copying" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Look for options passed through command-line. - while true; do - case "$1" in - - --license ) - ACTIONVAL="${FUNCCONFIG}/license.txt" - break - ;; - - --history ) - ACTIONVAL="${FUNCCONFIG}/history.txt" - break - ;; - - --authors ) - ACTIONVAL="${FUNCCONFIG}/authors.txt" - break - ;; - - --copying | * ) - ACTIONVAL="${FUNCCONFIG}/copying.txt" - break - ;; - - esac - done - - # Execute action name. - if [[ -f $ACTIONVAL ]];then - less $ACTIONVAL - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Brand/brandAnaconda.sh b/Scripts/centos-art.sh/Functions/Brand/brandAnaconda.sh deleted file mode 100644 index 8b215eb..0000000 --- a/Scripts/centos-art.sh/Functions/Brand/brandAnaconda.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/bash -# -# brandAnaconda - Anaconda branding script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function brandAnaconda { - - # Define file's source and target. - local ARTDIR=~/artwork/trunk/Identity/Themes/$(cli_getPathComponent '--theme')/Distro/Anaconda - local PIXMAP=/usr/share/anaconda/pixmaps - local SOURCE='' - local TARGET='' - - # Define list of files used as base to determine which files may - # need to be updated. Remove target from file path. Do not use - # basename command. We may need the directory structure (if any) - # under target, for further evaluation. - local FILES=$(find ${PIXMAP}/ | sort | uniq | sed "s!${PIXMAP}/!!g") - local FILE='' - - for FILE in $FILES;do - - # Define which file is release-specific, and specify the correct - # path on source. - case $FILE in - anaconda_header.png ) - SOURCE=$ARTDIR/Header/Img/$MAJOR_RELEASE/$FILE - TARGET=$PIXMAP/$FILE - ;; - - progress_first*.png | first*.png ) - SOURCE=$ARTDIR/Progress/Img/$MAJOR_RELEASE/$FILE - TARGET=$PIXMAP/$FILE - ;; - - rnotes | rnotes/?? | rnotes/??_?? ) - continue - ;; - - rnotes/??-*.png ) - FILE=$(basename $FILE | sed -r 's!-centos[0-9]+!!') - SOURCE=$ARTDIR/Progress/Img/$MAJOR_RELEASE/en/$FILE - TARGET=$PIXMAP/rnotes/$FILE - ;; - - rnotes/*/??-*.png ) - LANGUAGE=$(echo $FILE | sed -r 's!rnotes/(.+)/.*!\1!') - FILE=$(basename $FILE | sed -r 's!-centos[0-9]+!!') - SOURCE=$ARTDIR/Progress/Img/$MAJOR_RELEASE/$LANGUAGE/$FILE - TARGET=$PIXMAP/rnotes/$LANGUAGE/$FILE - ;; - - splash.png ) - SOURCE=$ARTDIR/Splash/Img/$MAJOR_RELEASE/$FILE - TARGET=$PIXMAP/$FILE - ;; - - syslinux-splash.png ) - TARGET=$PIXMAP/$FILE - FILE=$(echo $FILE | sed -r 's!\.png$!-16c.png!') - SOURCE=$ARTDIR/Prompt/Img/$MAJOR_RELEASE/$FILE - ;; - - * ) - TARGET=$PIXMAP/$FILE - SOURCE=$ARTDIR/$FILE - esac - - # Check if file exists on source. If file doesn't exist on the - # source it is not updated on target. Go to next file in the - # loop and check again. Only file names on source that match - # those in target are updated. - cli_checkFiles "$SOURCE" - - # File exists and will be installed on target. - cli_printMessage "$TARGET" "AsUpdatingLine" - - # Update file. - #cp $SOURCE $TARGET - - # Set file's access rights. - #chown root:root $TARGET - #chmod 755 $TARGET - #chcon system_u:object_r:usr_t $TARGET - -done -} diff --git a/Scripts/centos-art.sh/Functions/Brand/brandFirstboot.sh b/Scripts/centos-art.sh/Functions/Brand/brandFirstboot.sh deleted file mode 100755 index cb785d7..0000000 --- a/Scripts/centos-art.sh/Functions/Brand/brandFirstboot.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -# brandFirstboot - Firstboot branding script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function brandFirstboot { - - # Define file's source and target. - local ARTDIR=~/artwork/trunk/Identity/Themes/$(cli_getPathComponent '--theme')/Distro/Anaconda - local PIXMAP=/usr/share/firstboot/pixmaps - local SOURCE='' - local TARGET='' - - # Define list of files used as base to determine which files may - # need to be updated. Remove target from file path. Do not use - # basename command. We may need the directory structure (if any) - # under target, for further evaluation. - local FILES=$(find ${PIXMAP}/ | sort | uniq | sed "s!${PIXMAP}/!!g") - local FILE='' - - for FILE in $FILES;do - - # Define which file is release-specific, and specify the correct - # path on source. - case $FILE in - - splash-small.png ) - SOURCE=$ARTDIR/Firstboot/Img/$MAJOR_RELEASE/$FILE - TARGET=$PIXMAP/$FILE - ;; - - firstboot-left.png ) - SOURCE=$ARTDIR/Firstboot/Img/$FILE - TARGET=$PIXMAP/$FILE - ;; - - * ) - SOURCE=$ARTDIR/Firstboot/Img/$FILE - TARGET=$PIXMAP/$FILE - esac - - # Check if file exists on source. If file doesn't exist on the - # source it is not updated on target. Go to next file in the - # loop and check again. Only file names on source that match - # those in target are updated. - cli_checkFiles "$SOURCE" - - # File exists and will be installed on target. - cli_printMessage "$TARGET" "AsUpdatingLine" - - # Update file. - #cp $SOURCE $TARGET - - # Set file's access rights. - #chown root:root $TARGET - #chmod 755 $TARGET - #chcon system_u:object_r:usr_t $TARGET - - done -} diff --git a/Scripts/centos-art.sh/Functions/Html/Config/output_forHeadingsToc.awk b/Scripts/centos-art.sh/Functions/Html/Config/output_forHeadingsToc.awk deleted file mode 100644 index bcc0f21..0000000 --- a/Scripts/centos-art.sh/Functions/Html/Config/output_forHeadingsToc.awk +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/gawk -# -# output_forHadingsToc.awk -- This file provides the output format -# required by html_updateHeadings.sh function, inside centos-art.sh -# script. -# -# Copyright (C) 2009-2010 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -BEGIN {FS=":"} - -{ - if ($1 == 0 && $2 == $3) { - opentags = "
  • " - closetags = "" - } - - if ($1 > 0 && $2 > $3) { - opentags = "
    • " - closetags = "" - } - - if ($1 > 0 && $2 == $3) { - opentags = "
    • " - closetags = "" - } - - if ($1 > 0 && $2 < $3) { - opentags = "" - for (i = 1; i <= ($3 - $2); i++) { - opentags = opentags "
    " - closetags = "" - } - opentags = opentags "
  • " - } - - printf "%s%s%s\n",opentags,$4,closetags - -} - -END { - - if ($1 > 0 && $2 >= $3 && $3 > 1) { - for (i = 1; i <= $3; i++) { - print "
" - } - } - - if ($1 > 0 && $2 >= $3 && $3 == 1) { - print "" - print "" - } - - if ($1 > 0 && $2 < $3) { - for (i = 1; i <= $2; i++) { - print "" - } - } - - print "
" -} diff --git a/Scripts/centos-art.sh/Functions/Html/html.sh b/Scripts/centos-art.sh/Functions/Html/html.sh deleted file mode 100755 index 8b4cf95..0000000 --- a/Scripts/centos-art.sh/Functions/Html/html.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# html.sh -- This function provides very basic HTML manipulations to -# help maintain html files inside the repository. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function html { - - # Define command-line interface. - html_getActions - -} diff --git a/Scripts/centos-art.sh/Functions/Html/html_getActions.sh b/Scripts/centos-art.sh/Functions/Html/html_getActions.sh deleted file mode 100755 index dc29888..0000000 --- a/Scripts/centos-art.sh/Functions/Html/html_getActions.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# -# html_getActions.sh -- This function interprets arguments passed to -# `html' functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function html_getActions { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="update-headings:" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Define action to take for each option passed. - while true; do - case "$1" in - - --update-headings ) - - # Define action value passed through the command-line. - ACTIONVAL="$2" - - # Define action name using action value as reference. - ACTIONNAM="${FUNCNAM}_updateHeadings" - - # Rotate positional parameters. - shift 2 - ;; - - * ) - break - esac - done - - # Check action value. Be sure the action value matches the - # convenctions defined for source locations inside the working - # copy. - cli_checkRepoDirSource - - # Syncronize changes between the working copy and the central - # repository to bring down changes. - cli_commitRepoChanges - - # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then - eval $ACTIONNAM - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Syncronize changes between the working copy and the central - # repository to commit up changes. - cli_commitRepoChanges - -} diff --git a/Scripts/centos-art.sh/Functions/Html/html_updateHeadings.sh b/Scripts/centos-art.sh/Functions/Html/html_updateHeadings.sh deleted file mode 100644 index 9b1dc3a..0000000 --- a/Scripts/centos-art.sh/Functions/Html/html_updateHeadings.sh +++ /dev/null @@ -1,169 +0,0 @@ -#!/bin/bash -# -# html_updateHeadings.sh -- This function transforms html headings to -# to make them accessible (e.g., through a table of contents). -# -# - In order for this function to work, you need to put headings in -# just one line and they must have the following formats: -# -#

Title

-#

Title

-#

Title

-# -# In the above examples, h1 alternates from h1 to h6. Closing tag -# must be present and match the one opentaging. The value of and options are the md5sum of page -# location, plus the 'head-' string, plus the heading string. If -# heading title or page location changes, the values of and options will change too. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function html_updateHeadings { - - # Define variables as local to avoid conflicts outside. - local COUNT=0 - local FILE='' - local FILES='' - local PREVCOUNT=0 - local PATTERN='' - local -a FINAL - local -a TITLE - local -a MD5SM - local -a OPTNS - local -a LEVEL - local -a PARENT - local -a TOCENTRIES - local -a LINK - - # Define html heading regular expression pattern. Use parenthisis - # to save html action name, action value, and heading title. - PATTERN="(]>)(.*[^<])" - - # Define list of files to process. - FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}.*\.(xhtml|html|htm)") - - # Set action preamble. - cli_printActionPreamble "${FILES}" - - # Process list of files. - for FILE in $FILES;do - - # Verify list of html files. Are files really html files? If - # they don't, continue with the next one in the list. - if [[ ! $(file --brief $FILE) =~ '^(XHTML|HTML|XML)' ]];then - continue - fi - - # Output action message. - cli_printMessage $FILE 'AsUpdatingLine' - - # Define list of headings to process. When building the - # heading, it is required to change spaces characters from its - # current decimal output to something different (e.g., its - # \040 octal alternative). This is required because the space - # character is used as egrep default field separator and - # spaces can be present inside heading strings we don't want - # to separate. - for HEADING in $(egrep "$PATTERN" $FILE \ - | sed -r -e 's!^[[:space:]]+!!' -e "s! !\\\040!g");do - - # Define previous counter value using current counter - # value as reference. - if [[ $COUNT -ne 0 ]];then - PREVCOUNT=$(($COUNT-1)) - fi - - # Define initial heading information. - FIRST[$COUNT]=$(echo $HEADING | sed -r "s!\\\040! !g") - TITLE[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\3!") - MD5SM[$COUNT]=$(echo "${FILE}${FIRST[$COUNT]}" | md5sum | sed -r 's![[:space:]]+-$!!') - OPTNS[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\2!") - LEVEL[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\1!") - PARENT[$COUNT]=${LEVEL[$PREVCOUNT]} - - # Transform heading information using initial heading - # information as reference. - if [[ ${OPTNS[$COUNT]} =~ '^$' ]];then - OPTNS[$COUNT]='' - elif [[ ${OPTNS[$COUNT]} =~ '^$' ]];then - OPTNS[$COUNT]='' - elif [[ ${OPTNS[$COUNT]} =~ '^$' ]];then - OPTNS[$COUNT]='' - fi - - # Build final html heading structure. - FINAL[$COUNT]=''${OPTNS[$COUNT]}${TITLE[$COUNT]}'' - - # Build html heading link structure. These links are used - # by the table of contents later. - LINK[$COUNT]=''${TITLE[$COUNT]}'' - - # Build table of contents entry with numerical - # identifications. The numerical identification is what we - # use to determine the correct position of each heading - # link on the table of content. - TOCENTRIES[$COUNT]="$COUNT:${LEVEL[$COUNT]}:${PARENT[$COUNT]}:${LINK[$COUNT]}" - - # Update heading information inside the current file being - # processed. Use the first and final heading information. - sed -i -r "s!${FIRST[$COUNT]}!${FINAL[$COUNT]}!" $FILE - - # Increase heading counter. - COUNT=$(($COUNT + 1)) - - done - - # Build the table of contents using heading numerical - # identifications as reference. The numerical identification - # describes the order of headings in one html file. This - # information is processed by awk to make the appropriate - # replacements. Finnally, the result is stored in the TOC - # variable. - TOC=$(echo '
' - echo "

`gettext "Table of contents"`

" - for TOCENTRY in "${TOCENTRIES[@]}";do - echo $TOCENTRY - done \ - | awk -f /home/centos/artwork/trunk/Scripts/Bash/Functions/Html/Config/output_forHeadingsToc.awk) - - # Update table of contents inside the current file being - # processed. - sed -i -r '/
(.*)<\/div>/c'"$(echo -e $TOC)" $FILE - - # Reset counters. - COUNT=0 - PREVCOUNT=0 - - # Clean up variables to receive the next file. - unset FINAL - unset TITLE - unset MD5SM - unset OPTNS - unset LEVEL - unset PARENT - unset TOCENTRIES - unset LINK - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Brands/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Brands/render.conf.sh deleted file mode 100755 index d9bb979..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Brands/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines brands pre-rendition -# configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]='LAST:renderBrands' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Fonts/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Fonts/render.conf.sh deleted file mode 100755 index 8f03a3a..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Fonts/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines fonts pre-rendition -# configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]='POST:renderFormats: jpg pdf' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Models/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Models/render.conf.sh deleted file mode 100755 index 5c40a17..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Models/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines models pre-rendition -# configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]='POST:renderFormats: pdf jpg' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Backgrounds/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Backgrounds/render.conf.sh deleted file mode 100755 index 0f659be..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Backgrounds/render.conf.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines themes backgrounds -# pre-rendition configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]='POST:renderFormats: jpg' - ACTIONS[1]='POST:groupByType: png jpg' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Concept/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Concept/render.conf.sh deleted file mode 100755 index 632c8f9..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Concept/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines theme info -# pre-rendition configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]='POST:renderFormats: jpg pdf' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Anaconda/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Anaconda/render.conf.sh deleted file mode 100755 index 417c8b1..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Anaconda/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines Anaconda pre-rendition -# configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - #ACTIONS[0]='' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Firstboot/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Firstboot/render.conf.sh deleted file mode 100755 index b5fe32a..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Firstboot/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines firstboot -# pre-rendition configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - #ACTIONS[0]='' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Gdm/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Gdm/render.conf.sh deleted file mode 100755 index 6d7d094..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Gdm/render.conf.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines GNOME display manager -# (GDM) pre-rendition configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]="LAST:renderDm:Gdm:800x600 1024x768 1280x1024 1360x768 \ - 1680x1050 2048x1536 2560x960 2560x1240 3271x1227" - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Grub/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Grub/render.conf.sh deleted file mode 100755 index 59e1a10..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Grub/render.conf.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines GRUB pre-rendition -# configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]='POST:renderGrub:' - ACTIONS[1]='POST:renderGrub:-floyd' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Gsplash/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Gsplash/render.conf.sh deleted file mode 100755 index ed9d313..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Gsplash/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines GSplash pre-rendition -# configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - #ACTIONS[0]='' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Kdm/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Kdm/render.conf.sh deleted file mode 100755 index d241e51..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Kdm/render.conf.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines KDE display manager -# (KDM) pre-rendition configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]="LAST:renderDm:Kdm:800x600 1024x768 1280x1024 1360x768 \ - 1680x1050 2048x1536 2560x960 2560x1240 3271x1227" - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Ksplash/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Ksplash/render.conf.sh deleted file mode 100755 index a0aa21a..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Ksplash/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines KSplash pre-rendition -# configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]='LAST:renderKSplash' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Rhgb/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Rhgb/render.conf.sh deleted file mode 100755 index 60a4a49..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Rhgb/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines graphical boot (RHGB) -# pre-rendition configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - #ACTIONS[0]='' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Syslinux/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Syslinux/render.conf.sh deleted file mode 100755 index f91cc69..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Distro/Syslinux/render.conf.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines Syslinux pre-rendition -# configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]='POST:renderSyslinux:' - ACTIONS[1]='POST:renderSyslinux:-floyd' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Promo/Releases/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Promo/Releases/render.conf.sh deleted file mode 100755 index f4b6862..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Promo/Releases/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines release promotion -# pre-rendition configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - #ACTIONS[0]='' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Media/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Media/render.conf.sh deleted file mode 100755 index ef6ec48..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Media/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines installation media -# promotion pre-rendition configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - #ACTIONS[0]='' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Posters/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Posters/render.conf.sh deleted file mode 100755 index c63754b..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Themes/Promo/Stationery/Posters/render.conf.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines posters promotion -# pre-rendition configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - # Deifne theme model. - #THEMEMODEL='Default' - - # Define rendition actions. - ACTIONS[0]='POST:renderFormats: pdf jpg' - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Widgets/render.conf.sh b/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Widgets/render.conf.sh deleted file mode 100755 index 4f52452..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/Config/Identity/Widgets/render.conf.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# identity_loadConfig.sh -- This function defines widgets pre-rendition -# configuration script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_loadConfig { - - return - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity.sh b/Scripts/centos-art.sh/Functions/Identity/identity.sh deleted file mode 100644 index e66e31c..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# render.sh -- This function provides rendition features to -# centos-art.sh script. Here we initialize rendition variables and -# call identity_getActions functions. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity { - - # Define default value to target flag. The target flag (--to) - # controls final destination used by copy related actions. - local FLAG_TO='' - - # Define release number flag. The relesase number flag (--release) - # specifies the release number identity images are rendered for. - # By default no release number is used. - local FLAG_RELEASE='' - - # Define architecture flag. The architecture flag (--architecture) - # specifies the architecture type identity images are rendered - # for. By default no architecture type is used. - local FLAG_ARCHITECTURE='' - - # Define rendition actions. - identity_getActions - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_checkAbsolutePaths.sh b/Scripts/centos-art.sh/Functions/Identity/identity_checkAbsolutePaths.sh deleted file mode 100755 index 1e942e5..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_checkAbsolutePaths.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# identity_checkAbsolutePaths.sh -- This function retrives absolute -# files and checks their existence. In order for design templates to -# point different artistic motifs, design templates make use of -# external files that point to specific artistic motif background -# images. If such external files doesn't exist, print a message and -# stop script execution. We cannot continue without background -# information. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_checkAbsolutePaths { - - local FILE='' - local ABSPATHS='' - - # Define absolute path of file we need to retrive absolute paths - # from. - FILE="$1" - - # Verify existence of file we need to retrive absolute paths from. - cli_checkFiles $FILE 'f' - - # Retrive absolute paths from file. - ABSPATHS=$(egrep '="/[a-zA-Z0-9_./-]+" ' $FILE \ - | sed -r "s/ /\n/g" | egrep '(sodipodi:absref|xlink:href)=' \ - | sed -r "s/.+=\"(\/.+)\".*/\1/" | sort | uniq) - - # Verify absolute paths retrived from file. - for FILE in $ABSPATHS;do - cli_checkFiles $FILE - done - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_copy.sh b/Scripts/centos-art.sh/Functions/Identity/identity_copy.sh deleted file mode 100755 index b87d8bf..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_copy.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# -# identity_copy.sh -- This function duplicates rendition stuff. -# Rendition stuff is formed by design models, design images and -# pre-rendition configuration scripts (which includes translations -# files). This way, when we say to duplicate rendition stuff we are -# saying to duplicate these four directory structures (i.e., design -# models, design images, pre-rendition configuration scripts, and -# related translations files). -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_copy { - - # Verify target directory. - cli_checkRepoDirTarget - - # Determine what directory structure we are duplicating. - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_getActions.sh b/Scripts/centos-art.sh/Functions/Identity/identity_getActions.sh deleted file mode 100644 index ba02548..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_getActions.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/bash -# -# identity_getActions.sh -- This function interprets arguments passed to -# render functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_getActions { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="render:,release:,architecture:,copy:,to:" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Look for options passed through command-line. - while true; do - - case "$1" in - - --render ) - - # Redefine action name. - ACTIONNAM="${FUNCNAM}_render" - - # Redefine action value. - ACTIONVAL="$2" - - # Rotate positional parameters - shift 2 - ;; - - --copy ) - - # Redefine action value variable. - ACTIONVAL="$2" - - # Redefine action name variable. - ACTIONNAM="${FUNCNAME}_doCopy" - - # Rotate positional parameters - shift 2 - ;; - - --release ) - - # Redefine release number flag. - FLAG_RELEASE="$2" - - # Verify release number flag. - if [[ ! $FLAG_RELEASE =~ $(cli_getPathComponent '--release-pattern') ]];then - cli_printMessage "`gettext "The release number provided is not supported."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Rotate positional parameters - shift 2 - ;; - - --architecture ) - - # Redefine architecture flag. - FLAG_ARCHITECTURE="$2" - - # Verify architecture flag. - if [[ ! $FLAG_ARCHITECTURE =~ $(cli_getPathComponent '--architecture-pattern') ]];then - cli_printMessage "`gettext "The architecture provided is not supported."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Rotate positional parameters - shift 2 - ;; - - --to ) - - # Redefine target value flag. - FLAG_TO="$2" - - # Rotate positional parameters - shift 2 - ;; - - * ) - # Break options loop. - break - esac - done - - # Check action value. Be sure the action value matches the - # convenctions defined for source locations inside the working - # copy. - cli_checkRepoDirSource - - # Define pre-rendition configuration directory. Pre-rendition - # configuration directory is where we store render.conf.sh - # scripts. The render.conf.sh script defines how each identity - # content is rendered. - local ARTCONF=$(echo "$ACTIONVAL" \ - | sed -r -e 's!/(Identity)!/Scripts/Bash/Functions/Identity/Config/\1!' \ - -e "s!Motifs/$(cli_getPathComponent '--theme')/?!!") - - # Check directory of pre-rendition configuration script. - cli_checkFiles "$ARTCONF" 'd' - - # Syncronize changes between the working copy and the central - # repository to bring down changes. - cli_commitRepoChanges - - # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then - eval $ACTIONNAM - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Syncronize changes between the working copy and the central - # repository to commit up changes. - cli_commitRepoChanges - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_getConfig.sh b/Scripts/centos-art.sh/Functions/Identity/identity_getConfig.sh deleted file mode 100755 index fe459a6..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_getConfig.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# -# identity_getConfig.sh -- This function checks/validates variables -# passed from artwork-specific pre-rendition configuration files. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_getConfig { - - local POSTCOUNT=0 - local LASTCOUNT=0 - - # Re-define action variables in separated array variables. Once - # verification is done, we remove the BASE, POST, LAST parts from - # action definition in order to have the plain name of function to - # call. - for ACTION in "${ACTIONS[@]}"; do - - # Define post-rendition actions. - if [[ $ACTION =~ '^POST:' ]];then - ACTION=$(identity_getConfigOption "$ACTION" '2-') - POSTACTIONS[$POSTCOUNT]="$ACTION" - POSTCOUNT=$(($POSTCOUNT + 1)) - - # Define last-rendition actions. - elif [[ $ACTION =~ '^LAST:' ]];then - ACTION=$(identity_getConfigOption "$ACTION" '2-') - LASTACTIONS[$LASTCOUNT]="$ACTION" - LASTCOUNT=$(($LASTCOUNT + 1)) - fi - - done - - # Sanitate theme model value using repository directory name - # convenction. - THEMEMODEL=$(cli_getRepoName "$THEMEMODEL" 'd') - - # Check theme model directory. - cli_checkFiles "$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}" 'd' - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_getConfigOption.sh b/Scripts/centos-art.sh/Functions/Identity/identity_getConfigOption.sh deleted file mode 100755 index 2c78ef9..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_getConfigOption.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# identity_getConfigOption.sh -- This function standardizes the way -# action values are retrived from pre-rendition configuration files. -# Use this function whenever you need to retrive action values from -# pre-rendition configuration script. -# -# Usage: VAR=$(identity_getConfigOption "ACTION" "FIELD") -# -# VAR is the name of the variable where we store the option named -# returned by identity_getConfigOption. -# -# ACTION is the string definition set in the pre-rendition -# configuration script that holds the action name and its options -# fields. -# -# FIELD is the field number in the action string we want to retrive -# option from. By default options start from third field on. The first -# field is reserved for the action type (i.e., POST or LAST), and the -# second field is reserved for the action itself (e.g., renderFormats, -# renderSyslinux, renderKsplash, etc.). -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_getConfigOption { - - local ACTION="$1" - local FIELD="$2" - local VALUE='' - - # Check action value. The action's value must be present in order - # for this function to work. It provides the string needed to - # retrive options from. - if [[ "$ACTION" == '' ]];then - cli_printMessage "`gettext "There is no action to work with."`" - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Check field value. The field's value must match the cut's - # command specification of its -f option. - if [[ ! "$FIELD" =~ '^([0-9]+|[0-9]+-|-[0-9]+|[0-9]+-[0-9]+)$' ]];then - cli_printMessage "`gettext "The field specified is not valid."`" - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Get option from pre-rendition configuration action definition. - VALUE=$(echo -n "$ACTION" | cut -d: -f${FIELD}) - - # Sanitate action value passed from pre-rendition configuration - # action definition. - VALUE=$(echo -n "${VALUE}" \ - | sed -r 's!^ *!!g' \ - | sed -r 's!( |,|;) *! !g' \ - | sed -r 's! *$!!g') - - # Output action value without trailing newline. - echo -n "$VALUE" - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_getDirOutput.sh b/Scripts/centos-art.sh/Functions/Identity/identity_getDirOutput.sh deleted file mode 100644 index e28cbd4..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_getDirOutput.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# -# identity_getDirOutput.sh -- This function defines the final -# absolute path the centos-art.sh script uses to store identity -# contents produced at rendition time. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_getDirOutput { - - # Define base output directory using design model path as - # reference. By default rendered identity content is stored - # immediatly under identity entry structure, but if `Img/' - # directory exists use it instead. - OUTPUT=$(dirname $FILE | sed -r \ - -e "s!/Models/${THEMEMODEL}!/Motifs/$(cli_getPathComponent "$ACTIONVAL" "--theme")!" \ - -e "s!/Tpl!/Img!") - - # Redefine base output directory to introduce specific information - # like release number, architecture, etc. - OUTPUT=${OUTPUT}/${FLAG_RELEASE}/${FLAG_ARCHITECTURE} - - # Define whether to use or not locale-specific directory to store - # content, using current locale information as reference. As - # convenction, when we produce content in English language, we do - # not add a laguage-specific directory to organize content. - # However, when we produce language-specific content in a language - # different from English we do use language-specific directory to - # organize content. - if [[ ! $(cli_getCurrentLocale) =~ '^en' ]];then - OUTPUT=${OUTPUT}/$(cli_getCurrentLocale) - fi - - # Remove two or more consecutive slashes as well as the last - # remaining slash in the path. - OUTPUT=$(echo $OUTPUT | sed -r 's!/{2,}!/!g' | sed -r 's!/$!!') - - # Create final output directory, if it doesn't exist yet. - if [[ ! -d ${OUTPUT} ]];then - mkdir -p ${OUTPUT} - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_getDirTemplate.sh b/Scripts/centos-art.sh/Functions/Identity/identity_getDirTemplate.sh deleted file mode 100644 index e6c1ef5..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_getDirTemplate.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# -# identity_getDirTemplate.sh -- This function re-defines absolute -# path to artwork's related design templates directory. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_getDirTemplate { - - # Initialize design models location using action value as - # reference. - TEMPLATE=$ACTIONVAL - - # Sanitate design models location. Be sure design models do - # always point to trunk directory structure. This is useful to let - # `centos-art.sh' script do rendition under branches directory - # structure, reusing design models under trunk directory - # structure. - TEMPLATE=$(echo "$TEMPLATE" | sed "s!/branches/!/trunk/!") - - # Sanitate design models location using or not Tpl/ directory. - if [[ -d $TEMPLATE/Tpl ]];then - # Using Tpl/ directory is an obsolete practice that should be - # avoided. The concept of Tpl/ directory per artwork directory - # has been replaced by a common design model directory - # structure where we centralize design models for all - # different artistic motifs. However, there are some cases - # that we may need to use Tpl/ directory still, so we verify - # its existence and use it if present. - TEMPLATE=$TEMPLATE/Tpl - else - # Redefine design model location based on theme model - # (THEMEMODEL) variable value. The theme model variable is - # defined in the associated pre-rendition configuration script - # and can be used to set which design model to use among a - # list of different design models that we can choose from. - TEMPLATE=$(echo "$TEMPLATE" \ - | sed "s!Motifs/$(cli_getPathComponent "$TEMPLATE" '--theme')!Models/$THEMEMODEL!") - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_render.sh b/Scripts/centos-art.sh/Functions/Identity/identity_render.sh deleted file mode 100755 index f5eb19f..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_render.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -# -# identity_render.sh -- This function initiates rendition -# configuration functions and executes them to perform the rendition -# action specified in the `ACTIONS' array variable. Function -# initialization and execution is based on the absolute path -# convenction defined by ARTCONF variable. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id: identity_render.sh 824 2011-01-06 20:54:52Z al $ -# ---------------------------------------------------------------------- - -function identity_render { - - local FILE='' - - # Initialize artwork identification. - local ARTCOMP='' - - # Define default theme model. - local THEMEMODEL='Default' - - # Build list of files to process. - local FILES=$(cli_getFilesList "$ARTCONF" ".*/?render\.conf\.sh") - - # Set action preamble. - cli_printAction Preamble "$FILES" - - # Process list of files. - for FILE in $FILES;do - - # Output action message. - cli_printMessage $FILE 'AsConfigurationLine' - - # Define artwork-specific action arrays. We need to do this - # here because ACTIONS variable is unset after - # identity_renders execution. Otherwise, undesired - # concatenations may occur. - local -a ACTIONS - local -a POSTACTIONS - local -a LASTACTIONS - - # Initialize artwork-specific pre-rendition configuration - # (function) scripts. - . $FILE - - # Execute artwork-specific pre-rendition configuration - # (function) scripts to re-define artwork-specific ACTIONS. - identity_loadConfig - - # Check variables passed from artwork-specific pre-rendition - # configuration scripts and make required transformations. - identity_getConfig - - # Redefine action value (ACTIONVAL) based on pre-rendition - # configuration script path value. Otherwise, massive - # rendition may fail. Functions like renderImage need to know - # the exact artwork path (that is, where images will be - # stored). - ACTIONVAL=$(dirname $(echo $FILE | sed -r \ - -e 's!Scripts/Bash/Functions/Identity/Config/(Identity)/!\1/!' \ - -e "s!Themes/!Themes/Motifs/$(cli_getPathComponent '--theme')/!")) - - # Redefine artwork identification using redefined action - # value. - ARTCOMP=$(echo $ACTIONVAL | cut -d/ -f6-) - - # Remove motif name from artwork identification in order to - # reuse motif artwork identification. There is not need to - # create one artwork identification for each motif directory - # structure if we can reuse just one. - ARTCOMP=$(echo $ARTCOMP \ - | sed -r "s!Themes/Motifs/$(cli_getPathComponent '--theme')/!Themes/!") - - # Initiate base rendition using pre-rendition configuration - # files. - identity_renderBase - - # Unset artwork-specific actions so they can be redefined by - # artwork-specific pre-rendition configuration scripts. This - # is required in massive rendition. For example, if you say - # centos-art.sh to render the whole Distro directory it first - # renders Prompt entry, which defines the renderSyslinux - # post-rendition action, and later Progress entry which does - # not defines post-rendition actions. If we do not unset the - # ACTIONS variable, post-rendition actions defined in Prompt - # entry remain for Progress entry and that is not desired. We - # want ACTIONS to do what we exactly tell it to do inside each - # artwork-specific pre-rendition configuration script. - unset ACTIONS - unset POSTACTIONS - unset LASTACTIONS - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_renderBase.sh b/Scripts/centos-art.sh/Functions/Identity/identity_renderBase.sh deleted file mode 100755 index a280c38..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_renderBase.sh +++ /dev/null @@ -1,227 +0,0 @@ -#!/bin/bash -# -# identity_renderBase.sh -- This function initiates base rendition -# using pre-rendition configuration files. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderBase { - - local FILE='' - local FILES='' - local OUTPUT='' - local EXPORTID='' - local TEMPLATE='' - local COMMONDIR='' - local PARENTDIR='' - local TRANSLATION='' - local EXTERNALFILE='' - local EXTERNALFILES='' - local COMMONDIRCOUNT=0 - local -a COMMONDIRS - - # Redefine parent directory for current workplace. - PARENTDIR=$(basename "${ACTIONVAL}") - - # Define base location of template files. - identity_getDirTemplate - - # Define list of files to process. - FILES=$(cli_getFilesList "${TEMPLATE}" "${FLAG_FILTER}.*\.(svgz|svg)") - - # Set action preamble. - cli_printActionPreamble "$FILES" - - # Define common absolute paths in order to know when centos-art.sh - # is leaving a directory structure and entering into another. This - # information is required in order for centos-art.sh to know when - # to apply last-rendition actions. - for COMMONDIR in $(dirname "$FILES" | sort | uniq);do - COMMONDIRS[$COMMONDIRCOUNT]=$(dirname "$COMMONDIR") - COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1)) - done - - # Reset common directory counter. - COMMONDIRCOUNT=0 - - # Define export id used inside design templates. This value - # defines the design area we want to export. - EXPORTID='CENTOSARTWORK' - - # Start processing the base rendition list of FILES. Fun part - # approching :-). - for FILE in $FILES; do - - # Define final location of translation file. - TRANSLATION=$(dirname $FILE \ - | sed -r 's!/trunk/(Identity/)!/trunk/Locales/\1!')/$(cli_getCurrentLocale).po - - # Print final location of translation file. - if [[ ! -f "$TRANSLATION" ]];then - cli_printMessage "`gettext "None"`" "AsTranslationLine" - else - cli_printMessage "$TRANSLATION" 'AsTranslationLine' - fi - - # Define final location of template file. - TEMPLATE=${FILE} - - # Print final location of template file. - if [[ ! -f "$TEMPLATE" ]];then - cli_printMessage "`gettext "None"`" "AsDesignLine" - else - cli_printMessage "$TEMPLATE" 'AsDesignLine' - fi - - # Define final location of output directory. - identity_getDirOutput - - # Get relative path to file. The path string (stored in FILE) - # has two parts: 1. the variable path and 2. the common path. - # The variable path is before the common point in the path - # string. The common path is after the common point in the - # path string. The common point is the name of the parent - # directory (stored in PARENTDIR). - # - # trunk/Locales/Identity/.../Firstboot/3/splash-small.svg - # -------------------------^| the |^------------^ - # variable path | common | common path - # -------------------------v| point | v------------v - # trunk/Identity/Themes/M.../Firstboot/Img/3/splash-small.png - # - # What we do here is remove the varibale path, the common - # point, and the file extension parts in the string holding - # the path retrived from design models directory structure. - # Then we use the common path as relative path to store the - # the final image file. - # - # The file extension is removed from the common path because - # it is set when we create the final image file. This - # configuration let us use different extensions for the same - # file name. - # - # When we render using renderImage function, the structure of - # files under the output directory will be the same used after - # the common point in the related design model directory - # structure. - FILE=$(echo ${FILE} \ - | sed -r "s!.*${PARENTDIR}/!!" \ - | sed -r "s/\.(svgz|svg)$//") - - # Define absolute path to final file (without extension). - FILE=${OUTPUT}/$(basename "${FILE}") - - # Define instance name from design model. - INSTANCE=$(cli_getTemporalFile ${TEMPLATE}) - - if [[ -f ${TRANSLATION} ]];then - - # Create translated instance from design model. - /usr/bin/xml2po -p ${TRANSLATION} ${TEMPLATE} > ${INSTANCE} - - # Remove .xml2po.mo temporal file. - if [[ -f ${PWD}/.xml2po.mo ]];then - rm ${PWD}/.xml2po.mo - fi - - else - - # Create non-translated instance form design model. - /bin/cat ${TEMPLATE} > ${INSTANCE} - - fi - - # Apply replacement of translation markers to design model - # translated instance. - cli_replaceTMarkers ${INSTANCE} - - # Check export id inside design templates. - grep "id=\"$EXPORTID\"" $INSTANCE > /dev/null - if [[ $? -gt 0 ]];then - cli_printMessage "`eval_gettext "There is no export id (\\\$EXPORTID) inside \\\$TEMPLATE."`" "AsErrorLine" - cli_printMessage '-' 'AsSeparatorLine' - continue - fi - - # Check existence of external files. In order for design - # templates to point different artistic motifs, design - # templates make use of external files that point to specific - # artistic motif background images. If such external files - # doesn't exist, print a message and stop script execution. - # We cannot continue without background information. - identity_checkAbsolutePaths "$INSTANCE" - - # Render template instance and modify the inkscape output to - # reduce the amount of characters used in description column - # at final output. - cli_printMessage "$(inkscape $INSTANCE \ - --export-id=$EXPORTID --export-png=${FILE}.png | sed -r \ - -e "s!Area !`gettext "Area"`: !" \ - -e "s!Background RRGGBBAA:!`gettext "Background"`: RRGGBBAA!" \ - -e "s!Bitmap saved as:!`gettext "Saved as"`:!")" \ - 'AsRegularLine' - - # Remove template instance. - if [[ -a $INSTANCE ]];then - rm $INSTANCE - fi - - # Execute post-rendition actions. - identity_renderPostActions - - # Output separator line. - cli_printMessage '-' 'AsSeparatorLine' - - # Verify position of file being produced in the list of files - # been currently processed. As convenction, last-rendition - # actions are applied after all images inside the same - # directory structure have being produced. Notice that, in - # order to apply last-rendition actions correctly, - # centos-art.sh needs to "predict" what the last file in the - # same directory structure would be. There is no magic here, - # so we need to previously define which are the common - # directory structures centos-art.sh could produce content for - # inside an array variable. Later, using the index of that - # array variable we could check the next item in the array - # against the file being currently produced. If they match, we - # haven't reached the end of the same directory structure, but - # if they don't match, we do have reach the end of the same - # directory structure and it is time for last-rendition - # actions to be evaluated before go producing the next - # directory structure in the list of files to process. - if [[ $(dirname "$TEMPLATE") != ${COMMONDIRS[$(($COMMONDIRCOUNT + 1))]} ]];then - - # At this point centos-art.sh should be producing the last - # file from the same unique directory structure, so, - # before producing images for the next directory structure - # lets execute last-rendition actions for the current - # directory structure. - identity_renderLastActions - - fi - - # Increment common directory counter. - COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1)) - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_renderBrands.sh b/Scripts/centos-art.sh/Functions/Identity/identity_renderBrands.sh deleted file mode 100644 index 16a1049..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_renderBrands.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# -# identity_renderBrands.sh -- This function provides last-rendition -# actions to produce CentOS brands. This function takes both The -# CentOS Symbol and The CentOS Type images and produces variation of -# them in different dimensions and formats using ImageMagick tool-set. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderBrands { - - local SOURCEFILE='' - local TARGETDIR='' - local TARGETFILE='' - local NEWFILE='' - - # Define absolute path to image file. - local FILE="$1" - - # Define height dimensions you want to produce brands for. - local SIZES="16 20 22 24 32 36 40 48 64 96 128 148 164 196 200 512" - - # Define image formats you want to produce brands for. - local FORMATS="png xpm pdf jpg tif" - - # Redefine absolute path to directory where final brand images - # will be stored. Notice how both final image directory and design - # model have the same name, this is intentional in order to keep - # images and design models related and organized inside their own - # directory structures. - local DIRNAME=$(cli_getRepoName "$FILE" 'd')/$(cli_getRepoName "$FILE" 'fd') - - # Check directory where final brand images will be stored. - if [[ ! -d $DIRNAME ]];then - mkdir -p ${DIRNAME} - fi - - for SIZE in ${SIZES};do - - # Redefine name of new file. - NEWFILE=${DIRNAME}/${SIZE} - - for FORMAT in ${FORMATS};do - - # Output action information. - cli_printMessage "${NEWFILE}.${FORMAT}" "AsCreatingLine" - - # Convert and resize to create new file. - convert -resize x${SIZE} ${FILE}.png ${NEWFILE}.${FORMAT} - - done - - # Create logo copy in 2 colors. - cli_printMessage "${NEWFILE}.xbm (`gettext "2 colors grayscale"`)" "AsCreatingLine" - convert -resize x${SIZE} -colorspace gray -colors 2 ${FILE}.png ${NEWFILE}.xbm - - # Create logo copy in emboss effect. - cli_printMessage "${NEWFILE}-emboss.png" "AsCreatingLine" - convert -resize x${SIZE} -emboss 1 ${FILE}.png ${NEWFILE}-emboss.png - - done - - # Output division line. - cli_printMessage '-' 'AsSeparatorLine' -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_renderDm.sh b/Scripts/centos-art.sh/Functions/Identity/identity_renderDm.sh deleted file mode 100755 index bc7780e..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_renderDm.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/bash -# -# identity_renderDm.sh -- This function collects Display Manager (DM) -# required files and creates a tar.gz package that groups them all -# together. Use this function as last-rendition action for Gdm and Kdm -# base-rendition actions. -# -# Usage: -# -# ACTIONS[1]='LAST:renderDm:TYPE:RESOLUTION' -# -# Where: -# -# TYPE can be either `Gdm' or `Kdm'. These values correspond to the -# directory names used to store related design models. -# -# RESOLUTION represents the screen resolution tar.gz files are -# produced for (e.g., 800x600, 1024x768, 2048x1536, etc.). -# -# In order to produce tar.gz files correctly, both screen resolution -# definition inside pre-rendition configuration script and background -# name inside theme directory structure need to match one another. If -# one screen resolution is defined correctly, but there is no -# background information for it, the related tar.gz file is not -# produced and the next file in the list of files to process is -# evaluated. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderDm { - - local -a SRC - local -a DST - local DM='' - local TGZ='' - local COUNT=0 - local RESOLUTION='' - local RESOLUTIONS='' - - # Get display manager passed from render.conf.sh pre-rendition - # configuration script. - DM=$(identity_getConfigOption "${ACTION}" '2') - - # Sanitate display manager passed from render.conf.sh - # pre-rendition configuration script. Whatever value be retrived - # as display manager configuration option is converted to - # uppercase in order to match either Gdm or Kdm design model - # directory structures. - DM=$(cli_getRepoName "$DM" 'd') - - # Get screen resolutions passed from render.conf.sh pre-rendition - # configuration script. - RESOLUTIONS=$(identity_getConfigOption "${ACTION}" '3') - - # Check screen resolutions passed from render.conf.sh - # pre-rendition configuration script. - if [[ "$RESOLUTIONS" == '' ]];then - cli_printMessage "`gettext "There is no resolution information to process."`" 'AsErrorLine' - cli_printMessage $(caller) "AsToKnowMoreLine" - fi - - # Define source files using absolute paths. - SRC[0]=$(cli_getRepoTLDir)/Identity/Brands/Img/Symbol/48.png - SRC[1]=${OUTPUT}/release.png - SRC[2]=${OUTPUT}/screenshot.png - SRC[3]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/GdmGreeterTheme.xml - SRC[4]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/GdmGreeterTheme.desktop - SRC[5]=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Backgrounds/Img/Png - SRC[6]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-language.png - SRC[7]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-reboot.png - SRC[8]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-session.png - SRC[9]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-shutdown.png - - # Define name used as temporal holder to build tar.gz file. - TGZ=$(cli_getPathComponent '--theme-name') - - # Define target files using relative paths. - DST[0]=${TGZ}/centos-symbol.png - DST[1]=${TGZ}/centos-release.png - DST[2]=${TGZ}/screenshot.png - DST[3]=${TGZ}/${TGZ}.xml - DST[4]=${TGZ}/GdmGreeterTheme.desktop - DST[5]=${TGZ}/background.png - DST[6]=${TGZ}/icon-language.png - DST[7]=${TGZ}/icon-reboot.png - DST[8]=${TGZ}/icon-session.png - DST[9]=${TGZ}/icon-shutdown.png - - # Move into the working directory. - pushd ${OUTPUT} > /dev/null - - # Create directory used as temporal holder to build tar.gz file. - if [[ ! -d ${TGZ} ]];then - mkdir ${TGZ} - fi - - for RESOLUTION in $RESOLUTIONS;do - - while [[ $COUNT -lt ${#SRC[*]} ]];do - - if [[ $COUNT -eq 5 ]];then - - # Redefine background information using resolution as - # reference. Avoid concatenation. - SRC[$COUNT]=$(echo "${SRC[$COUNT]}" | cut -d/ -f-13)/${RESOLUTION}-final.png - - # If background information defined inside - # pre-rendition configuration script doesn't match - # background information inside theme-specific - # backgrounds directory structure, try the next - # background definition. - if [[ ! -f ${SRC[$COUNT]} ]];then - continue 2 - fi - - elif [[ $COUNT =~ '^[6-9]$' ]];then - - # If display manager is Kdm, then increment counter and - # resume the next iteration. Icons aren't used on Kdm, - # so there's no need to have them inside it. - if [[ $DM =~ '^Kdm$' ]];then - COUNT=$(($COUNT + 1)) - continue - fi - - fi - - # Check existence of source files. - cli_checkFiles ${SRC[$COUNT]} - - # Copy files from source to target location. - cp ${SRC[$COUNT]} ${DST[$COUNT]} - - # Replace common translation markers from design model - # files with appropriate information. - if [[ $COUNT =~ '^(3|4)$' ]];then - cli_replaceTMarkers "${DST[$COUNT]}" - fi - - # Increment counter. - COUNT=$(($COUNT + 1)) - - done - - # Reset counter. - COUNT=0 - - # Print action message. - cli_printMessage "${OUTPUT}/${RESOLUTION}.tar.gz" "AsCreatingLine" - - # Create tar.gz file. - tar -czf "${RESOLUTION}.tar.gz" $TGZ - - done - - # Remove directory used as temporal holder to build targ.gz - # file. - rm -r $TGZ - - # Remove release-specific images. - cli_printMessage "${SRC[1]}" "AsDeletingLine" - rm ${SRC[1]} - cli_printMessage "${SRC[2]}" "AsDeletingLine" - rm ${SRC[2]} - - # Return to where we were initially. - popd > /dev/null - - # Output division rule. - cli_printMessage '-' 'AsSeparatorLine' - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_renderFormats.sh b/Scripts/centos-art.sh/Functions/Identity/identity_renderFormats.sh deleted file mode 100644 index 7712dc9..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_renderFormats.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# -# identity_renderFormats.sh -- This function provides post-rendition -# action used to convert images from PNG to different image formats. -# This function uses ImageMagick command line image manipulation tool -# set to convert the base PNG image to as many formats as ImageMagick -# supports. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderFormats { - - # Get image formats. - local FORMATS=$(identity_getConfigOption "$ACTION" '2-') - - # Check base file existence. - if [[ -f ${FILE}.png ]];then - - # Check image formats. - if [[ "$FORMATS" != "" ]];then - - # Loop through image formats and do format convertion using - # PNG file as base. - for FORMAT in $FORMATS;do - cli_printMessage "${FILE}.${FORMAT}" "AsSavedAsLine" - convert -quality 85 ${FILE}.png ${FILE}.${FORMAT} - done - - fi - - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_renderGroupByType.sh b/Scripts/centos-art.sh/Functions/Identity/identity_renderGroupByType.sh deleted file mode 100755 index 0f03e44..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_renderGroupByType.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -# -# identity_renderGroupByTypes.sh -- This function provides -# post-rendition action to group files inside directories named as -# their file extensions. For example: if the current file is a .png -# file, it is moved inside a Png/ directory; if the current file is a -# .jpg file, it is stored inside a Jpg/ directory, and so on. -# -# For this function to work correctly, you need to specify which file -# type you want to group. This is done in the post-rendition ACTIONS -# array inside the appropriate `render.conf.sh' pre-configuration -# script. This function cannot be used as last-rendition action. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderGroupByType { - - local SOURCE='' - local TARGET='' - - # Sanitate file types passed from render.conf.sh pre-rendition - # configuration script. - local FORMATS=$(identity_getConfigOption "$ACTION" '2-') - - for FORMAT in $FORMATS;do - - # Redifine source file we want to move. - SOURCE=${FILE}.${FORMAT} - - # Define target directory where source file will be moved - # into. - TARGET=$(dirname "$FILE")/$(cli_getRepoName "$FORMAT" 'd') - - # Check existence of source file. - cli_checkFiles $SOURCE 'f' - - # Check existence of target directory. - if [[ ! -d $TARGET ]];then - mkdir -p $TARGET - fi - - # Redifine file path to add file and its type. - TARGET=${TARGET}/$(cli_getRepoName "$FILE" 'f').${FORMAT} - - # Move file into its final location. - cli_printMessage "$TARGET" 'AsMovedToLine' - mv ${SOURCE} ${TARGET} - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_renderGrub.sh b/Scripts/centos-art.sh/Functions/Identity/identity_renderGrub.sh deleted file mode 100644 index c9ebecb..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_renderGrub.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -# -# identity_renderGrub.sh -- This function provides post-rendition -# action used to produce GRUB images. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderGrub { - - # Define 16 colors images default file name prefix. - local PREFIX='-14c' - - # Define options using those passed to actions from pre-rendition - # configuration script. These options are applied to pnmremap when - # doing color reduction, so any option available for pnmremap - # command can be passed to renderSyslinux functionality. - local OPTIONS=$(identity_getConfigOption "$ACTION" '2-') - - # Re-define 16 colors images default file name prefix using - # options as reference. This is useful to differenciate final - # files produced using Floyd-Steinberg dithering and files which - # do not. - if [[ "$OPTIONS" =~ '-floyd' ]];then - PREFIX="${PREFIX}-floyd" - fi - - # Check options passed to action. This is required in order to - # aviod using options used already in this script. For example - # -verbose and -mapfile options. - for OPTION in $OPTIONS;do - # Remove anything after equal sign inside option. - OPTION=$(echo -n $OPTION | cut -d'=' -f1) - if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then - cli_printMessage "`eval_gettext "The \\\$OPTION option is already used."`" - cli_printMessage "$(caller)" "AsToKnowMoreLine" - fi - done - - # Define motif's palette location. - local PALETTES=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Colors - - # Define the Netpbm color palettes used when reducing colors. - # These palettes should be 14 colors based. For more information - # on this see the GRUB's documentation. - local PALETTE_PPM=$PALETTES/grub.ppm - - # Print which palette of colors centos-art.sh script is using to - # produce grub content. This is relevant in order to know if we - # are using whether trunk or branches palette of colors. - cli_printMessage "$PALETTE_PPM" 'AsPaletteLine' - - # Check GRUB's palettes existence: If there is no palette assume - # that this is the first time you are rendition GRUB images. If - # that is the case the script will provide you with the PNG format - # which should be used as base to produce (using GIMP) the .gpl - # palette. The .gpl palette information is used to produced - # (using GIMP) the colormap (.ppm) which is used to automate the - # GRUB's 14 colors image (splash.png) rendition. If there is no - # palette available, do not apply color reduction, show a message, - # and continue. - cli_checkFiles $PALETTE_PPM - - # Create Netpbm superformat (PNM). PNM file is created from the - # PNG image rendered previously. PNM is a common point for image - # manipulation using Netpbm tools. - cli_printMessage "${FILE}.pnm" "AsSavedAsLine" - pngtopnm -verbose \ - < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm - - # Reduce colors as specified in ppm palette of colors. - cli_printMessage "${FILE}${PREFIX}.ppm" "AsSavedAsLine" - pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ - < ${FILE}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.ppm - - # Create the 14 colors xpm.gz file. - cli_printMessage "${FILE}${PREFIX}.xpm.gz" "AsSavedAsLine" - ppmtoxpm \ - < ${FILE}${PREFIX}.ppm 2>>${FILE}.log > ${FILE}.xpm \ - && gzip --force ${FILE}.xpm \ - && mv ${FILE}.xpm.gz ${FILE}${PREFIX}.xpm.gz - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_renderKsplash.sh b/Scripts/centos-art.sh/Functions/Identity/identity_renderKsplash.sh deleted file mode 100755 index f88f0e9..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_renderKsplash.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# -# identity_renderKsplash.sh -- This function collects KDE splash -# (KSplash) required files and creates a tar.gz package that groups -# them all together. Use this function as last-rendition action for -# KSplash base-rendition action. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderKsplash { - - local -a SRC - local -a DST - local FONT='' - local COUNT=0 - - # Define font used to print bottom splash message. - FONT=$(cli_getRepoTLDir)/Identity/Fonts/DejaVuLGCSans-Bold.ttf - - # Check existence of font file. - cli_checkFiles "$FONT" 'f' - - # Define absolute source location of files. - SRC[0]="${OUTPUT}/splash_top.png" - SRC[1]="${OUTPUT}/splash_active_bar.png" - SRC[2]="${OUTPUT}/splash_inactive_bar.png" - SRC[3]="${OUTPUT}/splash_bottom.png" - SRC[4]="$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/Ksplash/Theme.rc" - - # Check absolute source location of files. - cli_checkFiles "${SRC[@]}" 'f' - - # Define relative target location of files. - DST[0]="${OUTPUT}/splash_top.png" - DST[1]="${OUTPUT}/splash_active_bar.png" - DST[2]="${OUTPUT}/splash_inactive_bar.png" - DST[3]="${OUTPUT}/splash_bottom.png" - DST[4]="${OUTPUT}/Theme.rc" - - # Print action message. - cli_printMessage "${OUTPUT}/Preview.png" 'AsCreatingLine' - - # Create `Preview.png' image. - convert -append ${SRC[0]} ${SRC[1]} ${SRC[3]} ${OUTPUT}/Preview.png - - # Add bottom text to Preview.png image. The text position was set - # inside an image of 400x300 pixels. If you change the final - # preview image dimension, you probably need to change the text - # position too. - mogrify -draw 'text 6,295 "KDE is up and running."' \ - -fill \#ffffff \ - -font $FONT \ - ${OUTPUT}/Preview.png - - # Copy `Theme.rc' file. - cp ${SRC[4]} ${DST[4]} - - # Apply common translation markers to Theme.rc file. - cli_replaceTMarkers "${DST[4]}" - - # Print separator line. - cli_printMessage '-' 'AsSeparatorLine' - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_renderLastActions.sh b/Scripts/centos-art.sh/Functions/Identity/identity_renderLastActions.sh deleted file mode 100755 index 0311b5d..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_renderLastActions.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# -# identity_renderLastActions.sh -- This function executes -# last-rendition actions. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderLastActions { - - local ACTION='' - - for ACTION in "${LASTACTIONS[@]}"; do - - case "${ACTION}" in - - renderKSplash ) - identity_renderKsplash - ;; - - renderDm:* ) - identity_renderDm - ;; - - groupByType:* ) - identity_renderGroupByType - ;; - esac - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_renderPostActions.sh b/Scripts/centos-art.sh/Functions/Identity/identity_renderPostActions.sh deleted file mode 100755 index 4cde273..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_renderPostActions.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# identity_renderPostActions.sh -- This function executes -# post-rendition actions. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderPostActions { - - local ACTION='' - - for ACTION in "${POSTACTIONS[@]}"; do - - case "${ACTION}" in - - renderSyslinux* ) - identity_renderSyslinux - ;; - - renderGrub* ) - identity_renderGrub - ;; - - renderFormats:* ) - identity_renderFormats - ;; - - groupByType:* ) - identity_renderGroupByType - ;; - - renderBrands ) - identity_renderBrands - ;; - - esac - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Identity/identity_renderSyslinux.sh b/Scripts/centos-art.sh/Functions/Identity/identity_renderSyslinux.sh deleted file mode 100755 index 1346ac3..0000000 --- a/Scripts/centos-art.sh/Functions/Identity/identity_renderSyslinux.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/bash -# -# identity_renderSyslinux.sh -- This function provides post-rendition -# action used to produce syslinux images. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderSyslinux { - - # Define 16 colors images default file name prefix. - local PREFIX='-16c' - - # Define options using those passed to actions from pre-rendition - # configuration script. These options are applied to pnmremap when - # doing color reduction, so any option available for pnmremap - # command can be passed to renderSyslinux functionality. - local OPTIONS=$(identity_getConfigOption "$ACTION" '2-') - - # Check options passed to action. This is required in order to - # aviod using options used already in this script. For example - # -verbose and -mapfile options. - for OPTION in $OPTIONS;do - # Remove anything after equal sign inside option. - OPTION=$(echo $OPTION | cut -d'=' -f1) - if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then - cli_printMessage "`eval_gettext "The \\\$OPTION option is already used."`" - cli_printMessage "$(caller)" "AsToKnowMoreLine" - fi - done - - # Re-define 16 colors images default file name prefix using - # options as reference. This is useful to differenciate final - # files produced using Floyd-Steinberg dithering and final files - # which are not. - if [[ "$OPTIONS" =~ '-floyd' ]];then - PREFIX="${PREFIX}-floyd" - fi - - # Define motif's palette location. - local PALETTES=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Colors - - # Define the Netpbm color palette used when reducing colors. This - # palette should be 16 colors based. For more information on this - # see the isolinux documentation. - local PALETTE_PPM=$PALETTES/syslinux.ppm - - # Define hexadecimal color information used by ppmtolss16. Color - # information and order used on PALETTE_HEX and PALETTE_PPM should - # match exactly. - local PALETTE_HEX=$PALETTES/syslinux.hex - - # Print which palette of colors centos-art.sh script is using to - # produce grub content. This is relevant in order to know if we - # are using whether trunk or branches palette of colors. - cli_printMessage "$PALETTE_PPM" 'AsPaletteLine' - cli_printMessage "$PALETTE_HEX" 'AsPaletteLine' - - # Check syslinux's palettes existence: If there is no palette - # assume that this is the first time you are rendition syslinux - # images. If that is the case the script will provide you with the - # PNG format which should be used as base to produce (using GIMP) - # the .gpl palette. The .gpl palette information is used to - # produced (using GIMP) the colormap (.ppm) which is used to - # automate the syslinux's 16 colors image (syslinux-splash.png) - # rendition. If there is no palette available, do not apply color - # reduction, show a message, and continue. - cli_checkFiles $PALETTE_PPM - cli_checkFiles $PALETTE_HEX - - # Create Netpbm superformat (PNM). PNM file is created from the - # PNG image rendered previously. PNM is a common point for image - # manipulation using Netpbm tools. - cli_printMessage "${FILE}.pnm" "AsSavedAsLine" - pngtopnm -verbose \ - < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm - - # Reduce colors. Here we use the Netpbm color $PALETTE_PPM to - # enforce the color position in the image index and the - # Floyd-Steinberg dithering in order to improve color reduction. - cli_printMessage "${FILE}${PREFIX}.pnm" "AsSavedAsLine" - pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ - < ${FILE}.pnm 2>> ${FILE}.log > ${FILE}${PREFIX}.pnm - - # Create LSS16 image. As specified in isolinux documentation the - # background color should be indexed on position 0 and forground - # in position 7 (see /usr/share/doc/syslinux-X.XX/isolinux.doc). - # This order of colors is specified in $PALETTE_PPM and redefined - # here again for the LSS16 image format. Both $PALETTE_PPM and - # LSS16 color map redefinition ($PALETTE_HEX) should have the same - # colors and index order. PALETTE_HEX should return just one line - # with the color information as described in isolinux - # documentation (i.e #RRGGBB=0 #RRGGBB=1 ... [all values in the - # same line]). - cli_printMessage "${FILE}${PREFIX}.lss" "AsSavedAsLine" - PALETTE_HEX=$(cat $PALETTE_HEX | tr "\n" ' ' | tr -s ' ') - ppmtolss16 $PALETTE_HEX \ - < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.lss - - # Create the PPM image indexed to 16 colors. Also the colormap - # used in the LSS16 image is saved on ${FILE}.log; this is useful to - # verify the correct order of colors in the image index. - cli_printMessage "${FILE}${PREFIX}.ppm" "AsSavedAsLine" - lss16toppm -map \ - < ${FILE}${PREFIX}.lss 2>>${FILE}.log > ${FILE}${PREFIX}.ppm - - # Create the 16 colors PNG image. - cli_printMessage "${FILE}${PREFIX}.png" "AsSavedAsLine" - pnmtopng -verbose -palette=$PALETTE_PPM \ - < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.png - -} diff --git a/Scripts/centos-art.sh/Functions/Locale/locale.sh b/Scripts/centos-art.sh/Functions/Locale/locale.sh deleted file mode 100644 index a64e3ed..0000000 --- a/Scripts/centos-art.sh/Functions/Locale/locale.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# locale.sh -- This function provides internationalization features -# for centos-art.sh script through gettext standard processes. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function locale { - - # Initialize default value to create/update machine object flag. - # The machine object flag (--dont-create-mo) controls whether - # centos-art.sh script does create/update the machine object - # related object or not. - local FLAG_DONT_CREATE_MO='false' - - # Define the command-line interface. - locale_getActions - -} diff --git a/Scripts/centos-art.sh/Functions/Locale/locale_editMessages.sh b/Scripts/centos-art.sh/Functions/Locale/locale_editMessages.sh deleted file mode 100755 index 2dfbdf7..0000000 --- a/Scripts/centos-art.sh/Functions/Locale/locale_editMessages.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# -# locale_editMessages.sh -- This function edits portable objects (.po) -# using default text editor. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function locale_editMessages { - - local FILES='' - - # Define list of files to process. In order to make edition - # easier for translators, the current locale information is used - # to determine which portable object to edit. If filter flag is - # set to something else but its default value (i.e., it was - # specified in the command line), the value entered is used - # instead. - if [[ $FLAG_FILTER == '.+' ]];then - FILES=$(cli_getFilesList "${WORKDIR}" "$(cli_getCurrentLocale).*\.po") - else - FILES=$(cli_getFilesList "${WORKDIR}" "${FLAG_FILTER}.*\.po") - fi - - # Set action preamble. - cli_printActionPreamble "${FILES}" "doEdit" 'AsResponseLine' - - # Use default text editor to edit files. - eval ${EDITOR} ${FILES} - - # Update machine object (.mo) from portable object (.po). - locale_updateMessageBinary ${FILES} - -} diff --git a/Scripts/centos-art.sh/Functions/Locale/locale_getActions.sh b/Scripts/centos-art.sh/Functions/Locale/locale_getActions.sh deleted file mode 100644 index 25425d0..0000000 --- a/Scripts/centos-art.sh/Functions/Locale/locale_getActions.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash -# -# locale_getActions.sh -- This function interprets arguments passed to -# `locale' functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function locale_getActions { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="update:,edit:,dont-create-mo" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Look for options passed through command-line. - while true; do - case "$1" in - - --update ) - - # Redefine action name. - ACTIONNAM="${FUNCNAM}_updateMessages" - - # Redefine action value. - ACTIONVAL="$2" - - # Rotate positional parameters - shift 2 - ;; - - --edit ) - - # Redefine action name. - ACTIONNAM="${FUNCNAM}_editMessages" - - # Redefine action value. - ACTIONVAL="$2" - - # Rotate positional parameters - shift 2 - ;; - - --dont-create-mo ) - - # Redefine create machine object flag. - FLAG_DONT_CREATE_MO="true" - - # Rotate positional parameters - shift 1 - ;; - - * ) - break - ;; - esac - done - - # Check action value. Be sure the action value matches the - # convenctions defined for source locations inside the working - # copy. - cli_checkRepoDirSource - - # Define locales base directory where locale directory structures - # are stored in. - local BASEDIR="$(cli_getRepoTLDir)/Locales" - - # Define locales work directory. This is the place where locale - # files (e.g., .po, .pot, .mo), for a specific parent directories, - # are stored in. There is one locale work directory for each - # parent directory or said differently, each parent directory has - # a parallel directory under `trunk/Locales' to store its - # translation messages. - local WORKDIR=$(echo $ACTIONVAL | sed -r \ - -e 's!trunk/(Identity|Manuals|Scripts)!trunk/Locales/\1!') - - # Syncronize changes between the working copy and the central - # repository to bring down changes. - cli_commitRepoChanges "${WORKDIR}" - - # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then - eval $ACTIONNAM - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Syncronize changes between the working copy and the central - # repository to commit up changes. - cli_commitRepoChanges "${WORKDIR}" - -} diff --git a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageBinary.sh b/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageBinary.sh deleted file mode 100755 index a4907e2..0000000 --- a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageBinary.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# -# locale_updateMessageBinary.sh -- This function creates/updates -# machine objects (.mo) from portable objects (.po). -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function locale_updateMessageBinary { - - # Verify machine object creation flag. - if [[ ${FLAG_DONT_CREATE_MO} == 'true' ]];then - return - fi - - local PO='' - local MO='' - local FILE='' - local FILES="$1" - - for FILE in $FILES;do - - # Verify existence of portable object. - cli_checkFiles "${FILE}" 'f' - - # Define absolute path to portable object. - PO=$FILE - - # Define absolute path to machine object. - MO=$(dirname ${PO})/LC_MESSAGES/$(basename ${PO} | sed -r 's!\.po$!.mo!') - - # Print action message. - if [[ -f ${MO} ]];then - cli_printMessage "${MO}" 'AsUpdatingLine' - else - cli_printMessage "${MO}" 'AsCreatingLine' - fi - - # Define directory used to store machine object. - MODIR=$(dirname ${MO}) - - # Create directory to store machine object, if it doesn't - # exist. - if [[ ! -d ${MODIR} ]];then - mkdir -p ${MODIR} - fi - - # Create machine object from portable object. - msgfmt --check ${PO} --output-file=${MO} - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageMetadata.sh b/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageMetadata.sh deleted file mode 100755 index 5f9bd04..0000000 --- a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageMetadata.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# -# locale_updateMessageMetadata.sh -- This function sanitates .pot and -# .po files to use common translation markers inside top comment. -# Later, replacement of common translation markers is applied to set -# the final information. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id4 -# ---------------------------------------------------------------------- - -function locale_updateMessageMetadata { - - local COUNT=0 - local -a SRC - local -a DST - - # Retrive absolute path of portable object we'll work with. - local FILE="$1" - - # Define current locale. - local CURRENTLOCALE=$(cli_getCurrentLocale) - - # Define language name from current locale. - local LANGNAME=$(cli_getLangName ${CURRENTLOCALE}) - - # Check existence of file before work with it. - cli_checkFiles "${FILE}" 'f' - - # Define pattern lines. The pattern lines are put inside portable - # objects through xgettext and xml2po commands . - SRC[0]='Project-Id-Version:' - SRC[1]='Report-Msgid-Bugs-To:' - SRC[2]='Last-Translator:' - SRC[3]='Language-Team:' - - # Define replacement lines for pattern line. - DST[0]="\"Project-Id-Version: ${CLINAME} (${CURRENTLOCALE})\\\n\"" - DST[1]="\"Report-Msgid-Bugs-To: =MAIL_DOCS=\\\n\"" - DST[2]="\"Last-Translator: CentOS Documentation SIG\\\n\"" - DST[3]="\"Language-Team: ${LANGNAME}\\\n\"" - - # Change pattern lines with their replacement lines. - while [[ $COUNT -lt ${#SRC[*]} ]];do - sed -i -r "/${SRC[$COUNT]}/c${DST[$COUNT]}" ${FILE} - COUNT=$(($COUNT + 1)) - done - - # Replace package information using gettext domain information. - sed -i -r "s/PACKAGE/${TEXTDOMAIN}/g" ${FILE} - - # Unset array variables to avoid undesired concatenations. - unset SRC - unset DST - -} diff --git a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessagePObjects.sh b/Scripts/centos-art.sh/Functions/Locale/locale_updateMessagePObjects.sh deleted file mode 100755 index 2c8182a..0000000 --- a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessagePObjects.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# -# locale_updateMessagePObjects.sh --- This function verifies, -# initializes or updates portable objects from portable object -# templates. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function locale_updateMessagePObjects { - - local FILE="$1" - - # Verify the portable object template. The portable object - # template is used to create the portable object. - cli_checkFiles "${FILE}.pot" 'f' - - # Verify existence of portable object. The portable object is the - # file translators edit in order to make translation works. - if [[ -f ${FILE}.po ]];then - - # Print action message. - cli_printMessage "${FILE}.po" 'AsUpdatingLine' - - # Update portable object merging both portable object and - # portable object template. - msgmerge --output="${FILE}.po" "${FILE}.po" "${FILE}.pot" --quiet - - else - - # Print action message and initiate portable object using - # portable object template. There is no `--quiet' option for - # msginit command that let to separate both printing action - # message and creation command apart one from another so we - # have to play with stderr and stdout outputs to print the - # action message as we usually do. - cli_printMessage $(msginit -i ${FILE}.pot -o ${FILE}.po --width=70 \ - --no-translator 2>&1 | cut -d' ' -f2 | sed -r 's!\.$!!') 'AsCreatingLine' - - # Sanitate portable object metadata. This is the first time - # the portable object is created so some modifications are - # needed to customized metadata. - locale_updateMessageMetadata "${FILE}.po" - - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageShell.sh b/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageShell.sh deleted file mode 100755 index 055475e..0000000 --- a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageShell.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# -# locale_updateMessageShell.sh -- This function parses shell scripts -# under action value, retrives translatable strings and -# creates/updates both portable object templates (.pot) and portable -# objects (.po). -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function locale_updateMessageShell { - - local FILE='' - local FILES='' - - # Define file name used as reference to create portable object - # templates (.pot), portable objects (.po) and machine objects - # (.mo). - FILE="${WORKDIR}/$(cli_getCurrentLocale)/${TEXTDOMAIN}" - - # Verify directory used to store locale-specific translation - # messages. If it doesn't exist, create it. - if [[ ! -d $(dirname ${FILE}) ]];then - mkdir -p $(dirname ${FILE}) - fi - - # Build list of files to process. - if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Scripts/Bash" ]];then - FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}\.sh") - else - cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Set action preamble. - cli_printActionPreamble "${FILES}" "doLocale" 'AsResponseLine' - - # Print action message. - cli_printMessage "${FILE}.pot" 'AsUpdatingLine' - - # Prepare directory structure to receive .po files. - if [[ ! -d $(dirname ${FILE}) ]];then - mkdir -p $(dirname ${FILE}) - fi - - # Retrive translatable strings from shell script files and create - # the portable object template (.pot) from them. - /usr/bin/xgettext --output=${FILE}.pot \ - --copyright-holder="CentOS Documentation SIG" \ - --width=70 --sort-by-file ${FILES} - - # Verify, initialize or update portable objects from portable - # object templates. - locale_updateMessagePObjects "${FILE}" - -} diff --git a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageXml.sh b/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageXml.sh deleted file mode 100755 index 68e8b3c..0000000 --- a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessageXml.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# -# locale_updateMessageXml.sh -- This function parses XML-based files -# (e.g., scalable vector graphics), retrives translatable strings and -# creates/update gettext portable objects. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function locale_updateMessageXml { - - local FILE='' - local FILES='' - - # Define filename used to create both portable object templates - # (.pot) and portable objects (.po) files. - FILE="${WORKDIR}/$(cli_getCurrentLocale)" - - # Build list of files to process. - if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/.+" ]];then - FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}\.svg") - elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Manuals/.+" ]];then - FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}\.xml") - else - cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Set action preamble. - cli_printActionPreamble "${FILES}" "doLocale" 'AsResponseLine' - - # Print action message. - cli_printMessage "${FILE}.pot" 'AsUpdatingLine' - - # Prepare directory structure to receive .po files. - if [[ ! -d $(dirname ${FILE}) ]];then - mkdir -p $(dirname ${FILE}) - fi - - # Retrive translatable strings from XML-based files and - # create the portable object template (.pot) from them. - /usr/bin/xml2po ${FILES} | msgcat --output=${FILE}.pot --width=70 --sort-by-file - - - # Verify, initialize or merge portable objects from portable - # object templates. - locale_updateMessagePObjects "${FILE}" - -} diff --git a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessages.sh b/Scripts/centos-art.sh/Functions/Locale/locale_updateMessages.sh deleted file mode 100755 index 934e141..0000000 --- a/Scripts/centos-art.sh/Functions/Locale/locale_updateMessages.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# -# locale_updateMessages.sh -- This function extracts translatable -# strings from both XML-based files (using xml2po) and shell scripts -# (using xgettext). Translatable strings are initially stored in -# portable objects templates (.pot) which are later merged into -# portable objects (.po) in order to be optionally converted as -# machine objects (.mo). -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function locale_updateMessages { - - local ACTIONNAM='' - - # Evaluate action value to determine whether to use xml2po to - # extract translatable strings from XML-based files or to use - # xgettext to extract translatable strings from shell script - # files. - if [[ $WORKDIR =~ "^${BASEDIR}/(Identity|Manuals)/.+$" ]];then - - # Update translatable strings inside portable object templates - # for XML-based files (e.g., scalable vector graphics). - ACTIONNAM="${FUNCNAM}_updateMessageXml" - - elif [[ $WORKDIR =~ "^${BASEDIR}/Scripts/.+$" ]];then - - # Update translatable strings inside portable object templates - # for shell scripts (e.g., centos-art.sh script). - ACTIONNAM="${FUNCNAM}_updateMessageShell" - - else - - cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - - fi - - # Execute action name. - if [[ $ACTIONNAM != '' ]];then - eval $ACTIONNAM - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/Config/manual-index.texi b/Scripts/centos-art.sh/Functions/Manual/Config/manual-index.texi deleted file mode 100644 index abe002c..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/Config/manual-index.texi +++ /dev/null @@ -1,3 +0,0 @@ -@node Index -@unnumbered Index -@printindex cp diff --git a/Scripts/centos-art.sh/Functions/Manual/Config/manual-intro.texi b/Scripts/centos-art.sh/Functions/Manual/Config/manual-intro.texi deleted file mode 100644 index e69de29..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/Config/manual-intro.texi +++ /dev/null diff --git a/Scripts/centos-art.sh/Functions/Manual/Config/manual-menu.texi b/Scripts/centos-art.sh/Functions/Manual/Config/manual-menu.texi deleted file mode 100644 index 70362c8..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/Config/manual-menu.texi +++ /dev/null @@ -1,3 +0,0 @@ -@menu -* Index:: -@end menu diff --git a/Scripts/centos-art.sh/Functions/Manual/Config/manual-nodes.texi b/Scripts/centos-art.sh/Functions/Manual/Config/manual-nodes.texi deleted file mode 100644 index e69de29..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/Config/manual-nodes.texi +++ /dev/null diff --git a/Scripts/centos-art.sh/Functions/Manual/Config/manual-section.texi b/Scripts/centos-art.sh/Functions/Manual/Config/manual-section.texi deleted file mode 100644 index fb39647..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/Config/manual-section.texi +++ /dev/null @@ -1,22 +0,0 @@ -@subsection Goals - -@itemize -@item ... -@end itemize - -@subsection Description - -@itemize -@item ... -@end itemize - -@subsection Usage - -@itemize -@item ... -@end itemize - -@subsection See also - -@menu -@end menu diff --git a/Scripts/centos-art.sh/Functions/Manual/Config/manual.texi b/Scripts/centos-art.sh/Functions/Manual/Config/manual.texi deleted file mode 100644 index 3d05184..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/Config/manual.texi +++ /dev/null @@ -1,55 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c $Id$ -@c -- Header -------------------------------------------------- - -@setfilename =FILENAME=.info -@settitle =TITLE= -@documentlanguage =LOCALE_LL= -@afourpaper -@finalout - -@c -- Summary description and copyright ----------------------- - -@copying -=DESCRIPTION= - -Copyright @copyright{} =COPYRIGHT_YEAR= =COPYRIGHT_HOLDER= - -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.2 or -any later version published by the Free Software Foundation; with no -Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A -copy of the license is included in the section entitled GNU Free -Documentation License. -@end copying - -@c -- Titlepage, contents, copyright --------------------------- - -@titlepage -@title =TITLE= -@subtitle =SUBTITLE= -@author =AUTHOR= -@page -@vskip 0pt plus 1filll -@insertcopying -@end titlepage -@contents - -@c -- `Top' node and master menu ------------------------------- - -@ifnottex -@node Top -@top =TITLE= -@insertcopying -@end ifnottex -@include manual-menu.texi - -@c -- The body of the document -------------------------------- - -@include manual-nodes.texi - -@c -- The end of the document --------------------------------- - -@include manual-index.texi - -@bye diff --git a/Scripts/centos-art.sh/Functions/Manual/manual.sh b/Scripts/centos-art.sh/Functions/Manual/manual.sh deleted file mode 100755 index ff211a9..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# manual.sh -- This function provides documentation features to -# centos-art.sh script. Here we initialize documentation variables and -# call manual_getActions functions. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual { - - # Define manuals base directory. This is the place where - # documentation manuals base directory structures are stored and - # organized in. - MANUAL_BASEDIR="${HOME}/artwork/trunk/Manuals" - - # Define default value to target flag. The target flag (--to) - # controls final destination used by copy related actions. - local FLAG_TO='' - - # Define command-line interface. - manual_getActions - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_checkChapter.sh b/Scripts/centos-art.sh/Functions/Manual/manual_checkChapter.sh deleted file mode 100755 index afb57de..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_checkChapter.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# manual_checkChapter.sh -- This function checks chapter structure. If -# it doesn't exist, create it. Inside CentOS Artwork Repository -# chapters are the base structure used to organize documentation. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_checkChapter { - - # Check chapter's directory existence. - if [[ ! -d $MANUAL_DIR_CHAPTER ]];then - - cli_printMessage "`gettext "The following documentation chapter will be created:"`" - cli_printMessage "$MANUAL_DIR_CHAPTER" "AsResponseLine" - cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" - - manual_updateChaptersFiles - manual_updateChaptersMenu - manual_updateChaptersNodes - - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_checkEntry.sh b/Scripts/centos-art.sh/Functions/Manual/manual_checkEntry.sh deleted file mode 100755 index b851aef..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_checkEntry.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# manual_checkEntry.sh -- This function checks the documentation entry -# existence. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_checkEntry { - - # Check entry to edit and create it if it doesn't exist. - if [[ ! -f $ENTRY ]];then - - cli_printMessage "`gettext "The following documentation section will be created:"`" - cli_printMessage "$ENTRY" "AsResponseLine" - cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" - - manual_createEntry - - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_copyEntry.sh b/Scripts/centos-art.sh/Functions/Manual/manual_copyEntry.sh deleted file mode 100755 index 3d3e1d7..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_copyEntry.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# manual_copyEntry.sh -- This function copies documentation entries and -# update documentation structure to reflect changes. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_copyEntry { - - # Verify target directory. - cli_checkRepoDirTarget - - # Transform FLAG_TO path into a documentation entry. - FLAG_TO=$(manual_getEntry "${FLAG_TO}") - - # Print action preamble. - cli_printActionPreamble "${FLAG_TO}" 'doCreate' 'AsResponseLine' - - # Print action message. - cli_printMessage "$FLAG_TO" 'AsCreatingLine' - - # Copy documentation entry. - svn cp "${ENTRY}" "${FLAG_TO}" --quiet - - # Redefine documentation ENTRY variable in order to update - # documentation structure based on the new documentation entry - # specified by FLAG_TO path. At this point the new documentation - # entry should be created and available inside the working copy, - # so we are safe to update documentation structure using the new - # documentation entry as regular documentation entry. - ENTRY="${FLAG_TO}" - - # Update Texinfo menu information. - manual_updateMenu - - # Update Texinfo nodes information. - manual_updateNodes - - # Update Texinfo cross-reference information. - manual_restoreCrossReferences - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_createEntry.sh b/Scripts/centos-art.sh/Functions/Manual/manual_createEntry.sh deleted file mode 100755 index 0f61198..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_createEntry.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# -# manual_createEntry.sh -- This function creates a new documentation -# entry based on action value (ACTIONVAL). -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_createEntry { - - # Check chapter structure for this entry. - manual_checkChapter - - # Update chapter-menu for this entry. - manual_updateMenu - - # Update chapter-nodes (based on chapter-menu). - manual_updateNodes - - # Update old missing cross references. If for some reason a - # documentation entry is removed by mistake, and that mistake is - # fixing by adding the removed documentation entry back into the - # repository, rebuild the missing cross reference message to use - # the correct link to the documentation section. - manual_restoreCrossReferences - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_deleteCrossReferences.sh b/Scripts/centos-art.sh/Functions/Manual/manual_deleteCrossReferences.sh deleted file mode 100755 index 53f4c65..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_deleteCrossReferences.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# -# manual_deleteCrossReferences.sh -- This function looks inside -# texinfo source files, from section level on, and removes all cross -# referece definitions related to a documentation entry. Use this -# function in coordination with manual_deleteEntry function, in order -# to keep cross reference information, inside the documentation -# manual, syncronized. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_deleteCrossReferences { - - local -a PATTERN - local -a REPLACE - - # Build the node string using global entry (ENTRY) variable being - # processed currently. - local NODE=$(echo "$ENTRY" \ - | cut -d / -f8- \ - | tr '/' ' ' \ - | sed -r "s/(chapter-intro\.texi|\.texi)$//") - - # Define regular expression patterns for texinfo cross reference - # commands. - PATTERN[0]="@(pxref|xref|ref)\{(${NODE})\}" - PATTERN[1]="^(\* ${NODE}:(.*)?:(.*)?)$" - - # Define replacement string for missing entries. It is convenient - # to keep missing entries in documentation for documentation team - # to know. Removing the missing cross reference may intorudce - # confussion. Imagine that! you are spending lots of hours in an - # article and suddenly one of your cross refereces disappears with - # no visible reason, with the next working copy update you - # perform. That's frustrating. Instead, when centos-art.sh script - # finds a missing cross reference it removes the link and remark - # the issue for you to act on it. - REPLACE[0]='--- @strong{'`gettext "Removed"`'}(\1:\2) ---' - REPLACE[1]='@comment --- '`gettext "Removed"`'(\1) ---' - - # Sanitate all missing cross references, related to entry, in - # section texinfo files. Missing cross references, related to - # entry, in chapter texinfo files are already handled by - # manual_updateMenu, and manual_updateNode functions. If we don't - # sanitate missing cross refereces before info file is created, - # errors are displayed since makeinfo don't produce info output - # with broken cross refereces. - local ENTRIES=$(cli_getFilesList "${MANUAL_DIR}" '.*\.texi') - if [[ $ENTRIES != '' ]];then - sed -r -i \ - -e "s!${PATTERN[0]}!${REPLACE[0]}!Mg" \ - -e "s!${PATTERN[1]}!${REPLACE[1]}!g" \ - $ENTRIES - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_deleteEntry.sh b/Scripts/centos-art.sh/Functions/Manual/manual_deleteEntry.sh deleted file mode 100755 index e9f4bb3..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_deleteEntry.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/bash -# -# manual_deleteEntry.sh -- This function removes a documentation entry -# from documentation directory structure. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_deleteEntry { - - local ENTRIES='' - local ENTRYSTATUS='' - local LOCATION='' - - # Check if the entry has been already removed. - cli_checkFiles $ENTRY 'f' - - # Define root location to look for entries. - LOCATION=$(echo $ENTRY | sed -r 's!\.texi$!!') - - # Redefine location to match the chapter's root directory. This - # applies when you try to remove the whole chapter from the - # working copy (e.g., centos-art manual --delete=/home/centos/artwork/trunk/). - if [[ $ENTRY =~ "chapter-intro\.texi$" ]];then - LOCATION=$(dirname "$ENTRY") - fi - - # Define list of dependent entries. Dependent entries are stored - # inside a directory with the same name of the entry you are - # trying to remove. If such directory location doesn't exists, the - # related entry doesn't have dependent entries either. - if [[ -d $LOCATION ]];then - ENTRIES=$(cli_getFilesList $LOCATION ".*\.texi") - fi - - # Add entry being currently processed to list of files to precess. - ENTRIES="${ENTRIES} ${ENTRY}" - - # Remove duplicated lines from entries list, be sure there is just - # one path per line and they are ordered in reverse. At this - # point, it is hard to find duplicated lines since the list of - # entries is built from files and it is not possible to have two - # files in the very same directory using the same name exactly, so - # this could be considered a bit paranoid. ~:-) - ENTRIES=$(echo "$ENTRIES" | tr ' ' "\n" | sort -r | uniq) - - # Print action preamble. - cli_printActionPreamble "$ENTRIES" 'doDelete' 'AsResponseLine' - - # Process list of entries. - for ENTRY in $ENTRIES;do - - # Define the versioning status of entry. - if [[ -d $(dirname $ENTRY)/.svn ]];then - ENTRYSTATUS=$(cli_getRepoStatus "$ENTRY") - else - # At this point we don't know what the entry versioning - # status is, so consider the entry an unversion file. - ENTRYSTATUS='?' - fi - - # Verify entry inside the working copy. - if [[ "$ENTRYSTATUS" =~ '^(\?)?$' ]];then - - # Print action message. - cli_printMessage "$ENTRY" "AsDeletingLine" - - else - - # Do not remove a versioned documentation entry with - # changes inside. Print a message about it and stop script - # execution instead. - cli_printMessage "`gettext "There are changes that need to be committed first."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - - fi - - # Remove documentation entry. At this point, documentation - # entry can be under version control or not versioned at all. - # Here we need to decide how to remove documentation entries - # based on whether they are under version control or not. - if [[ "$ENTRYSTATUS" == ' ' ]];then - - # Documentation entry is under version control and there - # is no change to be committed up to central repository. - # We are safe to schedule it for deletion. - svn del "$ENTRY" --quiet - - elif [[ "$ENTRYSTATUS" == '?' ]];then - - # Documentation entry is not under version control, so we - # don't care about changes inside it. If you say - # centos-art.sh script to remove an unversion - # documentation entry it will do so, using convenctional - # `rm' command. - rm -r "$ENTRY" - - fi - - # Remove entry on section's menu and nodes to reflect the - # fact that documentation entry has been removed. - manual_updateMenu "remove-entry" - manual_updateNodes - - # Remove entry cross references from documentation manual. - manual_deleteCrossReferences - - done - - # Update chapter's menu and nodes in the master texinfo document. - # This is mainly applied when one of the chapters (e.g., trunk/, - # tags/, or branches/) is removed. - if [[ ! -d $MANUAL_DIR_CHAPTER ]];then - manual_updateChaptersMenu 'remove-entry' - manual_updateChaptersNodes - fi - - # Update documentation output-related files. - manual_updateOutputFiles - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_editEntry.sh b/Scripts/centos-art.sh/Functions/Manual/manual_editEntry.sh deleted file mode 100755 index 7bc2e81..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_editEntry.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# manual_editEntry.sh -- This function edits documentation entry based -# on entry pattern. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_editEntry { - - # Check chapter existence. In order to create/edit a section the - # chapter of that section needs to exist first. If the chapter - # hasn't been created, where are you going to store the section - # files? Put the chapter's checker here. - manual_checkChapter - - # Check section existence. - manual_checkEntry - - # Use default text editor to edit the documentation entry. - eval $EDITOR $ENTRY - - # Re-build output files to propagate recent changes. - manual_updateOutputFiles - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_getActions.sh b/Scripts/centos-art.sh/Functions/Manual/manual_getActions.sh deleted file mode 100755 index 5b7f2f3..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_getActions.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash -# -# manual_getActions.sh -- This function interpretes arguments passed -# to `manual' functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_getActions { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="read:,search:,edit:,delete:,update:,copy:,to:" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Define action to take for each option passed. - while true; do - case "$1" in - - --read ) - ACTIONVAL="$2" - ACTIONNAM="${FUNCNAM}_searchNode" - shift 2 - ;; - - --search ) - ACTIONVAL="$2" - ACTIONNAM="${FUNCNAM}_searchIndex" - shift 2 - ;; - - --edit ) - ACTIONVAL="$2" - ACTIONNAM="${FUNCNAM}_editEntry" - shift 2 - ;; - - --delete ) - ACTIONVAL="$2" - ACTIONNAM="${FUNCNAM}_deleteEntry" - shift 2 - ;; - - --update ) - ACTIONVAL="$2" - ACTIONNAM="${FUNCNAM}_updateOutputFiles" - shift 2 - ;; - - --copy ) - ACTIONVAL="$2" - ACTIONNAM="${FUNCNAM}_copyEntry" - shift 2 - ;; - - --to ) - FLAG_TO="$2" - shift 2 - ;; - - * ) - # Break options loop. - break - esac - done - - # Check action value passed through the command-line using source - # directory definition as reference. - cli_checkRepoDirSource - - # Define documentation entry. - ENTRY=$(manual_getEntry) - - # Define directory for documentation manual. This is the place the - # specific documentation manual we are working with is stored in. - MANUAL_DIR=$(echo $ENTRY | cut -d / -f-7) - - # Define directory to store documentation entries. At this point, - # we need to take a desition about documentation design, in order - # to answer the question: How do we assign chapters, sections and - # subsections automatically, based on the repository structure? - # and also, how such design could be adapted to changes in the - # repository structure? - # - # One solution would be: represent the repository's first level - # structure in three chapters only (i.e., trunk, branches, and - # tags) and handle everything else inside them as sections. Sub - # and subsub section will not have their own files, they will be - # written inside section files instead. - MANUAL_DIR_CHAPTER=$(echo $ENTRY | cut -d / -f-8) - - # Define chapter name for the documentation entry we are working - # with. - MANUAL_CHA_NAME=$(basename "$MANUAL_DIR_CHAPTER") - - # Define base name for documentation manual files. This is the - # main file name used to build texinfo related files (.info, .pdf, - # .xml, etc.). - MANUAL_BASEFILE=$(echo $ENTRY | cut -d / -f-7) - MANUAL_BASEFILE=${MANUAL_BASEFILE}/$(cli_getRepoName "${MANUAL_BASEFILE}" 'f') - - # Syncronize changes between the working copy and the central - # repository to bring down changes. - cli_commitRepoChanges ${MANUAL_DIR} - - # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then - eval $ACTIONNAM - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Syncronize changes between the working copy and the central - # repository to commit up changes. - cli_commitRepoChanges ${MANUAL_DIR} - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_getEntry.sh b/Scripts/centos-art.sh/Functions/Manual/manual_getEntry.sh deleted file mode 100755 index f974b32..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_getEntry.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# -# manual_getEntry.sh -- This function builds a documentation entry based -# on a location specified. Location specification can be both action -# value (ACTIONVAL) variable or a value passed as first positional -# parameter. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_getEntry { - - # Define variables as local to avoid conflicts outside. - local ENTRY='' - local LOCATION='' - - # Redefine location in order to make this function reusable not - # just for action value variable but whatever value passed as - # first possitional argument. - if [[ "$1" != '' ]];then - LOCATION="$1" - else - LOCATION="$ACTIONVAL" - fi - - # Define relative path of entry, from trunk directory on. - ENTRY=$(echo $LOCATION | sed -r "s!^${HOME}/artwork/!!") - - # Verify the entry relative path to find out which documentation - # manual we are acting on. As convenction, whatever documentation - # entry you provide outside trunk/Manuals/ directory structure is - # considered as you are documenting the repository directory - # structure. Otherwise, if an entry inside trunk/Manuals/ is - # provided, the directory structure provided is used as default - # documentation manual for actions like `--create' and `--update' - # to take place on. Other options like `--edit', `--delete' and - # `--read' cannot be applied to paths provided is inside - # trunk/Manuals/ such actions made manually. - if [[ ${ENTRY} =~ '^trunk/Manuals/.+$' ]];then - ENTRY=$(echo ${ENTRY} | sed 's!trunk/Manuals/!!') - else - ENTRY=$(dirname Repository/${ENTRY})/$(basename $LOCATION).texi - fi - - # Re-define entry to set absolute path to manuals base directory - # structure. - ENTRY=${MANUAL_BASEDIR}/${ENTRY} - - # Re-define documentation entry to handle chapter entries. Chapter - # entries are handled inside the chapter it refers to, not outside - # it. To store chapter-specific information, the special file - # chapter-intro.texi is used inside the chapter. - # TODO: automate the verification, in order to accept any other - # structure in the first level. - if [[ ${ENTRY} =~ "(trunk|branches|tags)\.texi$" ]];then - ENTRY=$(echo ${ENTRY} \ - | sed -r "s/(trunk|branches|tags)\.texi$/\1\/chapter-intro.texi/") - fi - - # Output entry's absolute path. - echo ${ENTRY} - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_getNode.sh b/Scripts/centos-art.sh/Functions/Manual/manual_getNode.sh deleted file mode 100755 index 487ece5..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_getNode.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# manual_getNode.sh -- This function cleans up the action value -# (ACTIONVAL) directory to make a node name from it. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_getNode { - - local NODE=$(echo "$ACTIONVAL" \ - | sed -r 's!^/home/centos/artwork/!!' \ - | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!') - - echo "$NODE" -} - diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_restoreCrossReferences.sh b/Scripts/centos-art.sh/Functions/Manual/manual_restoreCrossReferences.sh deleted file mode 100755 index fb8ece9..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_restoreCrossReferences.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# manual_restoreCrossReferences.sh -- This function looks inside -# texinfo source files, from section level on, and restores any cross -# reference related to a documentation entry. This function is used in -# those cases where documentation entries are created/recreated to -# documentation structure. It is a verification that looks for -# matching documentation entries previously defined as removed by -# manual_deleteCrossReferences function. The -# manual_restoreCrossReferences function relays in the removed message -# format produced by manual_deleteCrossReferences function, in order -# to return them back into the link format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_restoreCrossReferences { - - local -a PATTERN - local -a REPLACE - - # Build the node string using global entry (ENTRY) variable being - # processed currently. - local NODE=$(echo "$ENTRY" \ - | cut -d / -f8- \ - | tr '/' ' ' \ - | sed -r "s/(${MANUALS_FILE[7]}|\.texi)$//") - - # Define regular expression patterns to match removed message - # format produced by message_removeCrossReferences function. - PATTERN[0]="--- @strong\{`gettext "Removed"`\}\((pxref|xref|ref):(${NODE})\) ---" - PATTERN[1]="^@comment --- `gettext "Removed"`\((\* ${NODE}:(.*)?:(.*)?)\) ---$" - - # Define replacement string to turn removed message back to cross - # reference link. - REPLACE[0]='@\1{\2}' - REPLACE[1]='\1' - - # Build list of source texinfo files to process, from section - # level on, and apply replacement string previously defined. At - # this point we don't touch chapter related texinfo files (i.e., - # repository-menu.texi and repository-nodes.texi) nor section - # related definition files (i.e., chapter-nodes.texi, - # chapter-menu.texi, chapter-index.texi) because they are handled - # by manual_updateChapterMenu, manual_updateChapterNode, - # manual_updateMenu, and manual_updateNodes functions - # respectively. If we don't sanitate messages built from broken - # cross reference messages, they may become obsolete since the - # documentation entry, they represent, can be recreated in the - # future and, at that time, the link wouldn't be broken any more, - # so we need to be aware of this. - local ENTRIES=$(cli_getFilesList "${MANUAL_DIR}" '.*\.texi') - if [[ $ENTRIES != '' ]];then - sed -r -i \ - -e "s!${PATTERN[0]}!${REPLACE[0]}!Mg" \ - -e "s!${PATTERN[1]}!${REPLACE[1]}!g" \ - $ENTRIES - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_searchIndex.sh b/Scripts/centos-art.sh/Functions/Manual/manual_searchIndex.sh deleted file mode 100644 index 09b9238..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_searchIndex.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# manual_searchIndex.sh -- This function does an index search inside the -# info document. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_searchIndex { - - /usr/bin/info --index-search="$FLAG_FILTER" --file=${MANUAL_BASEFILE}.info.bz2 - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_searchNode.sh b/Scripts/centos-art.sh/Functions/Manual/manual_searchNode.sh deleted file mode 100755 index e3adba5..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_searchNode.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# manual_searchNode.sh -- This function does a node search inside the -# info document. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_searchNode { - - # Check entry inside documentation structure. If the entry - # exits use the info reader to open the info file at the - # specified node. Otherwise, ask the user for create it. - if [[ -f "$ENTRY" ]];then - /usr/bin/info --node="$(manual_getNode)" --file=${MANUAL_BASEFILE}.info.bz2 - else - manual_editEntry - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateChaptersFiles.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateChaptersFiles.sh deleted file mode 100755 index 6a38b6e..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateChaptersFiles.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# -# manual_updateChaptersFiles.sh -- This function updates chapter related -# files. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateChaptersFiles { - - # Define chapter's generic structure. - local CHAPTERBODY="\ - @node $MANUAL_CHA_NAME - @chapter $MANUAL_CHA_NAME - @cindex $(echo $MANUAL_CHA_NAME | tr '[[:upper:]]' '[[:lower:]]') - @include $MANUAL_CHA_NAME/chapter-intro.texi - @include $MANUAL_CHA_NAME/chapter-menu.texi - @include $MANUAL_CHA_NAME/chapter-nodes.texi" - - # Remove any space/tabs at the begining of @... lines. - CHAPTERBODY=$(echo "$CHAPTERBODY" | sed -r 's!^[[:space:]]+@!@!') - - # Create directory to store chapter files. - if [[ ! -d $MANUAL_DIR_CHAPTER ]];then - mkdir $MANUAL_DIR_CHAPTER - fi - - # Create files to store chapter information. If chapter files - # already exist, they will be re-written and any previous - # information inside them will be lost. - echo "$CHAPTERBODY" > $MANUAL_DIR_CHAPTER/chapter.texi - echo "" > $MANUAL_DIR_CHAPTER/chapter-menu.texi - echo "" > $MANUAL_DIR_CHAPTER/chapter-nodes.texi - - # Initialize chapter instroduction using template file. - cp ${FUNCCONFIG}/manual-cha-intro.texi $MANUAL_DIR_CHAPTER/chapter-intro.texi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateChaptersMenu.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateChaptersMenu.sh deleted file mode 100755 index c3ec336..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateChaptersMenu.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# manual_updateChaptersMenu.sh - This function updates chapter menu. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateChaptersMenu { - - local ACTION=$1 - local MENUCHAPTERS='' - - # Build menu of chapters. The Index node is not included as other - # nodes are. The Index node is defined insde the master texinfo - # file (repository.texi). To create the final .info file - # correctly, the Index line in the menu should remain, even no - # other node exist. - if [[ -f ${MANUAL_BASEFILE}-menu.texi ]];then - MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.texi \ - | egrep -v "^(@(end )?menu$|\* Index::.*)$") - fi - - # Re-defined menu of chapters based on action. - case $ACTION in - 'remove-entry' ) - # Remove chapter from menu. - MENUCHAPTERS=$(echo "${MENUCHAPTERS}" \ - | egrep -v "^\* ${MANUAL_CHA_NAME}::[[:print:]]*$") - ;; - 'update-entry' | * ) - # Update chapter menu using texinfo format. - MENUCHAPTERS="${MENUCHAPTERS} - * ${MANUAL_CHA_NAME}::" - ;; - esac - - # Remove opening spaces/tabs and empty line from the menu of - # chapters. Empty lines may occur the first time the menu of - # chapters is created. - MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ - | egrep -v '^[[:space:]]*$') - - # Organize menu of chapters alphabetically and verify that no - # duplicated line be included on the list. - MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sort | uniq ) - - # Give format to final menu output. - MENUCHAPTERS="@menu - ${MENUCHAPTERS} - * Index:: - @end menu" - - # Strip opening space/tabs from final menu of chapters. - MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ - | egrep -v '^[[:space:]]*$') - - # Dump organized menu of chapters into file. - echo "${MENUCHAPTERS}" > ${MANUAL_BASEFILE}-menu.texi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateChaptersNodes.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateChaptersNodes.sh deleted file mode 100755 index 7ebfe77..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateChaptersNodes.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# -# manual_updateChaptersNodes.sh - This function updates nodes of -# chapters based on menu of chapters. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateChaptersNodes { - - # Build list "nodes of chapters" based on menu of chapters. - local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.texi \ - | egrep -v '^@(end )?menu$' \ - | egrep -v "^\* `gettext "Index"`::[[:print:]]*$" \ - | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \ - | sed -r 's! !_!g' | sort | uniq ) - - # Build list of texinfo inclusions to load chapters' nodes. - local FILENODE=$(\ - for CHAPTERNODE in ${CHAPTERNODES};do - - INCL=$(echo ${CHAPTERNODE} | sed -r "s!(${CHAPTERNODE})!\1/chapter\.texi!") - - # Output inclusion line using texinfo format. - echo "@include $INCL" - - done) - - # Dump organized nodes of chapters into file. - echo "$FILENODE" > ${MANUAL_BASEFILE}-nodes.texi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateMenu.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateMenu.sh deleted file mode 100755 index b147742..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateMenu.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash -# -# manual_updateMenu.sh -- This function updates menu lines inside -# texinfo chapters. If this function is called with the -# 'remove-entry' string as first argument, then the menu line related -# to the entry being processed is removed. If this function is called -# with the 'update-entry' string as first argument, then the menu line -# related to the entry being processed is added to the menu. If no -# argument is passed to this function, the 'update-entry' action is -# assumed. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateMenu { - - # Specify which action to do inside chapter's menu. - local ACTION="$1" - - # Build the menu line related to the entry being processed - # currently. - local MENULINE=$(echo "$ENTRY" \ - | cut -d / -f8- \ - | tr '/' ' ' \ - | sed -r "s/(chapter-intro\.texi|\.texi)$//") - - # Give format to menu line using texinfo style. - MENULINE="* $MENULINE::" - - # Define chapter's menu. Remove `@menu', `@end menu', and empty lines - # from output. - local MENU=$(cat $MANUAL_DIR_CHAPTER/chapter-menu.texi \ - | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') - - # Re-defined chapter's menu based on action. - case $ACTION in - 'remove-entry' ) - # Remove menu line from chapter's menu. - MENU=$(echo "$MENU" | egrep -v "$MENULINE") - ;; - 'update-entry' | * ) - # Add menu line to chapter's menu. This is the default - # behaivour if no argument is passed to manual_updateMenu - # function. - MENU="$MENU - $MENULINE" - ;; - esac - - # Organize menu alphabetically, remove empty and duplicated lines. - # At this point, empty line may occur the first time the menu is - # created, don't let them to scape. - MENU=$(echo "$MENU" | egrep -v '^[[:space:]]*$' | sort | uniq ) - - # Rebuild chapter's menu structure adding '@menu' and '@end menu' - # lines back in menu. - MENU="@menu - $MENU - @end menu" - - # Remove opening spaces/tabs from final menu structure. - MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g') - - # Dump final menu structure back into chapter's menu file. - echo "$MENU" > $MANUAL_DIR_CHAPTER/chapter-menu.texi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateNodes.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateNodes.sh deleted file mode 100755 index 9f5bf43..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateNodes.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# -# manual_updateNodes.sh -- This function updates chapter's nodes -# definition using the chapter's menu as reference. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateNodes { - - # Retrive nodes' entries from chapter-menu.texi file. - local NODES=$(cat $MANUAL_DIR_CHAPTER/chapter-menu.texi \ - | sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \ - | egrep -v '^@(end )?menu$' | sed -r 's! !:!g' | sort | uniq) - - # Re-build node structure based on menu information. - for NODE in $NODES;do - - NODE=$(echo "$NODE" | sed -r 's!:! !g') - SECT=$(echo "$NODE" | sed -r 's! !/!g') - INCL=$(echo "$NODE" | sed -r 's! !/!g').texi - CIND=$(echo "$NODE") - - # Create an empty directory to store texinfo files. - if [[ ! -d ${MANUAL_DIR}/$(dirname "$INCL") ]];then - mkdir -p ${MANUAL_DIR}/$(dirname "$INCL") - fi - - # Create texinfo section file using its template. - if [[ ! -f ${MANUAL_DIR}/$INCL ]];then - cp ${FUNCCONFIG}/manual-section.texi ${MANUAL_DIR}/$INCL - fi - - # Output node information based on texinfo menu. - echo "@node $NODE" - echo "@section $SECT" - echo "@cindex $CIND" - echo "@include $INCL" - echo "" - - # Dump node information into chapter node file. - done > $MANUAL_DIR_CHAPTER/chapter-nodes.texi - -} - diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFileHtml.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFileHtml.sh deleted file mode 100755 index 326ac00..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFileHtml.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFileHtml.sh -- This function exports -# documentation manual to HTML format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFileHtml { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}-html" 'AsUpdatingLine' - - # Check html output directory - [[ ! -d ${MANUAL_BASEFILE}-html ]] && mkdir -p ${MANUAL_BASEFILE}-html - - # Add html output directory into directory stack to make it the - # current working directory. Otherwise texi2html may produce - # incorrect paths to images included. - pushd ${MANUAL_BASEFILE}-html > /dev/null - - # Update html files. Use texi2html to export from texinfo file - # format to html using CentOS Web default visual style. - texi2html ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}-html --split section \ - --nosec-nav \ - --css-include=/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/stylesheet.css \ - -I=/home/centos/artwork - - # Apply html transformations. Html transformations rely on - # Texi2html default html output. The main goal of these html - # transformations is to build specific html structures that match - # specific css definitions. This way we extend the visual style of - # Texi2html default html output. - sed -r -i \ - -f /home/centos/artwork/trunk/Identity/Models/Css/Texi2html/transformations.sed \ - ${MANUAL_BASEFILE}-html/*.html - - # Remove html output directory from directory stack. - popd > /dev/null - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFileInfo.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFileInfo.sh deleted file mode 100755 index 0dd59b7..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFileInfo.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFileInfo.sh -- This function exports -# documentation manual to info format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFileInfo { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.info.bz2" 'AsUpdatingLine' - - # Update info file. - /usr/bin/makeinfo ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.info - - # Compress info file. - if [[ $? -eq 0 ]];then - bzip2 -f ${MANUAL_BASEFILE}.info - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFilePdf.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFilePdf.sh deleted file mode 100755 index ff2caac..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFilePdf.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFilePdf.sh -- This function exports documentation -# manual to PDF format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFilePdf { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.pdf" 'AsUpdatingLine' - - # Update plaintext output directory. - /usr/bin/texi2pdf --quiet \ - ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.pdf - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFilePlaintext.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFilePlaintext.sh deleted file mode 100755 index 9847825..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFilePlaintext.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFilePlaintext.sh -- This function exports -# documentation manual to plain-text format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFilePlaintext { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.txt" 'AsUpdatingLine' - - # Update plaintext output directory. - /usr/bin/makeinfo --plaintext \ - ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.txt - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFileXml.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFileXml.sh deleted file mode 100755 index 17b2704..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFileXml.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFileXml.sh -- This function exports documentation -# manual to XML format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFileXml { - - # Print action message. - cli_printMessage "${MANUAL_BASEFILE}.xml" 'AsUpdatingLine' - - # Update xml output format. - /usr/bin/makeinfo --xml \ - ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.xml \ - -} diff --git a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFiles.sh b/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFiles.sh deleted file mode 100755 index 9535ccb..0000000 --- a/Scripts/centos-art.sh/Functions/Manual/manual_updateOutputFiles.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFiles.sh -- This function exports documentation -# manual to different output formats. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFiles { - - # Verify documentation manual base file structure. - cli_checkFiles ${MANUAL_BASEFILE}.texi 'f' - - # Ouput separator line. - cli_printMessage '-' 'AsSeparatorLine' - - # Add the working copy root directory to directory stack to make - # path construction correctly. Otherwise, makeinfo may produce - # paths incorrectly. - pushd /home/centos/artwork > /dev/null - - manual_updateOutputFileInfo - manual_updateOutputFileHtml - manual_updateOutputFileXml - manual_updateOutputFilePdf - manual_updateOutputFilePlaintext - - # Remove the working copy root directory from directory stack. - popd > /dev/null - - # Output separator. - cli_printMessage "-" 'AsSeparatorLine' - -} diff --git a/Scripts/centos-art.sh/Functions/Path/path.sh b/Scripts/centos-art.sh/Functions/Path/path.sh deleted file mode 100755 index 4f3fe10..0000000 --- a/Scripts/centos-art.sh/Functions/Path/path.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# path.sh -- This function provides file manipulations to aliviate -# path maintainance inside the repository. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function path { - - # Define deafult value to target flag. The target flag (--to) - # controls final destination used by copy related actions. - local FLAG_TO='' - - # Define default value to syncronization flag. The syncronization - # flag (--sync) controls whether centos-art.sh script calls itself - # to create/delete parallel directories at the moment of - # create/delte action itself. - local FLAG_SYNC='false' - - # Define command-line interface. - path_getActions - -} diff --git a/Scripts/centos-art.sh/Functions/Path/path_doCopy.sh b/Scripts/centos-art.sh/Functions/Path/path_doCopy.sh deleted file mode 100755 index b49cb66..0000000 --- a/Scripts/centos-art.sh/Functions/Path/path_doCopy.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# path_doCopy.sh -- This function duplicates files inside the working -# copy using subversion commands. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function path_doCopy { - - # Verify target directory. - cli_checkRepoDirTarget - - # Print action preamble. - cli_printActionPreamble "${FLAG_TO}" 'doCreate' 'AsResponseLine' - - # Verify relation between source and target locations. We cannot - # duplicate an entry if its parent directory doesn't exist as - # entry inside the working copy. - if [[ -f ${ACTIONVAL} ]];then - if [[ ! -d $(dirname "${FLAG_TO}") ]];then - mkdir -p $(dirname "${FLAG_TO}") - fi - svn add $(dirname "${FLAG_TO}") --quiet - fi - - # Print action message. - cli_printMessage "${FLAG_TO}" 'AsCreatingLine' - - # Copy parent directory. - svn copy ${ACTIONVAL} ${FLAG_TO} --quiet - - # Verify syncronization flag. - if [[ $FLAG_SYNC == 'true' ]];then - - # Copy parallel directories. - . /home/centos/bin/centos-art manual --copy="$ACTIONVAL" --to="$FLAG_TO" - . /home/centos/bin/centos-art render --copy="$ACTIONVAL" --to="$FLAG_TO" - . /home/centos/bin/centos-art locale --copy="$ACTIONVAL" --to="$FLAG_TO" - - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Path/path_doDelete.sh b/Scripts/centos-art.sh/Functions/Path/path_doDelete.sh deleted file mode 100755 index fad8ce4..0000000 --- a/Scripts/centos-art.sh/Functions/Path/path_doDelete.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# path_doDelete.sh -- This function deletes files inside the working -# copy using subversion commands. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function path_doDelete { - - # Verify target directory. - cli_checkRepoDirTarget - - # Print action preamble. - cli_printActionPreamble "$ACTIONVAL" 'doDelete' 'AsResponseLine' - - # Syncronize parallel directories related to action value. - . /home/centos/bin/centos-art manual --delete="$ACTIONVAL" - . /home/centos/bin/centos-art render --delete="$ACTIONVAL" - . /home/centos/bin/centos-art locale --delete="$ACTIONVAL" - - # Print action message. - cli_printMessage "${ACTIONVAL}" 'AsDeletingLine' - - # Perform action. - svn del ${ACTIONVAL} --quiet - -} diff --git a/Scripts/centos-art.sh/Functions/Path/path_getActions.sh b/Scripts/centos-art.sh/Functions/Path/path_getActions.sh deleted file mode 100755 index 7504f68..0000000 --- a/Scripts/centos-art.sh/Functions/Path/path_getActions.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -# -# path_getActions.sh -- This function interpretes arguments passed to -# `path' functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function path_getActions { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="copy:,move:,delete:,to:,sync" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Define action to take for each option passed. - while true; do - case "$1" in - - --copy ) - - # Define action value passed through the command-line. - ACTIONVAL="$2" - - # Define action name using action value as reference. - ACTIONNAM="${FUNCNAM}_doCopy" - - # Rotate positional parameters. - shift 2 - ;; - - --delete ) - - # Define action value passed through the command-line. - ACTIONVAL="$2" - - # Define action name using action value as reference. - ACTIONNAM="${FUNCNAM}_doDelete" - - # Rotate positional parameters. - shift 2 - ;; - - --to ) - - # Redefine target flag. - FLAG_TO="$2" - - # Verify target directory. - cli_checkRepoDirTarget - - # Rotate positional parameters. - shift 2 - ;; - - --sync ) - - # Redefine syncronization flag. - FLAG_SYNC='true' - - # Rotate positional parameters. - shift 1 - ;; - - * ) - # Break options loop. - break - esac - done - - # Check action value (ACTIONVAL) passed through the command-line - # using source directory definition as reference. - cli_checkRepoDirSource - - # Syncronize changes between the working copy and the central - # repository to bring down changes. - cli_commitRepoChanges "${ACTIOVAL} ${FLAG_TO}" - - # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then - eval $ACTIONNAM - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Syncronize changes between the working copy and the central - # repository to commit up changes. - cli_commitRepoChanges "${ACTIOVAL} ${FLAG_TO}" - -} diff --git a/Scripts/centos-art.sh/Functions/Shell/Config/tpl_forCopyright.sed b/Scripts/centos-art.sh/Functions/Shell/Config/tpl_forCopyright.sed deleted file mode 100644 index e8e5e2c..0000000 --- a/Scripts/centos-art.sh/Functions/Shell/Config/tpl_forCopyright.sed +++ /dev/null @@ -1,38 +0,0 @@ -# This file standardizes the look and feel of top comments used by -# scripts inside CentOS Artwork Repository. It contains the copyright -# note and the license under which the script is released. This files -# is used with the regular expression '.*\.sh$' only. -# --------------------------------------------------- -# $Id$ -# --------------------------------------------------- -/^# +Copyright .*$/a\ -# Copyright (C) =COPYRIGHT_YEAR== =COPYRIGHT_HOLDER=\ -# \ -# This program is free software; you can redistribute it and/or\ -# modify it under the terms of the GNU General Public License as\ -# published by the Free Software Foundation; either version 2 of the\ -# License, or (at your option) any later version.\ -# \ -# This program is distributed in the hope that it will be useful, but\ -# WITHOUT ANY WARRANTY; without even the implied warranty of\ -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\ -# General Public License for more details.\ -#\ -# You should have received a copy of the GNU General Public License\ -# along with this program; if not, write to the Free Software\ -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\ -# USA.\ -# \ -# ---------------------------------------------------------------------- - -# Remove previous comments. -/^# +Copyright .*$/,/^# -+$/{ -d -} - -# Remove more than one space after comments. -s/^# +/# / - -# Define first line -1c\ -#!/bin/bash diff --git a/Scripts/centos-art.sh/Functions/Shell/shell.sh b/Scripts/centos-art.sh/Functions/Shell/shell.sh deleted file mode 100755 index f7d573d..0000000 --- a/Scripts/centos-art.sh/Functions/Shell/shell.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# shell.sh -- This function provides very basic string manipulations -# to help you maintain Bash scripts inside repository. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function shell { - - # Define command-line interface. - shell_getActions - -} diff --git a/Scripts/centos-art.sh/Functions/Shell/shell_getActions.sh b/Scripts/centos-art.sh/Functions/Shell/shell_getActions.sh deleted file mode 100755 index c55606f..0000000 --- a/Scripts/centos-art.sh/Functions/Shell/shell_getActions.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# -# shell_getActions.sh -- This function interpretes arguments passed to -# `shell' functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function shell_getActions { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="update-copyright:" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Look for options passed through command-line. - while true; do - - case "$1" in - - --update-copyright ) - - # Define action value. - ACTIONVAL="$2" - - # Define action name using action value as reference. - ACTIONNAM="${FUNCNAM}_updateCopyright" - - # Rotate positional parameters. - shift 2 - ;; - - * ) - # Break options loop. - break - esac - done - - # Check action value. Be sure the action value matches the - # convenctions defined for source locations inside the working - # copy. - cli_checkRepoDirSource - - # Syncronize changes between the working copy and the central - # repository to bring down changes. - cli_commitRepoChanges - - # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then - eval $ACTIONNAM - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Syncronize changes between the working copy and the central - # repository to commit up changes. - cli_commitRepoChanges - -} diff --git a/Scripts/centos-art.sh/Functions/Shell/shell_updateCopyright.sh b/Scripts/centos-art.sh/Functions/Shell/shell_updateCopyright.sh deleted file mode 100755 index 050383f..0000000 --- a/Scripts/centos-art.sh/Functions/Shell/shell_updateCopyright.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash -# -# shell_updateTopComment.sh -- This function replaces top comment -# section inside shell scripts (*.sh) with one of many pre-defined -# templates available. Use this function to maintain shell scripts top -# comments inside repository. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function shell_updateCopyright { - - local FILE='' - local COUNT=0 - local FILES='' - local INSTANCE='' - local TEMPLATES='' - local -a TITLE - local -a VALUE - local -a PATTERN - local -a PATTERN_MSG - local -a DEFAULT - local -a MARKER - - # Define absolute path to template file. - TEMPLATE="/home/centos/artwork/trunk/Scripts/Bash/Functions/Shell/Config/tpl_forCopyright.sed" - - # Check template file existence. - cli_checkFiles $TEMPLATE 'f' - - # Define file name to template instance. - INSTANCE=$(cli_getTemporalFile $TEMPLATE) - - # Define copyright information. - TITLE[0]="`gettext "Copyright holder"`" - TITLE[1]="`gettext "Copyright year"`" - - # Define translation marker. These values are used inside - # template file. - MARKER[0]='=COPYRIGHT_HOLDER=' - MARKER[1]='=COPYRIGHT_YEAR=' - - # Define pattern. These values are used as regular - # expression patterns for user's input further verification. - PATTERN[0]='^([[:alnum:] _-.]+)?$' - PATTERN[1]='^([[:digit:]]{4})?$' - - # Define pattern message. These values are used as output - # message when user's input doesn't match the related pattern. - PATTERN_MSG[0]="`gettext "Try using alphanumeric characters."`" - PATTERN_MSG[1]="`gettext "Try using numeric characters."`" - - # Define default values. - DEFAULT[0]="The CentOS Project. `gettext "All rights reserved."`" - DEFAULT[1]=$(date +%Y) - - # Initialize values using user's input. - cli_printMessage "`gettext "Enter the information you want to apply:"`" - while [[ $COUNT -ne ${#TITLE[*]} ]];do - - # Request value. - cli_printMessage "${TITLE[$COUNT]}" 'AsRequestLine' - read VALUE[$COUNT] - - # Sanitate values to exclude characters that could - # introduce possible markup malformations to final SVG files. - until [[ ${VALUE[$COUNT]} =~ ${PATTERN[$COUNT]} ]];do - cli_printMessage "${PATTERN_MSG[$COUNT]}" - cli_printMessage "${TITLE[$COUNT]}" 'AsRequestLine' - read VALUE[$COUNT] - done - - # Set default value to empty values. - if [[ ${VALUE[$COUNT]} == '' ]];then - VALUE[$COUNT]=${DEFAULT[$COUNT]} - fi - - # Increase counter. - COUNT=$(($COUNT + 1)) - - done - - # Create template instance. - cp $TEMPLATE $INSTANCE - - # Check template instance. We cannot continue if template instance - # couldn't be created. - cli_checkFiles $INSTANCE 'f' - - # Reset counter. - COUNT=0 - - while [[ $COUNT -ne ${#TITLE[*]} ]];do - - # Apply translation marker replacement. - sed -r -i "s!${MARKER[$COUNT]}!${VALUE[$COUNT]}!g" $INSTANCE - - # Increase counter. - COUNT=$(($COUNT + 1)) - - done - - # Define list of files to process - FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}.*\.sh") - - # Set action preamble. - cli_printActionPreamble "${FILES}" - - # Process list of files. - for FILE in $FILES;do - - # Output action message. - cli_printMessage $FILE 'AsUpdatingLine' - - # Apply template instance to file. - sed -r -i -f $INSTANCE $FILE - - done - - # Remove template instance. - if [[ -f ${INSTANCE} ]];then - rm ${INSTANCE} - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Svg/Config/tpl_forMetadata.sed b/Scripts/centos-art.sh/Functions/Svg/Config/tpl_forMetadata.sed deleted file mode 100644 index 48bd70d..0000000 --- a/Scripts/centos-art.sh/Functions/Svg/Config/tpl_forMetadata.sed +++ /dev/null @@ -1,68 +0,0 @@ -# This file is the metadata information used by CentOS Artwork SIG on -# its scalable vector graphics (SVG) files. This files is used with -# the regular expression '.*\.svg$' only. -# --------------------------------------------------- -# $Id$ -# --------------------------------------------------- -/\ - \ - \ - image/svg+xml\ - \ - \ - =TITLE=\ - =DATE=\ - \ - \ - =CREATOR=\ - \ - \ - \ - \ - =RIGHTS=\ - \ - \ - \ - \ - =PUBLISHER=\ - \ - \ - =IDENTIFIER=\ - =SOURCE=\ - =RELATION=\ - =LANGUAGE=\ - \ - \ -=KEYWORDS=\ - \ - \ - =COVERAGE=\ - =DESCRIPTION=\ - \ - \ - =CONTRIBUTOR=\ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - diff --git a/Scripts/centos-art.sh/Functions/Svg/svg.sh b/Scripts/centos-art.sh/Functions/Svg/svg.sh deleted file mode 100755 index 8ae161e..0000000 --- a/Scripts/centos-art.sh/Functions/Svg/svg.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# svg.sh -- This function provides very basic SVG manipulations to -# help you to maintain svg files inside the repository. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function svg { - - # Define command-line interface. - svg_getActions - -} diff --git a/Scripts/centos-art.sh/Functions/Svg/svg_getActions.sh b/Scripts/centos-art.sh/Functions/Svg/svg_getActions.sh deleted file mode 100755 index 62c5588..0000000 --- a/Scripts/centos-art.sh/Functions/Svg/svg_getActions.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash -# -# svg_getActions.sh -- This function interpretes arguments passed to -# `svg' functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function svg_getActions { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="update-metadata:,vacuum-defs:" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Look for options passed through command-line. - while true; do - - case "$1" in - - --update-metadata ) - - # Define action value. - ACTIONVAL="$2" - - # Define action name using action value as reference. - ACTIONNAM="${FUNCNAM}_updateMetadata" - - # Rotate positional parameters. - shift 2 - ;; - - --vacuum-defs ) - - # Define action value. - ACTIONVAL="$2" - - # Define action name using action value as reference. - ACTIONNAM="${FUNCNAM}_vacuumDefs" - - # Rotate positional parameters. - shift 2 - ;; - - * ) - # Break options loop. - break - esac - done - - # Check action value. Be sure the action value matches the - # convenctions defined for source locations inside the working - # copy. - cli_checkRepoDirSource - - # Syncronize changes between the working copy and the central - # repository to bring down changes. - cli_commitRepoChanges - - # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then - eval $ACTIONNAM - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Syncronize changes between the working copy and the central - # repository to commit up changes. - cli_commitRepoChanges - -} diff --git a/Scripts/centos-art.sh/Functions/Svg/svg_updateMetadata.sh b/Scripts/centos-art.sh/Functions/Svg/svg_updateMetadata.sh deleted file mode 100755 index ab39f03..0000000 --- a/Scripts/centos-art.sh/Functions/Svg/svg_updateMetadata.sh +++ /dev/null @@ -1,240 +0,0 @@ -#!/bin/bash -# -# svg_updateMetadata.sh -- This function updates metadata values -# inside scalable vector graphic (SVG) files. First, we ask user to -# provide the information. If user doesn't provide the information, -# centos-art.sh script uses autogenerated values as default ---when -# possible--- taking as reference SVG file path. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function svg_updateMetadata { - - local NAM='' - local URL='' - local KEYS='' - local FILE='' - local COUNT=0 - local FILES='' - local INSTANCE='' - local TEMPLATES='' - local -a TITLE - local -a VALUE - local -a PATTERN - local -a PATTERN_MSG - local -a MARKER - local -a DEFAULT - - # Define template file name. - TEMPLATE="/home/centos/artwork/trunk/Scripts/Bash/Functions/Svg/Config/tpl_forMetadata.sed" - - # Check template file existence. - cli_checkFiles $TEMPLATE 'f' - - # Define titles using Inkscape 0.46 metadata definition as reference. - TITLE[0]="`gettext "Title"`" - TITLE[1]="`gettext "Date"`" - TITLE[2]="`gettext "Creator"`" - TITLE[3]="`gettext "Rights"`" - TITLE[4]="`gettext "Publisher"`" - TITLE[5]="`gettext "Identifier"`" - TITLE[6]="`gettext "Source"`" - TITLE[7]="`gettext "Relation"`" - TITLE[8]="`gettext "Language"`" - TITLE[9]="`gettext "Keywords"`" - TITLE[10]="`gettext "Coverage"`" - TITLE[11]="`gettext "Description"`" - TITLE[12]="`gettext "Contributor"`" - - # Define markers. These values are used inside template. - MARKER[0]='=TITLE=' - MARKER[1]='=DATE=' - MARKER[2]='=CREATOR=' - MARKER[3]='=RIGHTS=' - MARKER[4]='=PUBLISHER=' - MARKER[5]='=IDENTIFIER=' - MARKER[6]='=SOURCE=' - MARKER[7]='=RELATION=' - MARKER[8]='=LANGUAGE=' - MARKER[9]='=KEYWORDS=' - MARKER[10]='=COVERAGE=' - MARKER[11]='=DESCRIPTION=' - MARKER[12]='=CONTRIBUTOR=' - - # Define pattern. These values are used as regular - # expression patterns for user's input further verification. - PATTERN[0]='^([[:alnum:] _-.]+)?$' - PATTERN[1]='^([0-9]{4}-(0[1-9]|1[0-2])-([0-2][1-9]|3[0-1]))?$' - PATTERN[2]=${PATTERN[0]} - PATTERN[3]=${PATTERN[0]} - PATTERN[4]=${PATTERN[0]} - PATTERN[5]='^(https://projects.centos.org/svn/artwork/[[:alnum:]/._-]+)?$' - PATTERN[6]=${PATTERN[5]} - PATTERN[7]=${PATTERN[5]} - PATTERN[8]='^([a-z]{2}(_[A-Z]{2})?)?$' - PATTERN[9]=${PATTERN[0]} - PATTERN[10]=${PATTERN[0]} - PATTERN[11]=${PATTERN[0]} - PATTERN[12]=${PATTERN[0]} - - # Define pattern message. These values are used as output - # message when user's input doesn't match the related pattern. - PATTERN_MSG[0]="`gettext "Try using alphanumeric characters."`" - PATTERN_MSG[1]="`gettext "Try using 'YYYY-MM-DD' date format."`" - PATTERN_MSG[2]=${PATTERN_MSG[0]} - PATTERN_MSG[3]=${PATTERN_MSG[0]} - PATTERN_MSG[4]=${PATTERN_MSG[0]} - PATTERN_MSG[5]="`gettext "Only locations under https://projects.centos.ort/svn/artwork are supported."`" - PATTERN_MSG[6]=${PATTERN_MSG[0]} - PATTERN_MSG[7]=${PATTERN_MSG[0]} - PATTERN_MSG[8]="`gettext "Try using 'LL' or 'LL_CC' locale format."`" - PATTERN_MSG[9]=${PATTERN_MSG[0]} - PATTERN_MSG[10]=${PATTERN_MSG[0]} - PATTERN_MSG[11]=${PATTERN_MSG[0]} - PATTERN_MSG[12]=${PATTERN_MSG[0]} - - # Define common default values. - DEFAULT[1]=$(date +%Y-%m-%d) - DEFAULT[2]="The CentOS Project" - DEFAULT[3]=${DEFAULT[2]} - DEFAULT[4]=${DEFAULT[2]} - DEFAULT[8]=$(cli_getCurrentLocale) - DEFAULT[10]=${DEFAULT[2]} - - # Initialize values using user's input. - cli_printMessage "`gettext "Enter metadata information you want to apply:"`" - while [[ $COUNT -ne ${#TITLE[*]} ]];do - - # Request value. - cli_printMessage "${TITLE[$COUNT]}" 'AsRequestLine' - read VALUE[$COUNT] - - # Sanitate values to exclude characters that could - # introduce possible markup malformations to final SVG files. - until [[ ${VALUE[$COUNT]} =~ ${PATTERN[$COUNT]} ]];do - cli_printMessage "${PATTERN_MSG[$COUNT]}" - cli_printMessage "${TITLE[$COUNT]}" 'AsRequestLine' - read VALUE[$COUNT] - done - - # Set default value to empty values. - if [[ ${VALUE[$COUNT]} == '' ]];then - VALUE[$COUNT]=${DEFAULT[$COUNT]} - fi - - # Increase counter. - COUNT=$(($COUNT + 1)) - - done - - # Build list of files to process. - FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}.*\.(svgz|svg)") - - # Set action preamble. - cli_printActionPreamble "${FILES}" - - # Process list of scalable vector graphics. - for FILE in $FILES;do - - # Output action message. - cli_printMessage $FILE 'AsUpdatingLine' - - # Build title from file path. - NAM=$(basename "$FILE") - - # Build url from file path. - URL=$(echo $FILE | sed 's!/home/centos!https://projects.centos.org/svn!') - - # Build keywords from file path. Do not include filename, it - # is already on title. - KEYS=$(dirname "$FILE" | cut -d/ -f6- | tr '/' '\n') - - # Build keywords using SVG standard format. Note that this - # information is inserted inside template file. The - # template file is a replacement set of sed commands - # so we need to escape the new line of each line using one - # backslash (\). As we are doing this inside bash, it is - # required to escape the backslash with another backslash so - # one of them passes literally to template file. - KEYS=$(\ - for KEY in $KEYS;do - echo " $KEY\\" - done) - - # Redefine template instance file name. - INSTANCE=$(cli_getTemporalFile $TEMPLATE) - - # Create template instance. - cp $TEMPLATE $INSTANCE - - # Check template instance. We cannot continue if the template - # instance couldn't be created. - cli_checkFiles $INSTANCE 'f' - - # Reset counter. - COUNT=0 - - while [[ $COUNT -ne ${#TITLE[*]} ]];do - - # Redefine file-specific values. - if [[ $COUNT -eq 0 ]];then - VALUE[$COUNT]=$NAM - elif [[ $COUNT -eq 5 ]];then - VALUE[$COUNT]=$URL - elif [[ $COUNT -eq 6 ]];then - VALUE[$COUNT]=$URL - elif [[ $COUNT -eq 7 ]];then - VALUE[$COUNT]=$URL - elif [[ $COUNT -eq 9 ]];then - VALUE[$COUNT]=$KEYS - fi - - # Apply translation marker replacement. - if [[ $COUNT -eq 9 ]];then - sed -i -r "/${MARKER[$COUNT]}/c\\${VALUE[$COUNT]}" $INSTANCE - else - sed -i -r "s!${MARKER[$COUNT]}!${VALUE[$COUNT]}!g" $INSTANCE - fi - - # Increase counter. - COUNT=$(($COUNT + 1)) - - done - - # Sanitate template instance. - sed -i -r -e 's/>$/>\\/g' $INSTANCE - - # Apply template instance to scalable vector graphic - # file. - sed -i -f $INSTANCE $FILE - - # Remove template instance. - if [[ -f $INSTANCE ]];then - rm $INSTANCE - fi - - # Sanitate scalable vector graphic. - sed -i -r '/^[[:space:]]*$/d' $FILE - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Svg/svg_vacuumDefs.sh b/Scripts/centos-art.sh/Functions/Svg/svg_vacuumDefs.sh deleted file mode 100755 index 8c42754..0000000 --- a/Scripts/centos-art.sh/Functions/Svg/svg_vacuumDefs.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# -# svg_vacuumDefs.sh -- This function removes all unused items from the -# defs section of the SVG file massively. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function svg_vacuumDefs { - - local FILE='' - local FILES='' - - # Build list of files to process. - FILES=$(cli_getFilesList "${ACTIONVAL}" "${FLAG_FILTER}.*\.(svgz|svg)") - - # Set action preamble. - cli_printActionPreamble "${FILES}" - - # Process list of files. - for FILE in $FILES;do - - # Output action message. - cli_printMessage "$FILE" 'AsUpdatingLine' - - # Vacuum unused svg definition using inkscape. - inkscape --vacuum-defs $FILE &> /dev/null - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify.sh b/Scripts/centos-art.sh/Functions/Verify/verify.sh deleted file mode 100755 index 0265eae..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# verify.sh -- This function verifies your workstation for using -# centos-art.sh script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify { - - # Define command-line interface. - verify_getActions - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_doEnvironment.sh b/Scripts/centos-art.sh/Functions/Verify/verify_doEnvironment.sh deleted file mode 100755 index 10eddd5..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_doEnvironment.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# -# verify_doEnvironment.sh -- This function outputs a brief description -# of environment variables used by `centos-art.sh' script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_doEnvironment { - - local -a VARS - local -a INFO - local COUNT=0 - - # Define name of environment variables used by centos-art.sh - # script. - VARS[0]='EDITOR' - VARS[1]='TZ' - VARS[2]='TEXTDOMAIN' - VARS[3]='TEXTDOMAINDIR' - VARS[4]='LANG' - - # Define description of environment variables. - INFO[0]="`gettext "Default text editor"`" - INFO[1]="`gettext "Default time zone representation"`" - INFO[2]="`gettext "Default domain used to retrieve translated messages"`" - INFO[3]="`gettext "Default directory used to retrive translated messages"`" - INFO[4]="`gettext "Default locale information"`" - - until [[ $COUNT -eq ${#VARS[*]} ]];do - - # Let user to reduce output using regular expression as - # reference. - if [[ ${VARS[$COUNT]} =~ $FLAG_FILTER ]];then - - # Output list of environment variables using indirect - # expansion (what a beautiful feature!) to output variable - # value. - cli_printMessage "${INFO[$COUNT]}:" - cli_printMessage "${VARS[$COUNT]}=${!VARS[$COUNT]}" 'AsResponseLine' - - fi - - # Increment counter. - COUNT=$(($COUNT + 1)) - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_doLinkCheck.sh b/Scripts/centos-art.sh/Functions/Verify/verify_doLinkCheck.sh deleted file mode 100755 index 32088aa..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_doLinkCheck.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# -# verify_doLinkCheck.sh -- This function receives a list of required -# symbolic links and verifies them. This function enforces relation -# between link names and their targets (previously defined in -# verify_doLinks.sh function). -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_doLinkCheck { - - local -a LINKS_TARGET - local LINKS_COUNT=0 - - until [[ $LINKS_COUNT -eq ${#LINKS[*]} ]];do - - if [[ -h ${LINKS[$LINKS_COUNT]} ]]; then - - # At this point the required link does exist but we don't - # know if its target is the one it should be. Get target - # from required link in order to check it later. - LINKS_TARGET[$LINKS_COUNT]=$(stat --format='%N' ${LINKS[$LINKS_COUNT]} \ - | tr '`' ' ' | tr "'" ' ' | tr -s ' ' | cut -d' ' -f4) - - # Check required target from required link in order to - # know if it is indeed the one it should be. Otherwise add - # required link to list of missing links. - if [[ ${LINKS_TARGET[$LINKS_COUNT]} != ${TARGETS[$LINKS_COUNT]} ]] ;then - LINKS_MISSING[$LINKS_COUNT]=${LINKS[$LINKS_COUNT]} - LINKS_MISSING_ID="$LINKS_MISSING_ID $LINKS_COUNT" - fi - - else - - # At this point the required link doesn't exist at all. - # Add required link to list of missing links. - LINKS_MISSING[$LINKS_COUNT]=${LINKS[$LINKS_COUNT]} - LINKS_MISSING_ID="$LINKS_MISSING_ID $LINKS_COUNT" - - fi - - # Increase link counter. - LINKS_COUNT=$(($LINKS_COUNT + 1)) - - done - - # Stript out leading spaces from missing links ids. - LINKS_MISSING_ID=$(echo $LINKS_MISSING_ID | sed 's!^ +!!') - - # If there is no missing link, end script execution with a - # descriptive output. - if [[ ${#LINKS_MISSING[*]} -eq 0 ]];then - cli_printMessage "`gettext "The required links are already installed."`" - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_doLinkInstall.sh b/Scripts/centos-art.sh/Functions/Verify/verify_doLinkInstall.sh deleted file mode 100755 index 302a5f5..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_doLinkInstall.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# -# verify_doLinkInstall.sh -- This function receives a list of missing -# links and installs them using `ln'. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_doLinkInstall { - - local ID=0 - local LINKS_PARENT='' - local WARNING='' - - for ID in $LINKS_MISSING_ID;do - - # Verify parent directory of missing link names that have a - # file as target. If the parent directory doesn't exist, - # create it first before creating links inside it. Because - # links are not created yet, we use their related targets as - # reference to determine what type of link we are creating. - if [[ -f ${TARGETS[$ID]} ]];then - LINKS_PARENT=$(dirname "${LINKS[$ID]}") - cli_checkFiles $LINKS_PARENT 'd' - fi - - # Verify missing link that already exists as regular file. If - # a regular file exists with the same name of a required link, - # warn the user about it and continue with the next file in - # the list of missing links that need to be installed. - if [[ -f ${LINKS[$ID]} ]];then - WARNING=" (`gettext "Already exists as regular file."`)" - cli_printMessage "${LINKS[$ID]}${WARNING}" 'AsResponseLine' - continue - fi - - # Create symbolic link. - ln -s ${TARGETS[$ID]} ${LINKS[$ID]} - - done - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_doLinkReport.sh b/Scripts/centos-art.sh/Functions/Verify/verify_doLinkReport.sh deleted file mode 100755 index a47255e..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_doLinkReport.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# -# verify_doLinkReport.sh -- This function outputs information about -# missing links that need to be installed and a confirmation question -# for users to accept the installation action. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_doLinkReport { - - local LINK='' - local LINKS_MISSING_MAX=0 - - # Define max number of missing links. - LINKS_MISSING_MAX=${#LINKS_MISSING[*]} - - # Output list header. - cli_printMessage "`ngettext "The following link will be installed" \ - "The following links will be installed" "$LINKS_MISSING_MAX"`:" - - # Output list body. - for LINK in ${LINKS_MISSING[@]};do - cli_printMessage "${LINK}" 'AsResponseLine' - done - - # Request confirmation for further link installation. - cli_printMessage "`gettext "Do you want to continue"`" 'AsYesOrNoRequestLine' - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_doLinks.sh b/Scripts/centos-art.sh/Functions/Verify/verify_doLinks.sh deleted file mode 100755 index 646377c..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_doLinks.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# verify_doLinks.sh -- This function verifies required links your -# workstation needs in order to run the centos-art command correctly. -# If any required link is missing, the `centos-art.sh' script asks you -# to confirm their installation. When installing links, the -# `centos-art.sh' script uses the `ln' command to achieve the task. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_doLinks { - - local -a LINKS - local -a TARGETS - local -a LINKS_MISSING - local LINKS_MISSING_ID='' - - # Define link names. - LINKS[0]=/home/centos/bin/centos-art - LINKS[1]=/home/centos/.fonts/denmark.ttf - LINKS[2]=/home/centos/.inkscape/palettes/CentOS.gpl - LINKS[3]=/home/centos/.$(rpm -q gimp | cut -d. -f-2)/palettes/CentOS.gpl - LINKS[4]=/home/centos/artwork/branches/Scripts - - # Define link targets. Use array index as reference to know - # relation between link names and targets. Be sure both link names - # and link targets use the same array index value. - TARGETS[0]=/home/centos/artwork/trunk/Scripts/Bash/centos-art.sh - TARGETS[1]=/home/centos/artwork/trunk/Identity/Fonts/Ttf/denmark.ttf - TARGETS[2]=/home/centos/artwork/trunk/Identity/Colors/CentOS.gpl - TARGETS[3]=${TARGETS[2]} - TARGETS[4]=/home/centos/artwork/trunk/Scripts/ - - verify_doLinkCheck - verify_doLinkReport - verify_doLinkInstall - - # At this point all required links must be installed. To confirm - # required links installation let's verify them once more. - verify_doLinks - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_doPackageCheck.sh b/Scripts/centos-art.sh/Functions/Verify/verify_doPackageCheck.sh deleted file mode 100755 index 1b675e5..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_doPackageCheck.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# -# verify_doPackageCheck.sh -- This function receives a list of -# packages and verifies if they are currently installed in your -# system. Third party package verification is also done here. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_doPackageCheck { - - local PACKAGE='' - - # Check package manager command existance. - cli_checkFiles '/bin/rpm' 'x' - - for PACKAGE in $PACKAGES;do - - # Query your system's RPM database. - rpm -q --queryformat "%{NAME}\n" $PACKAGE --quiet - - # Define missing packages. - if [[ $? -ne 0 ]];then - PACKAGES_MISSING[$PACKAGES_COUNT]=$PACKAGE - fi - - # Increase package counter. - PACKAGES_COUNT=$(($PACKAGES_COUNT + 1)) - - done - - # In there is no missing package, end script execution with a - # descriptive output. - if [[ ${#PACKAGES_MISSING[*]} -eq 0 ]];then - cli_printMessage "`gettext "The required packages are already installed."`" - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_doPackageInstall.sh b/Scripts/centos-art.sh/Functions/Verify/verify_doPackageInstall.sh deleted file mode 100755 index da0d5e6..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_doPackageInstall.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# verify_doPackageInstall.sh -- This function receives a list of -# missing packages and installs them using sudo yum. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_doPackageInstall { - - # Verify `yum' command existence. - cli_checkFiles '/usr/bin/yum' 'x' - - # Use sudo to install packages in your system through yum. - sudo yum install ${PACKAGES_MISSING[*]} - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_doPackageReport.sh b/Scripts/centos-art.sh/Functions/Verify/verify_doPackageReport.sh deleted file mode 100755 index 95a755a..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_doPackageReport.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# -# verify_doPackageReport.sh -- This function receives one list of -# missing packages and another list of packages from third party -# repository that were marked as missing packages. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_doPackageReport { - - local PACKAGE='' - local WARNING='' - - cli_printMessage "`ngettext "The following package needs to be installed" \ - "The following packages need to be installed" \ - "$PACKAGES_COUNT"`:" - - for PACKAGE in ${PACKAGES_MISSING[@]};do - - # Is this package from third party? - if [[ $PACKAGE =~ $PACKAGES_THIRD_FLAG_FILTER ]];then - WARNING=" (`gettext "requires third party repository!"`)" - fi - - cli_printMessage "${PACKAGE}${WARNING}" 'AsResponseLine' - - done - - cli_printMessage "`gettext "Do you want to continue"`" 'AsYesOrNoRequestLine' - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_doPackages.sh b/Scripts/centos-art.sh/Functions/Verify/verify_doPackages.sh deleted file mode 100644 index 77ab1df..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_doPackages.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# verify_doPackages.sh -- This function verifies required packages -# your workstation needs in order to run the centos-art command -# correctly. If there are missing packages, the `centos-art.sh' script -# asks you to confirm their installation. When installing packages, -# the `centos-art.sh' script uses the yum application in order to -# achieve the task. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_doPackages { - - local PACKAGES='' - local PACKAGES_THIRD_FLAG_FILTER='' - local -a PACKAGES_MISSING - local PACKAGES_COUNT=0 - - # Define required packages needed by centos-art.sh script. - PACKAGES="bash inkscape ImageMagick netpbm netpbm-progs - syslinux gimp coreutils texinfo info tetex-latex tetex-fonts - tetex-doc tetex-xdvi tetex-dvips gettext texi2html" - - # Define, from required packages, packages being from third - # parties (i.e., packages not included in CentOS [base] - # repository.). - PACKAGES_THIRD_FLAG_FILTER="(inkscape|blender)" - - verify_doPackageCheck - verify_doPackageReport - verify_doPackageInstall - - # At this point we need to recheck installed packages in order to - # be sure the user decided not to continue when there are still - # missing packages to be install. For example this may happen - # when we try to install third party packages and there is no - # third party repository availabe to get those packages from. - verify_doPackages - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_getActions.sh b/Scripts/centos-art.sh/Functions/Verify/verify_getActions.sh deleted file mode 100755 index d9b8b99..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_getActions.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# -# verify_getActions.sh -- This function interpretes arguments passed -# to `verify' functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_getActions { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="packages,links,environment" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Look for options passed through command-line. - while true; do - case "$1" in - - --packages ) - ACTIONNAM="${FUNCNAM}_doPackages" - break - ;; - - --links ) - ACTIONNAM="${FUNCNAM}_doLinks" - break - ;; - - --environment ) - ACTIONNAM="${FUNCNAM}_doEnvironment" - break - ;; - - * ) - break - esac - done - - # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then - eval $ACTIONNAM - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_pathToCli.sh b/Scripts/centos-art.sh/Functions/Verify/verify_pathToCli.sh deleted file mode 100755 index ad35b8e..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_pathToCli.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# -# verify_pathToCli.sh -- This function -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_pathToCli { - - # Define variables as local to avoid conflicts outside. - local -a REPODIRS - local -a REPOFILES - local -a REPOLINKS - local FILE='' - - # Define directories required by the centos-art.sh script command - # line interface. - REPODIRS[0]=/home/centos - REPODIRS[1]=/home/centos/bin - REPODIRS[2]=/home/centos/artwork/trunk/Scripts/Bash - - # Define files required by the centos-art.sh script command line - # interface. - REPOFILES[0]=${REPODIRS[2]}/centos-art.sh - - # Define symbolic links required by the centos-art.sh script - # command line interface. - REPOLINKS[0]=${REPODIRS[1]}/centos-art - - # Check defined directories. - for FILE in "${REPODIRS[@]}";do - cli_checkFiles $FILE 'd' - done - - # Check defined files. - for FILE in "${REPOFILES[@]}";do - cli_checkFiles $FILE 'f' - done - - # Check defined symbolic links. - for FILE in "${REPOLINKS[@]}";do - cli_checkFiles $FILE 'h' - done - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_pathToFonts.sh b/Scripts/centos-art.sh/Functions/Verify/verify_pathToFonts.sh deleted file mode 100644 index 90c1a23..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_pathToFonts.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# -# verify_pathToFonts.sh -- This function checks user's fonts -# directory. In order for some artworks to be rendered correctly, -# denmark font needs to be available. By default, denmark font doesn't -# come with CentOS distribution so create a symbolic link (from the -# one we have inside repository) to make it available if it isn't yet. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_pathToFonts { - - # Define variables as local to avoid conflicts outside. - local -a REPODIRS - local -a REPOFILES - local -a REPOLINKS - local FILE='' - - # Define font related directories. - REPODIRS[0]=/home/centos/.fonts - REPODIRS[1]=/home/centos/artwork/trunk/Identity/Fonts/Ttf - - # Define font related files. - REPOFILES[0]=${REPODIRS[1]}/denmark.ttf - - # Define font related symbolic links. - REPOLINKS[0]=${REPODIRS[0]}/denmark.ttf - - # Check defined directories. - for FILE in "${REPODIRS[@]}";do - cli_checkFiles $FILE 'd' - done - - # Check defined files. - for FILE in "${REPOFILES[@]}";do - cli_checkFiles $FILE 'f' - done - - # Check defined symbolic links. - for FILE in "${REPOLINKS[@]}";do - cli_checkFiles $FILE 'h' - done - -} diff --git a/Scripts/centos-art.sh/Functions/Verify/verify_pathToInkscape.sh b/Scripts/centos-art.sh/Functions/Verify/verify_pathToInkscape.sh deleted file mode 100755 index 69d5932..0000000 --- a/Scripts/centos-art.sh/Functions/Verify/verify_pathToInkscape.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# -# verify_pathToInkscape.sh -- This function prepares user's -# ~/.inkscape configurations directory to use CentOS defaults (e.g., -# palettes, patterns, etc). -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function verify_pathToInkscape { - - # Define variables as local to avoid conflicts outside. - local -a REPODIRS - local -a REPOFILES - local -a REPOLINKS - local FILE='' - - # Define directories required by the centos-art.sh script command - # line interface. - REPODIRS[0]=/home/centos/.inkscape/palettes - REPODIRS[1]=/home/centos/artwork/trunk/Identity/Colors - - # Define files required by the centos-art.sh script command line - # interface. - REPOFILES[0]=${REPODIRS[1]}/CentOS.gpl - - # Define symbolic links required by the centos-art.sh script - # command line interface. - REPOLINKS[0]=${REPODIRS[0]}/CentOS.gpl - - # Check defined directories. - for FILE in "${REPODIRS[@]}";do - cli_checkFiles $FILE 'd' - done - - # Check defined files. - for FILE in "${REPOFILES[@]}";do - cli_checkFiles $FILE 'f' - done - - # Check defined symbolic links. - for FILE in "${REPOLINKS[@]}";do - cli_checkFiles $FILE 'h' - done - -} diff --git a/Scripts/centos-art.sh/Functions/cli.sh b/Scripts/centos-art.sh/Functions/cli.sh deleted file mode 100644 index e4b1e4b..0000000 --- a/Scripts/centos-art.sh/Functions/cli.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# -# cli.sh -- This function initiates centos-art command-line interface. -# Variables defined in this function are accesible by all other -# functions. The cli function is the first script executed by -# centos-art command-line onces invoked. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli { - - # Initialize global variables. - local FUNCNAM='' - local FUNCDIR='' - local FUNCDIRNAM='' - local FUNCSCRIPT='' - local FUNCCONFIG='' - local ACTIONNAM='' - local ACTIONVAL='' - local ARGUMENTS='' - - # Initialize default value to verbosity flag. The verbosity flag - # (--quiet) controls whether centos-art.sh script prints messages - # or not. - local FLAG_QUIET='false' - - # Initialize default value to answer flag. The answer flag - # (--answer) controls whether centos-art.sh script does or does - # not pass confirmation request points. By default it doesn't. - local FLAG_ANSWER='false' - - # Initialize default value to filter flag. The filter flag - # (--filter) is used mainly to reduce the number of files to - # process. The value of this variable is interpreted as - # egrep-posix regular expression. As initial value, we use a - # regular expression that matches everything. - local FLAG_FILTER='.+' - - # Initialize default value to don't commit changes flag. The don't - # commit changes flag (--dont-commit-changes) controls whether - # centos-art.sh script syncronizes changes between Subversion - # central repository and working copy. - local FLAG_DONT_COMMIT_CHANGES='false' - - # Redefine positional parameters stored inside ARGUMENTS variable. - cli_doParseArgumentsReDef "$@" - - # Define function directory (FUNCDIR). The directory path where - # functionalities are stored inside the repository. - FUNCDIR=/home/centos/artwork/trunk/Scripts/Bash/Functions - - # Define function name (FUNCNAM) variable from first command-line - # argument. As convenction we use the first argument to determine - # the exact name of functionality to call. - FUNCNAM=$(cli_getRepoName "$1" 'f') - - # Define function directory. - FUNCDIRNAM=$(cli_getRepoName "$FUNCNAM" 'd') - - # Define function file name. - FUNCSCRIPT=${FUNCDIR}/${FUNCDIRNAM}/${FUNCNAM}.sh - - # Check function script existence. - cli_checkFiles $FUNCSCRIPT 'f' - - # Define function configuration directory. The function - # configuration directory is used to store functionality's - # related files. - FUNCCONFIG=${FUNCDIR}/${FUNCDIRNAM}/Config - - # Remove the first argument passed to centos-art.sh command-line - # in order to build optional arguments inside functionalities. We - # start counting from second argument (inclusive) on. - shift 1 - - # Redefine positional parameters stored inside ARGUMENTS variable. - cli_doParseArgumentsReDef "$@" - - # Parse positional parameters to retrive the value of common - # arguments (e.g., --answer-yes, --filter, --quiet, etc.). - cli_doParseArgumentsCommon - - # Define default text editors used by centos-art.sh script. - if [[ ! "$EDITOR" =~ '/usr/bin/(vim|emacs|nano)' ]];then - EDITOR='/usr/bin/vim' - fi - - # Check text editor execution rights. - cli_checkFiles $EDITOR 'x' - - # Go for function initialization. Keep the cli_getFunctions - # function calling after all variables and arguments definitions. - cli_getFunctions - -} diff --git a/Scripts/centos-art.sh/Functions/cli_checkFiles.sh b/Scripts/centos-art.sh/Functions/cli_checkFiles.sh deleted file mode 100644 index 1e99667..0000000 --- a/Scripts/centos-art.sh/Functions/cli_checkFiles.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash -# -# cli_checkFiles.sh -- This function standardizes file verifications -# inside centos-art.sh script. If file verification fails in anyway, -# centos-art.sh script complains about it and ends up script -# execution. -# -# Usage: -# -# cli_checkFiles FILE [TYPE] -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_checkFiles { - - # Get absolute path to file/directory. - local FILE="$1" - - # Get verification type. - local TYPE="$2" - - # Initialize message output. - local MESSAGE='' - - # Check number of paramaters passed to cli_checkFiles function. At - # least one argument should be passed. - if [[ $# -lt 1 ]];then - cli_printMessage "cli_checkFiles: `gettext "You need to provide one argument at least."`" 'AsErrorLine' - cli_printMessage "$(caller)" "AsToKnowMoreLine" - fi - - # Check value passed as file to cli_checkFiles function. The file - # value cannot be empty nor have extrange values. - cli_checkPathComponent "$FILE" '--default' - - # Perform file verification using FILE and TYPE variables. - case $TYPE in - - d | directory ) - # File exists and is a directory - if [[ ! -d $FILE ]];then - MESSAGE="`eval_gettext "The directory \\\"\\\$FILE\\\" doesn't exist."`" - fi - ;; - - f | regular-file ) - # File exists and is a regular file. - if [[ ! -f $FILE ]];then - MESSAGE="`eval_gettext "The file \\\"\\\$FILE\\\" is not a regular file."`" - fi - ;; - - h | symbolic-link ) - # File exists and is a symbolic link. - if [[ ! -h $FILE ]];then - MESSAGE="`eval_gettext "The file \\\"\\\$FILE\\\" is not a symbolic link."`" - fi - ;; - - x | execution ) - # To exist, file should be executable. - if [[ ! -x $FILE ]];then - MESSAGE="`eval_gettext "The file \\\"\\\$FILE\\\" is not executable."`" - fi - ;; - - fh ) - # To exist, file should be a regular file or a symbolic link. - if [[ ! -f $FILE ]];then - if [[ ! -h $FILE ]];then - MESSAGE="`eval_gettext "The path \\\"\\\$FILE\\\" doesn't exist."`" - fi - fi - ;; - - fd ) - # To exist, file should be a regular file or a directory. - if [[ ! -f $FILE ]];then - if [[ ! -d $FILE ]];then - MESSAGE="`eval_gettext "The path \\\"\\\$FILE\\\" doesn't exist."`" - fi - fi - ;; - - isInWorkingCopy ) - # To exist, file should be inside the working copy. - if [[ ! $FILE =~ "^/home/centos/artwork/.+$" ]];then - MESSAGE="`eval_gettext "The path \\\"\\\$FILE\\\" doesn't exist inside the working copy."`" - fi - ;; - - * ) - # File exists. - if [[ ! -a $FILE ]];then - MESSAGE="`eval_gettext "The path \\\"\\\$FILE\\\" doesn't exist."`" - fi - - esac - - # If file verification fails in anyway, output message information - # and end up script execution. Otherwise, continue with script - # normal flow. - if [[ "$MESSAGE" != '' ]];then - cli_printMessage "$MESSAGE" "AsErrorLine" - cli_printMessage "$(caller)" "AsToKnowMoreLine" - fi - -} diff --git a/Scripts/centos-art.sh/Functions/cli_checkPathComponent.sh b/Scripts/centos-art.sh/Functions/cli_checkPathComponent.sh deleted file mode 100755 index 1b7fb9d..0000000 --- a/Scripts/centos-art.sh/Functions/cli_checkPathComponent.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/bash -# -# cli_checkPathComponent.sh -- This function checks parts/components -# from repository paths. Generally, the path information is passed to -# the function's first positional argument and the part/component we -# want to check is passed to the function's second positional -# argument. If the second argument is not passed, then the first -# argument is assumed to be the part/component we want to check, and -# the action value (ACTIONVAL) variable is used instead as source path -# information. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id: cli_checkPathComponent.sh 958 2011-01-26 16:05:59Z al $ -# ---------------------------------------------------------------------- - -function cli_checkPathComponent { - - local -a PATTERNS - local LOCATION='' - local OPTION='' - local MESSAGE='' - - # Define location which we retrive information from. - if [[ "$#" -eq 1 ]];then - LOCATION="$ACTIONVAL" - OPTION="$1" - elif [[ "$#" -eq 2 ]];then - LOCATION="$1" - OPTION="$2" - else - cli_printMessage "cli_checkPathComponent: `gettext "Invalid arguments."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Define patterns. - PATTERNS[0]="^.+/$(cli_getPathComponent "${LOCATION}" '--release-pattern')/.*$" - PATTERNS[1]=$(cli_getPathComponent "${LOCATION}" '--release-architecture') - PATTERNS[2]=$(cli_getPathComponent "${LOCATION}" '--release-theme') - - # Identify which part of the release we want to output. - case "$OPTION" in - - '--release' ) - if [[ $LOCATION =~ ${PATTERN[0]} ]];then - MESSAGE="`eval_gettext "The release \\\`\\\$LOCATION' is not valid."`" - fi - ;; - - '--architecture' ) - if [[ $LOCATION =~ ${PATTERN[1]} ]];then - MESSAGE="`eval_gettext "The architecture \\\`\\\$LOCATION' is not valid."`" - fi - ;; - - '--theme' ) - if [[ $LOCATION =~ ${PATTERN[2]} ]];then - MESSAGE="`eval_gettext "The theme \\\`\\\$LOCATION' is not valid."`" - fi - ;; - - '--default' | * ) - if [[ $LOCATION == '' ]] \ - || [[ $LOCATION =~ '(\.\.(/)?)' ]] \ - || [[ ! $LOCATION =~ '^[A-Za-z0-9\.:/_-]+$' ]]; then - MESSAGE="`eval_gettext "The value \\\`\\\$LOCATION' is not valid."`" - fi - ;; - esac - - # Output message. - if [[ $MESSAGE != '' ]];then - cli_printMessage "$MESSAGE" 'AsErrorLine' - cli_printMessage "$(caller)" "AsToKnowMoreLine" - fi - -} diff --git a/Scripts/centos-art.sh/Functions/cli_checkRepoDirSource.sh b/Scripts/centos-art.sh/Functions/cli_checkRepoDirSource.sh deleted file mode 100755 index cab663f..0000000 --- a/Scripts/centos-art.sh/Functions/cli_checkRepoDirSource.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash -# -# cli_checkRepoDirSource.sh -- This function provides input validation -# to repository entries considered as source locations. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_checkRepoDirSource { - - # Check action value to be sure strage characters are kept far - # from path provided. - cli_checkPathComponent "$ACTIONVAL" '--default' - - # Redefine source value to build repository absolute path from - # repository top level on. As we are removing - # /home/centos/artwork/ from all centos-art.sh output (in order to - # save horizontal output space), we need to be sure that all - # strings begining with trunk/..., branches/..., and tags/... use - # the correct absolute path. That is, you can refer trunk's - # entries using both /home/centos/artwork/trunk/... or just - # trunk/..., the /home/centos/artwork/ part is automatically added - # here. - if [[ $ACTIONVAL =~ '^(trunk|branches|tags)' ]];then - ACTIONVAL=/home/centos/artwork/$ACTIONVAL - fi - - # Re-define source value to build repository absolute path from - # repository relative paths. This let us to pass repository - # relative paths as source value. Passing relative paths as - # source value may save us some typing; specially if we are stood - # a few levels up from the location we want to refer to as source - # value. There is no need to pass the absolute path to it, just - # refere it relatively. - if [[ -d ${ACTIONVAL} ]];then - - # Add directory to the top of the directory stack. - pushd "$ACTIONVAL" > /dev/null - - # Check directory existence inside the repository. - if [[ $(pwd) =~ '^/home/centos/artwork' ]];then - # Re-define source value using absolute path. - ACTIONVAL=$(pwd) - else - cli_printMessage "`eval_gettext "The location \\\`\\\$ACTIONVAL' is not valid."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Remove directory from the directory stack. - popd > /dev/null - - elif [[ -f ${ACTIONVAL} ]];then - - # Add directory to the top of the directory stack. - pushd "$(dirname "$ACTIONVAL")" > /dev/null - - # Check directory existence inside the repository. - if [[ $(pwd) =~ '^/home/centos/artwork' ]];then - # Re-define source value using absolute path. - ACTIONVAL=$(pwd)/$(basename "$ACTIONVAL") - else - cli_printMessage "`eval_gettext "The location \\\`\\\$ACTIONVAL' is not valid."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Remove directory from the directory stack. - popd > /dev/null - - else - - # At this there is no existent working copy entry, nor a valid - # url. The source value can only be considered as such if it - # is an existent working copy or valid url. So, print a - # message and stop script execution. - cli_printMessage "`eval_gettext "The location \\\`\\\$ACTIONVAL' is not valid."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - - fi - -} diff --git a/Scripts/centos-art.sh/Functions/cli_checkRepoDirTarget.sh b/Scripts/centos-art.sh/Functions/cli_checkRepoDirTarget.sh deleted file mode 100755 index 77452aa..0000000 --- a/Scripts/centos-art.sh/Functions/cli_checkRepoDirTarget.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -# -# cli_checkRepoDirTarget.sh -- This function provides input validation -# to repository entries considered as target location. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_checkRepoDirTarget { - - # Check target value before making an absolute path from it. - cli_checkPathComponent "$FLAG_TO" '--repo-directory' - - # Redefine target value to build repository absolute path from - # repository top level on. As we are removing - # /home/centos/artwork/ from all centos-art.sh output (in order to - # save horizontal output space), we need to be sure that all - # strings begining with trunk/..., branches/..., and tags/... use - # the correct absolute path. That is, you can refer trunk's - # entries using both /home/centos/artwork/trunk/... or just - # trunk/..., the /home/centos/artwork/ part is automatically added - # here. - if [[ $FLAG_TO =~ '^(trunk|branches|tags)/.+$' ]];then - FLAG_TO=/home/centos/artwork/$FLAG_TO - fi - - # Check target value. - if [[ -a ${FLAG_TO} ]];then - - # At this point target value does existent as working copy - # entry. We don't use existent locations as target. So, print - # a message and stop script execution. - cli_printMessage "`eval_gettext "The location \\\`\\\$FLAG_TO' already exists."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - - else - - # At this point existent locations inside working copy and - # invalid urls have been discarded. Assume a new target - # location has being specified. So, build the absolute path - # for it. - - # Add directory to the top of the directory stack. - pushd "$(dirname "$FLAG_TO")" > /dev/null - - # Check directory existence inside the repository. - if [[ $(pwd) =~ '^/home/centos/artwork' ]];then - # Re-define target value using absolute path. - FLAG_TO=$(pwd)/$(basename "$FLAG_TO") - fi - - # Remove directory from the directory stack. - popd > /dev/null - - # Verify target location. It is required that target location - # points to an entry under (trunk|branches|tags)/Identity/... - # directory structure *only*. Remember that Identity parent - # directory structure is the reference used to create parallel - # directories (i.e., documentation, configuration scripts, - # translations, etc.). We don't manipulate parallel - # directories with path ---or any other--- functionality - # directly. Consider manipulation of parallel directories as - # a consequence of a previous manipulation of Identity parent - # directory structure. - if [[ ! ${FLAG_TO} =~ '^.+/(trunk|branches|tags)/Identity/.+$' ]];then - cli_printMessage "`eval_gettext "cannot create \\\`\\\$FLAG_TO': It isn't an identity directory structure."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - fi - -} diff --git a/Scripts/centos-art.sh/Functions/cli_commitRepoChanges.sh b/Scripts/centos-art.sh/Functions/cli_commitRepoChanges.sh deleted file mode 100755 index 3e5366d..0000000 --- a/Scripts/centos-art.sh/Functions/cli_commitRepoChanges.sh +++ /dev/null @@ -1,208 +0,0 @@ -#!/bin/bash -# -# cli_commitRepoChanges.sh -- This function looks for revision changes -# inside absolute path passed as action value and ask you to commit -# them up to central repository. Use this function before or after -# whatever function that makes changes to files inside the working -# copy. It is better to commit small changes than long ones. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_commitRepoChanges { - - # Verify don't commit changes flag. - if [[ $FLAG_DONT_COMMIT_CHANGES == 'true' ]];then - return - fi - - local -a FILES - local -a INFO - local -a FILESNUM - local COUNT=0 - local UPDATEOUT='' - local PREDICATE='' - local LOCALFILES='' - local CHNGDIRECTION='' - local CHNGTOTAL=0 - local LOCATIONS='' - - # Define location. If function arguments are provided to - # cli_commitRepoChanges assume them as path location to work with. - # Function arguments can contain more than one path enclosed by - # quotation mark. In that case all paths are used as location to - # work with. If function arguments are not provided, the - # ACTIONVAL variable default value is used instead. - if [[ "$@" != '' ]];then - LOCATIONS="$@" - else - LOCATIONS="$ACTIONVAL" - fi - - # Verify locations. The location value may point to the working - # copy in the workstation, or to a URL in the central repository. - # The cli_commitRepoChanges function performs actions over working - # copy files only. So, we need to exclude all URL from location - # inside this function. Whatever action you perform over URL will - # take place immediatly through direct commit. - LOCATIONS=$(echo -e "$LOCATIONS" | sed -r "s! +!\n!g" \ - | egrep '^/home/centos/artwork/(trunk|branches|tags)/.+$') - - # Outout separator line. - cli_printMessage '-' 'AsSeparatorLine' - - # Update working copy. - cli_printMessage "`gettext "Bringing changes from the repository into the working copy"`" 'AsResponseLine' - UPDATEOUT=$(svn update ${LOCATIONS}) - - # Check working copy. - cli_printMessage "`gettext "Checking changes in the working copy"`" 'AsResponseLine' - STATUSOUT=$(svn status ${LOCATIONS}) - - # Outout separator line. - cli_printMessage '-' 'AsSeparatorLine' - - # Define path of files considered recent modifications from - # central repository to working copy. - FILES[0]=$(echo "$UPDATEOUT" | egrep "^A.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") - FILES[1]=$(echo "$UPDATEOUT" | egrep "^D.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") - FILES[2]=$(echo "$UPDATEOUT" | egrep "^U.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") - FILES[3]=$(echo "$UPDATEOUT" | egrep "^C.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") - FILES[4]=$(echo "$UPDATEOUT" | egrep "^G.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") - - # Define path fo files considered recent modifications from - # working copy up to central repository. - FILES[5]=$(echo "$STATUSOUT" | egrep "^M.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") - FILES[6]=$(echo "$STATUSOUT" | egrep "^\?.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") - FILES[7]=$(echo "$STATUSOUT" | egrep "^D.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") - FILES[8]=$(echo "$STATUSOUT" | egrep "^A.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") - - # Define description of files considered recent modifications from - # central repository to working copy. - INFO[0]="`gettext "Added"`" - INFO[1]="`gettext "Deleted"`" - INFO[2]="`gettext "Updated"`" - INFO[3]="`gettext "Conflicted"`" - INFO[4]="`gettext "Merged"`" - - # Define description of files considered recent modifications from - # working copy up to central repository. - INFO[5]="`gettext "Modified"`" - INFO[6]="`gettext "Unversioned"`" - INFO[7]=${INFO[1]} - INFO[8]=${INFO[0]} - - while [[ $COUNT -ne ${#FILES[*]} ]];do - - # Get total number of files. Avoid counting empty line. - if [[ "${FILES[$COUNT]}" == '' ]];then - FILESNUM[$COUNT]=0 - else - FILESNUM[$COUNT]=$(echo "${FILES[$COUNT]}" | wc -l) - fi - - # Calculate total amount of changes. - CHNGTOTAL=$(($CHNGTOTAL + ${FILESNUM[$COUNT]})) - - # Build report predicate. Use report predicate to show any - # information specific to the number of files found. For - # example, you can use this section to show warning messages, - # notes, and so on. By default we use the word `file' or - # `files' at ngettext's consideration followed by change - # direction. - if [[ ${FILESNUM[$COUNT]} -lt 1 ]];then - PREDICATE[$COUNT]=`gettext "file"` - else - PREDICATE[$COUNT]=`ngettext "file" "files" ${FILESNUM[$COUNT]}` - fi - - # Redefine report predicate to add direction of changes. - if [[ $COUNT -le 4 ]]; then - # Consider recent modifications from central repository - # down to working copy. - CHNGDIRECTION="`gettext "from the repository."`" - elif [[ $COUNT -gt 4 ]];then - # Consider recent modifications from working copy up to - # central repository. - CHNGDIRECTION="`gettext "from the working copy."`" - fi - - # Redefine report predicate using change direction. - PREDICATE[$COUNT]="${PREDICATE[$COUNT]} ${CHNGDIRECTION}" - - # Output report line. - cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}" 'AsRegularLine' - - # Increase counter. - COUNT=$(($COUNT + 1)) - - done - - # Outout separator line. - cli_printMessage '-' 'AsSeparatorLine' - - # Check total amount of changes. If there is no change, there is - # nothing more to do here except to return flow control to this - # function caller. - if [[ $CHNGTOTAL -eq 0 ]];then - return 0 - fi - - # In case new unversioned files exist, ask user to add them into - # the repository. This may happen when new documentation entries - # are created. - if [[ ${FILESNUM[6]} -gt 0 ]];then - cli_printMessage "`ngettext "The following file is unversioned" \ - "The following files are unversioned" ${FILESNUM[6]}`:" - for FILE in ${FILES[6]};do - cli_printMessage $FILE 'AsResponseLine' - done - cli_printMessage "`ngettext "Do you want to add it now?" \ - "Do you want to add them now?" ${FILESNUM[6]}`" 'AsYesOrNoRequestLine' - svn add ${FILES[6]} --quiet - fi - - # Reset counter. - COUNT=0 - - # Unify local changes into a common variable so common actions can - # be applied to them. - while [[ $COUNT -ne ${#FILES[*]} ]];do - LOCALFILES="$LOCALFILES ${FILES[$COUNT]}" - COUNT=$(($COUNT + 1 )) - done - - # Check list of changed files. If there are changes in the working - # copy, ask the user to verify, and later, commit them up to - # central repository. - if [[ $LOCALFILES != '' ]];then - - # Verify changes. - cli_printMessage "`gettext "Do you want to see changes now?"`" "AsYesOrNoRequestLine" - svn diff $LOCALFILES | less - - # Commit changes. - cli_printMessage "`gettext "Do you want to commit changes now?"`" "AsYesOrNoRequestLine" - svn commit $LOCALFILES - - fi - -} diff --git a/Scripts/centos-art.sh/Functions/cli_doParseArguments.sh b/Scripts/centos-art.sh/Functions/cli_doParseArguments.sh deleted file mode 100755 index 1f9126e..0000000 --- a/Scripts/centos-art.sh/Functions/cli_doParseArguments.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# cli_doParseArguments.sh -- This function redefines arguments -# (ARGUMENTS) global variable using getopt(1) output. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_doParseArguments { - - local ARG1='' - local ARG2='' - local COUNT=0 - - # Verify no option has been passed twice in the command-line. - for ARG1 in $ARGUMENTS;do - ARG1=$(echo $ARG1 | sed -r "s!^'(--[[:alpha:]-]+)=?.+'!\1!") - for ARG2 in $ARGUMENTS;do - ARG2=$(echo $ARG2 | sed -r "s!^'(--[[:alpha:]-]+)=?.+'!\1!") - if [[ $ARG1 == $ARG2 ]];then - COUNT=$(($COUNT + 1)) - fi - #echo "$ARG1 : $ARG2 : $COUNT" - if [[ $COUNT -gt 1 ]];then - cli_printMessage "`eval_gettext "The option \\\`\\\$ARG1' can't be duplicated."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - done - COUNT=0 - done - - # Reset positional parameters using optional arguments. - eval set -- "$ARGUMENTS" - - # Parse optional arguments using getopt. - ARGUMENTS=$(getopt -o "$ARGSS" -l "$ARGSL" -n $CLINAME -- "$@") - - # Be sure getout parsed arguments successfully. - if [[ $? != 0 ]]; then - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - -} diff --git a/Scripts/centos-art.sh/Functions/cli_doParseArgumentsCommon.sh b/Scripts/centos-art.sh/Functions/cli_doParseArgumentsCommon.sh deleted file mode 100755 index e31d91f..0000000 --- a/Scripts/centos-art.sh/Functions/cli_doParseArgumentsCommon.sh +++ /dev/null @@ -1,199 +0,0 @@ -#!/bin/bash -# -# cli_doParseArgumentsCommon.sh -- This function parses positional -# parameters to divide arguments in common argumetns and specific -# arguments. Common arguments might be used by all specific -# functionalities. There is no need to have all common argument -# definitions duplicated in each specific functionality individually. -# Once the value of common arguments have been retrived in FLAG_ -# variables they are removed from ARGUMENTS positional parameters, in -# order to leave the specific arguments that specific functionalities -# most interpret. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_doParseArgumentsCommon { - - local -a SHORT - local -a LONG - local -a REQUIRED - local ARGUMENT='' - local ARGUMENTS_DEFAULT='' - local COMMONS='' - local COMMON='' - local ARGSS='' - local ARGSL='' - local PATTERN='' - local COUNT=0 - - # Define local array to store short definition of common arguments. - SHORT[0]='f' - SHORT[1]='q' - SHORT[2]='y' - SHORT[3]='c' - - # Define local array to store long definition of common arguments. - LONG[0]='filter' - LONG[1]='quiet' - LONG[2]='answer' - LONG[3]='dont-commit-changes' - - # Define local array to store definition of whether the common - # argument is required [one colon], optional [two colons] or not - # required at all [empty]). - REQUIRED[0]=':' - REQUIRED[1]='' - REQUIRED[2]=':' - REQUIRED[3]='' - - # Save default arguments passed to centos-art.sh command-line. - # Since ARGUMENTS variable is used as convenction when arguments - # are redefined (see cli_doParseArgumentsReDef), it is required to - # use an intermediate-pattern variable in order to create the - # common and non-comon arguments information from it. - ARGUMENTS_DEFAULT=$ARGUMENTS - - # Build list of common arguments. - for ARGUMENT in $ARGUMENTS_DEFAULT;do - - while [[ $COUNT -lt ${#LONG[*]} ]];do - - # Define option pattern. - PATTERN="^'(--${LONG[$COUNT]}|-${SHORT[$COUNT]})" - - # Check argument against common argument pattern. - if [[ $ARGUMENT =~ "${PATTERN}" ]];then - if [[ $COMMONS == '' ]];then - COMMONS="${ARGUMENT}" - else - COMMONS="${COMMONS} ${ARGUMENT}" - fi - fi - - # Increment counter. - COUNT=$(($COUNT + 1)) - - done - - # Reset counter. - COUNT=0 - - done - - # Reset positional paramenters to start using common arguments and - # this way be able of performing common arguments verification - # independently from non-common arguments verification (which is - # done inside specific functionalities). - eval set -- "$COMMONS" - - # Redefine positional parameters stored inside ARGUMENTS variable - # to use common arguments only. - cli_doParseArgumentsReDef "$@" - - # Define short and long arguments variables using getopt format. - # This information is passed to getopt in order to now which the - # common arguments are. - while [[ $COUNT -lt ${#LONG[*]} ]];do - - # Define short arguments. - if [[ $ARGSS == '' ]];then - ARGSS=${SHORT[$COUNT]}${REQUIRED[$COUNT]} - else - ARGSS="${ARGSS},${SHORT[$COUNT]}${REQUIRED[$COUNT]}" - fi - - # Define long arguments. - if [[ $ARGSL == '' ]];then - ARGSL=${LONG[$COUNT]}${REQUIRED[$COUNT]} - else - ARGSL="${ARGSL},${LONG[$COUNT]}${REQUIRED[$COUNT]}" - fi - - # Increment counter. - COUNT=$(($COUNT + 1)) - - done - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Define action to take for each option passed. - while true; do - case "$1" in - - --filter ) - FLAG_FILTER="$2" - shift 2 - ;; - - --quiet ) - FLAG_QUIET="true" - shift 1 - ;; - - --answer ) - FLAG_ANSWER="$2" - shift 2 - ;; - - --dont-commit-changes ) - FLAG_DONT_COMMIT_CHANGES="true" - shift 1 - ;; - - * ) - break - ;; - esac - done - - # Redefine ARGUMENTS to use no-common arguments. Common arguments - # has been already parsed, so free specific functions from parsing - # them (there is no need to parse them twice). - if [[ ${COMMONS} != '' ]];then - - # Escape special regular expression characters that might be - # passed through common arguments like `--filter' in order to - # interpreted them literally. Otherwise they might be - # interpreted when they be stript out from default arguments. - COMMONS=$(echo ${COMMONS} | sed -r 's!(\(|\[|\{|\.|\+|\*)!\\\1!g') - - # Stript out common arguments from default arguments one by - # one to avoid order restrictions when removing them from - # string of default arguments. - for COMMON in ${COMMONS};do - ARGUMENTS_DEFAULT=$(echo ${ARGUMENTS_DEFAULT} | sed -r "s!${COMMON}!!g") - done - - fi - - # Use just default arguments. No common argument was passed. - eval set -- "${ARGUMENTS_DEFAULT}" - - # Redefine positional parameters stored inside ARGUMENTS variable. - cli_doParseArgumentsReDef "$@" - -} diff --git a/Scripts/centos-art.sh/Functions/cli_doParseArgumentsReDef.sh b/Scripts/centos-art.sh/Functions/cli_doParseArgumentsReDef.sh deleted file mode 100755 index e163b8c..0000000 --- a/Scripts/centos-art.sh/Functions/cli_doParseArgumentsReDef.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# cli_doParseArgumentsReDef.sh -- This function initiates/reset -# positional parameters based on `$@' variable. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_doParseArgumentsReDef { - - local ARG - - # Clean up arguments global variable. - ARGUMENTS='' - - # Fill up arguments global variable with current positional - # parameter information. To avoid interpretation problems, use - # single quotes to enclose each argument (ARG) from command-line - # idividually. - for ARG in "$@"; do - ARGUMENTS="$ARGUMENTS '$ARG'" - done - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getCopyrightInfo.sh b/Scripts/centos-art.sh/Functions/cli_getCopyrightInfo.sh deleted file mode 100755 index 4e2bab0..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getCopyrightInfo.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/bash -# -# cli_getCopyrightInfo.sh -- This function outputs copyright -# information defined by design model the artistic motif images are -# produced from. As convenction, we use the file `copyright.txt' to -# store design model copyright information, in the root directory of -# design model directory structure. -# -# The copyright information is printed to show the fact that the -# person how creates something has the creation rights over that -# something he/she creates. An so, the legal power to release his/her -# creation under the ethical terms of whatever license he/she -# considers more appropriate, in order to distribute his/her creation. -# -# Inside CentOS Artwork Repository, we print copyright information in -# the following image-related components: -# -# 1. The artistic motifs, to define the visual style of themes. -# -# The copyright information of artistic motifs is owned by the -# person who creates the artistic motif (i.e., the artistic motif -# author). The copyright information of artistic motifs is -# specified in the `authors.txt' file placed inside the artistic -# motif directory structure. The copyright information of -# artistic motifs is printed in imagesunder -# trunk/Identity/Themes/Motifs/$THEME/Concept directory structure -# only. -# -# 2. The design models, to define the characteristics of themes. -# -# The copyright information of design models is owned by the -# person who creates the design model (i.e., the design model -# author). The copyright information of design models is -# specified in the metadata of each scalable vector graphic that -# make a design model on its own. The copyright information of -# design models is not printed in images. -# -# 3. The CentOS themes, to cover each visual manifestation of The -# CentOS Project corporate visual identity. A CentOS theme is -# made of many different images connected among themselves by -# mean of a uniform visual pattern (artistic motif + design -# model). -# -# The copyright information of CentOS themes is owned by The -# CentOS Project. Instead of printing the copyright information -# over all images inside one CentOS theme, the copyright -# information of CentOS themes is printed only on images related -# to Anaconda progress first slides. -# -# The copyright information printed on Anaconda progress first -# slides is used to print the creation rights of The CentOS -# Project over its creation (i.e., The CentOS Distribution) not -# The CentOS Theme itself. -# -# At this point, we've defined who owns the creation rights of image -# components. Now, it is important to remark that if we need to show -# one creation copyright, in different places, all references to the -# same cration copyright information should be the same. Cannot be any -# ambiguity among them. The best way to reach this is having just one -# unique definition, and build images using that unique copyright -# definition as reference. -# -# Another relevant point, we need to be aware of, is that related to -# the licenses. As creators has the creation rights, they have the -# right to distribute their work as their consideration. If creators -# release their creations under the terms of a privatizing license, -# that creation will be almost useless for The CentOS Community. So, -# in order for creations to be useful in The CentOS Community, -# creators should distribution their creations under the terms of a -# license that grants the freedom of using, studying, changing and -# releasing improved versions of them. Likewise, the license should -# prevent any privatizing practice or any kind of darkness that put in -# risk the freedom of The CentOS Community. -# -# What license should be used to distribute images (and the components -# used to build them) is a decision for The CentOS Community to take. -# The license adopted, by The CentOS Community, specifies the ethical -# terms The CentOS Community is agree to work with. It is a reference -# we all have to agree with and follow in the sake of our community -# and ourselves freedom. That's why license selection has to be a -# collective decision, and also be constantly in question. -# -# I'm not a lawyer. So, I can't give details of something I don't know -# certainly. All I've done so far is using my intuition and basic -# understanding of what copyright and license is. So, if you have a -# deeper understanding and experience in such legal topics, please -# feel free to make your own revisions to ideas described here. -# -# In the sake of covering copyright information and license needs -# inside centos-art.sh script, all images produced by `centos-art.sh' -# script will be released using the copyright information of his/her -# creator (see above) and the license Creative Common -# Attribution-ShareAlike 3.0 License -# (http://creativecommons.org/licenses/by-sa/3.0/). -# -# The Creative Common Attribution-ShareAlike 3.0 License has been -# adopted in The CentOS Wiki (http://wiki.centos.org/) and seems to be -# good as well to distribute image-specific creations under CentOS -# Artwork Repository. Of course, as licenses are always questionable, -# the one we've choosed could be changed in the future after a -# collective discussion in the CentOS mailing list, in order to better -# reflect the ethical feelings of our community. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getCopyrightInfo { - - case "$1" in - - '--license' ) - - # Output default license name used by all image-based - # creations inside CentOS Artwork Repository. - echo "Creative Common Attribution-ShareAlike 3.0" - ;; - - '--license-url' ) - - # Ouput default license url used by all image-based - # creations inside CentOS Artwork Repository. - echo "http://creativecommons.org/licenses/by-sa/3.0/" - ;; - - '--copyright-year' ) - - local FILE='' - local YEAR='' - - # Define default copyright file. The place the copyright - # information is retrived from. - FILE="$(echo $TEMPLATE \ - | sed -r "s!(Themes/Models/${THEMEMODEL}).+!\1/copyright.txt!")" - - # Define default copyright year. - if [[ -f $FILE ]];then - YEAR=$(cli_readFileContent "${FILE}" '--copyright-year') - else - YEAR=$(date +%Y) - fi - - # Output default copyright year. - echo $YEAR - ;; - - '--copyright-holder' | * ) - - local FILE='' - local HOLDER='' - - # Define default copyright file. The place the copyright - # information is retrived from. - FILE="$(echo $TEMPLATE \ - | sed -r "s!(Themes/Models/${THEMEMODEL}).+!\1/copyright.txt!")" - - # Define default copyright holder. - if [[ -f $FILE ]];then - HOLDER=$(cli_readFileContent "${FILE}" '--copyright-holder') - else - HOLDER="The CentOS Project. `gettext "All rights reserved."`" - fi - - # Output default copyright holder. - echo $HOLDER - ;; - - esac - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getCountryCodes.sh b/Scripts/centos-art.sh/Functions/cli_getCountryCodes.sh deleted file mode 100755 index d32822d..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getCountryCodes.sh +++ /dev/null @@ -1,277 +0,0 @@ -#!/bin/bash -# -# cli_getCountryCodes.sh -- This function outputs a list with country -# codes as defined in ISO3166 standard. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getCountryCodes { - - local FILTER="$(echo $1 | cut -d_ -f2)" - - COUNTRYCODES='AD - AE - AF - AG - AI - AL - AM - AN - AO - AQ - AR - AS - AT - AU - AW - AZ - BA - BB - BD - BE - BF - BG - BH - BI - BJ - BM - BN - BO - BR - BS - BT - BV - BW - BY - BZ - CA - CC - CD - CF - CG - CH - CI - CK - CL - CM - CN - CO - CR - CS - CU - CV - CX - CY - CZ - DE - DJ - DK - DM - DO - DZ - EC - EE - EG - EH - ER - ES - ET - FI - FJ - FK - FM - FO - FR - GA - GB - GD - GE - GF - GH - GI - GL - GM - GN - GP - GQ - GR - GS - GT - GU - GW - GY - HK - HM - HN - HR - HT - HU - ID - IE - IL - IN - IO - IQ - IR - IS - IT - JM - JO - JP - KE - KG - KH - KI - KM - KN - KP - KR - KW - KY - KZ - LA - LB - LC - LI - LK - LR - LS - LT - LU - LV - LY - MA - MC - MD - MG - MH - MK - ML - MM - MN - MO - MP - MQ - MR - MS - MT - MU - MV - MW - MX - MY - MZ - NA - NC - NE - NF - NG - NI - NL - NO - NP - NR - NU - NZ - OM - PA - PE - PF - PG - PH - PK - PL - PM - PN - PR - PS - PT - PW - PY - QA - RE - RO - RU - RW - SA - SB - SC - SD - SE - SG - SH - SI - SJ - SK - SL - SM - SN - SO - SR - ST - SV - SY - SZ - TC - TD - TF - TG - TH - TJ - TK - TL - TM - TN - TO - TR - TT - TV - TW - TZ - UA - UG - UM - US - UY - UZ - VA - VC - VE - VG - VI - VN - VU - WF - WS - YE - YT - ZA - ZM - ZW' - - if [[ $FILTER != '' ]];then - echo $COUNTRYCODES | egrep "$FILTER" - else - echo "$COUNTRYCODES" - fi - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getCountryName.sh b/Scripts/centos-art.sh/Functions/cli_getCountryName.sh deleted file mode 100755 index 4c82e00..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getCountryName.sh +++ /dev/null @@ -1,759 +0,0 @@ -#!/bin/bash -# -# cli_getCountryName.sh -- This function reads one language locale -# code in the format LL_CC and outputs the name of its related -# country. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getCountryName { - - local LOCALECODE="$(echo $1 | cut -d_ -f2)" - local COUNTRYNAME="" - - case $LOCALECODE in - - 'AD' ) - COUNTRYNAME="`gettext "Andorra"`" - ;; - 'AE' ) - COUNTRYNAME="`gettext "United Arab Emirates"`" - ;; - 'AF' ) - COUNTRYNAME="`gettext "Afghanistan"`" - ;; - 'AG' ) - COUNTRYNAME="`gettext "Antigua and Barbuda"`" - ;; - 'AI' ) - COUNTRYNAME="`gettext "Anguilla"`" - ;; - 'AL' ) - COUNTRYNAME="`gettext "Albania"`" - ;; - 'AM' ) - COUNTRYNAME="`gettext "Armenia"`" - ;; - 'AN' ) - COUNTRYNAME="`gettext "Netherlands Antilles"`" - ;; - 'AO' ) - COUNTRYNAME="`gettext "Angola"`" - ;; - 'AQ' ) - COUNTRYNAME="`gettext "Antarctica"`" - ;; - 'AR' ) - COUNTRYNAME="`gettext "Argentina"`" - ;; - 'AS' ) - COUNTRYNAME="`gettext "Samoa (American)"`" - ;; - 'AT' ) - COUNTRYNAME="`gettext "Austria"`" - ;; - 'AU' ) - COUNTRYNAME="`gettext "Australia"`" - ;; - 'AW' ) - COUNTRYNAME="`gettext "Aruba"`" - ;; - 'AZ' ) - COUNTRYNAME="`gettext "Azerbaijan"`" - ;; - 'BA' ) - COUNTRYNAME="`gettext "Bosnia and Herzegovina"`" - ;; - 'BB' ) - COUNTRYNAME="`gettext "Barbados"`" - ;; - 'BD' ) - COUNTRYNAME="`gettext "Bangladesh"`" - ;; - 'BE' ) - COUNTRYNAME="`gettext "Belgium"`" - ;; - 'BF' ) - COUNTRYNAME="`gettext "Burkina Faso"`" - ;; - 'BG' ) - COUNTRYNAME="`gettext "Bulgaria"`" - ;; - 'BH' ) - COUNTRYNAME="`gettext "Bahrain"`" - ;; - 'BI' ) - COUNTRYNAME="`gettext "Burundi"`" - ;; - 'BJ' ) - COUNTRYNAME="`gettext "Benin"`" - ;; - 'BM' ) - COUNTRYNAME="`gettext "Bermuda"`" - ;; - 'BN' ) - COUNTRYNAME="`gettext "Brunei"`" - ;; - 'BO' ) - COUNTRYNAME="`gettext "Bolivia"`" - ;; - 'BR' ) - COUNTRYNAME="`gettext "Brazil"`" - ;; - 'BS' ) - COUNTRYNAME="`gettext "Bahamas"`" - ;; - 'BT' ) - COUNTRYNAME="`gettext "Bhutan"`" - ;; - 'BV' ) - COUNTRYNAME="`gettext "Bouvet Island"`" - ;; - 'BW' ) - COUNTRYNAME="`gettext "Botswana"`" - ;; - 'BY' ) - COUNTRYNAME="`gettext "Belarus"`" - ;; - 'BZ' ) - COUNTRYNAME="`gettext "Belize"`" - ;; - 'CA' ) - COUNTRYNAME="`gettext "Canada"`" - ;; - 'CC' ) - COUNTRYNAME="`gettext "Cocos (Keeling) Islands"`" - ;; - 'CD' ) - COUNTRYNAME="`gettext "Congo (Dem. Rep.)"`" - ;; - 'CF' ) - COUNTRYNAME="`gettext "Central African Rep."`" - ;; - 'CG' ) - COUNTRYNAME="`gettext "Congo (Rep.)"`" - ;; - 'CH' ) - COUNTRYNAME="`gettext "Switzerland"`" - ;; - 'CI' ) - COUNTRYNAME="`gettext "Co^te d'Ivoire"`" - ;; - 'CK' ) - COUNTRYNAME="`gettext "Cook Islands"`" - ;; - 'CL' ) - COUNTRYNAME="`gettext "Chile"`" - ;; - 'CM' ) - COUNTRYNAME="`gettext "Cameroon"`" - ;; - 'CN' ) - COUNTRYNAME="`gettext "China"`" - ;; - 'CO' ) - COUNTRYNAME="`gettext "Colombia"`" - ;; - 'CR' ) - COUNTRYNAME="`gettext "Costa Rica"`" - ;; - 'CS' ) - COUNTRYNAME="`gettext "Serbia and Montenegro"`" - ;; - 'CU' ) - COUNTRYNAME="`gettext "Cuba"`" - ;; - 'CV' ) - COUNTRYNAME="`gettext "Cape Verde"`" - ;; - 'CX' ) - COUNTRYNAME="`gettext "Christmas Island"`" - ;; - 'CY' ) - COUNTRYNAME="`gettext "Cyprus"`" - ;; - 'CZ' ) - COUNTRYNAME="`gettext "Czech Republic"`" - ;; - 'DE' ) - COUNTRYNAME="`gettext "Germany"`" - ;; - 'DJ' ) - COUNTRYNAME="`gettext "Djibouti"`" - ;; - 'DK' ) - COUNTRYNAME="`gettext "Denmark"`" - ;; - 'DM' ) - COUNTRYNAME="`gettext "Dominica"`" - ;; - 'DO' ) - COUNTRYNAME="`gettext "Dominican Republic"`" - ;; - 'DZ' ) - COUNTRYNAME="`gettext "Algeria"`" - ;; - 'EC' ) - COUNTRYNAME="`gettext "Ecuador"`" - ;; - 'EE' ) - COUNTRYNAME="`gettext "Estonia"`" - ;; - 'EG' ) - COUNTRYNAME="`gettext "Egypt"`" - ;; - 'EH' ) - COUNTRYNAME="`gettext "Western Sahara"`" - ;; - 'ER' ) - COUNTRYNAME="`gettext "Eritrea"`" - ;; - 'ES' ) - COUNTRYNAME="`gettext "Spain"`" - ;; - 'ET' ) - COUNTRYNAME="`gettext "Ethiopia"`" - ;; - 'FI' ) - COUNTRYNAME="`gettext "Finland"`" - ;; - 'FJ' ) - COUNTRYNAME="`gettext "Fiji"`" - ;; - 'FK' ) - COUNTRYNAME="`gettext "Falkland Islands"`" - ;; - 'FM' ) - COUNTRYNAME="`gettext "Micronesia"`" - ;; - 'FO' ) - COUNTRYNAME="`gettext "Faeroe Islands"`" - ;; - 'FR' ) - COUNTRYNAME="`gettext "France"`" - ;; - 'GA' ) - COUNTRYNAME="`gettext "Gabon"`" - ;; - 'GB' ) - COUNTRYNAME="`gettext "Britain (UK)"`" - ;; - 'GD' ) - COUNTRYNAME="`gettext "Grenada"`" - ;; - 'GE' ) - COUNTRYNAME="`gettext "Georgia"`" - ;; - 'GF' ) - COUNTRYNAME="`gettext "French Guiana"`" - ;; - 'GH' ) - COUNTRYNAME="`gettext "Ghana"`" - ;; - 'GI' ) - COUNTRYNAME="`gettext "Gibraltar"`" - ;; - 'GL' ) - COUNTRYNAME="`gettext "Greenland"`" - ;; - 'GM' ) - COUNTRYNAME="`gettext "Gambia"`" - ;; - 'GN' ) - COUNTRYNAME="`gettext "Guinea"`" - ;; - 'GP' ) - COUNTRYNAME="`gettext "Guadeloupe"`" - ;; - 'GQ' ) - COUNTRYNAME="`gettext "Equatorial Guinea"`" - ;; - 'GR' ) - COUNTRYNAME="`gettext "Greece"`" - ;; - 'GS' ) - COUNTRYNAME="`gettext "South Georgia and the South Sandwich Islands"`" - ;; - 'GT' ) - COUNTRYNAME="`gettext "Guatemala"`" - ;; - 'GU' ) - COUNTRYNAME="`gettext "Guam"`" - ;; - 'GW' ) - COUNTRYNAME="`gettext "Guinea-Bissau"`" - ;; - 'GY' ) - COUNTRYNAME="`gettext "Guyana"`" - ;; - 'HK' ) - COUNTRYNAME="`gettext "Hong Kong"`" - ;; - 'HM' ) - COUNTRYNAME="`gettext "Heard Island and McDonald Islands"`" - ;; - 'HN' ) - COUNTRYNAME="`gettext "Honduras"`" - ;; - 'HR' ) - COUNTRYNAME="`gettext "Croatia"`" - ;; - 'HT' ) - COUNTRYNAME="`gettext "Haiti"`" - ;; - 'HU' ) - COUNTRYNAME="`gettext "Hungary"`" - ;; - 'ID' ) - COUNTRYNAME="`gettext "Indonesia"`" - ;; - 'IE' ) - COUNTRYNAME="`gettext "Ireland"`" - ;; - 'IL' ) - COUNTRYNAME="`gettext "Israel"`" - ;; - 'IN' ) - COUNTRYNAME="`gettext "India"`" - ;; - 'IO' ) - COUNTRYNAME="`gettext "British Indian Ocean Territory"`" - ;; - 'IQ' ) - COUNTRYNAME="`gettext "Iraq"`" - ;; - 'IR' ) - COUNTRYNAME="`gettext "Iran"`" - ;; - 'IS' ) - COUNTRYNAME="`gettext "Iceland"`" - ;; - 'IT' ) - COUNTRYNAME="`gettext "Italy"`" - ;; - 'JM' ) - COUNTRYNAME="`gettext "Jamaica"`" - ;; - 'JO' ) - COUNTRYNAME="`gettext "Jordan"`" - ;; - 'JP' ) - COUNTRYNAME="`gettext "Japan"`" - ;; - 'KE' ) - COUNTRYNAME="`gettext "Kenya"`" - ;; - 'KG' ) - COUNTRYNAME="`gettext "Kyrgyzstan"`" - ;; - 'KH' ) - COUNTRYNAME="`gettext "Cambodia"`" - ;; - 'KI' ) - COUNTRYNAME="`gettext "Kiribati"`" - ;; - 'KM' ) - COUNTRYNAME="`gettext "Comoros"`" - ;; - 'KN' ) - COUNTRYNAME="`gettext "St Kitts and Nevis"`" - ;; - 'KP' ) - COUNTRYNAME="`gettext "Korea (North)"`" - ;; - 'KR' ) - COUNTRYNAME="`gettext "Korea (South)"`" - ;; - 'KW' ) - COUNTRYNAME="`gettext "Kuwait"`" - ;; - 'KY' ) - COUNTRYNAME="`gettext "Cayman Islands"`" - ;; - 'KZ' ) - COUNTRYNAME="`gettext "Kazakhstan"`" - ;; - 'LA' ) - COUNTRYNAME="`gettext "Laos"`" - ;; - 'LB' ) - COUNTRYNAME="`gettext "Lebanon"`" - ;; - 'LC' ) - COUNTRYNAME="`gettext "St Lucia"`" - ;; - 'LI' ) - COUNTRYNAME="`gettext "Liechtenstein"`" - ;; - 'LK' ) - COUNTRYNAME="`gettext "Sri Lanka"`" - ;; - 'LR' ) - COUNTRYNAME="`gettext "Liberia"`" - ;; - 'LS' ) - COUNTRYNAME="`gettext "Lesotho"`" - ;; - 'LT' ) - COUNTRYNAME="`gettext "Lithuania"`" - ;; - 'LU' ) - COUNTRYNAME="`gettext "Luxembourg"`" - ;; - 'LV' ) - COUNTRYNAME="`gettext "Latvia"`" - ;; - 'LY' ) - COUNTRYNAME="`gettext "Libya"`" - ;; - 'MA' ) - COUNTRYNAME="`gettext "Morocco"`" - ;; - 'MC' ) - COUNTRYNAME="`gettext "Monaco"`" - ;; - 'MD' ) - COUNTRYNAME="`gettext "Moldova"`" - ;; - 'MG' ) - COUNTRYNAME="`gettext "Madagascar"`" - ;; - 'MH' ) - COUNTRYNAME="`gettext "Marshall Islands"`" - ;; - 'MK' ) - COUNTRYNAME="`gettext "Macedonia"`" - ;; - 'ML' ) - COUNTRYNAME="`gettext "Mali"`" - ;; - 'MM' ) - COUNTRYNAME="`gettext "Myanmar (Burma)"`" - ;; - 'MN' ) - COUNTRYNAME="`gettext "Mongolia"`" - ;; - 'MO' ) - COUNTRYNAME="`gettext "Macao"`" - ;; - 'MP' ) - COUNTRYNAME="`gettext "Northern Mariana Islands"`" - ;; - 'MQ' ) - COUNTRYNAME="`gettext "Martinique"`" - ;; - 'MR' ) - COUNTRYNAME="`gettext "Mauritania"`" - ;; - 'MS' ) - COUNTRYNAME="`gettext "Montserrat"`" - ;; - 'MT' ) - COUNTRYNAME="`gettext "Malta"`" - ;; - 'MU' ) - COUNTRYNAME="`gettext "Mauritius"`" - ;; - 'MV' ) - COUNTRYNAME="`gettext "Maldives"`" - ;; - 'MW' ) - COUNTRYNAME="`gettext "Malawi"`" - ;; - 'MX' ) - COUNTRYNAME="`gettext "Mexico"`" - ;; - 'MY' ) - COUNTRYNAME="`gettext "Malaysia"`" - ;; - 'MZ' ) - COUNTRYNAME="`gettext "Mozambique"`" - ;; - 'NA' ) - COUNTRYNAME="`gettext "Namibia"`" - ;; - 'NC' ) - COUNTRYNAME="`gettext "New Caledonia"`" - ;; - 'NE' ) - COUNTRYNAME="`gettext "Niger"`" - ;; - 'NF' ) - COUNTRYNAME="`gettext "Norfolk Island"`" - ;; - 'NG' ) - COUNTRYNAME="`gettext "Nigeria"`" - ;; - 'NI' ) - COUNTRYNAME="`gettext "Nicaragua"`" - ;; - 'NL' ) - COUNTRYNAME="`gettext "Netherlands"`" - ;; - 'NO' ) - COUNTRYNAME="`gettext "Norway"`" - ;; - 'NP' ) - COUNTRYNAME="`gettext "Nepal"`" - ;; - 'NR' ) - COUNTRYNAME="`gettext "Nauru"`" - ;; - 'NU' ) - COUNTRYNAME="`gettext "Niue"`" - ;; - 'NZ' ) - COUNTRYNAME="`gettext "New Zealand"`" - ;; - 'OM' ) - COUNTRYNAME="`gettext "Oman"`" - ;; - 'PA' ) - COUNTRYNAME="`gettext "Panama"`" - ;; - 'PE' ) - COUNTRYNAME="`gettext "Peru"`" - ;; - 'PF' ) - COUNTRYNAME="`gettext "French Polynesia"`" - ;; - 'PG' ) - COUNTRYNAME="`gettext "Papua New Guinea"`" - ;; - 'PH' ) - COUNTRYNAME="`gettext "Philippines"`" - ;; - 'PK' ) - COUNTRYNAME="`gettext "Pakistan"`" - ;; - 'PL' ) - COUNTRYNAME="`gettext "Poland"`" - ;; - 'PM' ) - COUNTRYNAME="`gettext "St Pierre and Miquelon"`" - ;; - 'PN' ) - COUNTRYNAME="`gettext "Pitcairn"`" - ;; - 'PR' ) - COUNTRYNAME="`gettext "Puerto Rico"`" - ;; - 'PS' ) - COUNTRYNAME="`gettext "Palestine"`" - ;; - 'PT' ) - COUNTRYNAME="`gettext "Portugal"`" - ;; - 'PW' ) - COUNTRYNAME="`gettext "Palau"`" - ;; - 'PY' ) - COUNTRYNAME="`gettext "Paraguay"`" - ;; - 'QA' ) - COUNTRYNAME="`gettext "Qatar"`" - ;; - 'RE' ) - COUNTRYNAME="`gettext "Reunion"`" - ;; - 'RO' ) - COUNTRYNAME="`gettext "Romania"`" - ;; - 'RU' ) - COUNTRYNAME="`gettext "Russia"`" - ;; - 'RW' ) - COUNTRYNAME="`gettext "Rwanda"`" - ;; - 'SA' ) - COUNTRYNAME="`gettext "Saudi Arabia"`" - ;; - 'SB' ) - COUNTRYNAME="`gettext "Solomon Islands"`" - ;; - 'SC' ) - COUNTRYNAME="`gettext "Seychelles"`" - ;; - 'SD' ) - COUNTRYNAME="`gettext "Sudan"`" - ;; - 'SE' ) - COUNTRYNAME="`gettext "Sweden"`" - ;; - 'SG' ) - COUNTRYNAME="`gettext "Singapore"`" - ;; - 'SH' ) - COUNTRYNAME="`gettext "St Helena"`" - ;; - 'SI' ) - COUNTRYNAME="`gettext "Slovenia"`" - ;; - 'SJ' ) - COUNTRYNAME="`gettext "Svalbard and Jan Mayen"`" - ;; - 'SK' ) - COUNTRYNAME="`gettext "Slovakia"`" - ;; - 'SL' ) - COUNTRYNAME="`gettext "Sierra Leone"`" - ;; - 'SM' ) - COUNTRYNAME="`gettext "San Marino"`" - ;; - 'SN' ) - COUNTRYNAME="`gettext "Senegal"`" - ;; - 'SO' ) - COUNTRYNAME="`gettext "Somalia"`" - ;; - 'SR' ) - COUNTRYNAME="`gettext "Suriname"`" - ;; - 'ST' ) - COUNTRYNAME="`gettext "Sao Tome and Principe"`" - ;; - 'SV' ) - COUNTRYNAME="`gettext "El Salvador"`" - ;; - 'SY' ) - COUNTRYNAME="`gettext "Syria"`" - ;; - 'SZ' ) - COUNTRYNAME="`gettext "Swaziland"`" - ;; - 'TC' ) - COUNTRYNAME="`gettext "Turks and Caicos Islands"`" - ;; - 'TD' ) - COUNTRYNAME="`gettext "Chad"`" - ;; - 'TF' ) - COUNTRYNAME="`gettext "French Southern and Antarctic Lands"`" - ;; - 'TG' ) - COUNTRYNAME="`gettext "Togo"`" - ;; - 'TH' ) - COUNTRYNAME="`gettext "Thailand"`" - ;; - 'TJ' ) - COUNTRYNAME="`gettext "Tajikistan"`" - ;; - 'TK' ) - COUNTRYNAME="`gettext "Tokelau"`" - ;; - 'TL' ) - COUNTRYNAME="`gettext "Timor-Leste"`" - ;; - 'TM' ) - COUNTRYNAME="`gettext "Turkmenistan"`" - ;; - 'TN' ) - COUNTRYNAME="`gettext "Tunisia"`" - ;; - 'TO' ) - COUNTRYNAME="`gettext "Tonga"`" - ;; - 'TR' ) - COUNTRYNAME="`gettext "Turkey"`" - ;; - 'TT' ) - COUNTRYNAME="`gettext "Trinidad and Tobago"`" - ;; - 'TV' ) - COUNTRYNAME="`gettext "Tuvalu"`" - ;; - 'TW' ) - COUNTRYNAME="`gettext "Taiwan"`" - ;; - 'TZ' ) - COUNTRYNAME="`gettext "Tanzania"`" - ;; - 'UA' ) - COUNTRYNAME="`gettext "Ukraine"`" - ;; - 'UG' ) - COUNTRYNAME="`gettext "Uganda"`" - ;; - 'UM' ) - COUNTRYNAME="`gettext "US minor outlying islands"`" - ;; - 'US' ) - COUNTRYNAME="`gettext "United States"`" - ;; - 'UY' ) - COUNTRYNAME="`gettext "Uruguay"`" - ;; - 'UZ' ) - COUNTRYNAME="`gettext "Uzbekistan"`" - ;; - 'VA' ) - COUNTRYNAME="`gettext "Vatican City"`" - ;; - 'VC' ) - COUNTRYNAME="`gettext "St Vincent"`" - ;; - 'VE' ) - COUNTRYNAME="`gettext "Venezuela"`" - ;; - 'VG' ) - COUNTRYNAME="`gettext "Virgin Islands (UK)"`" - ;; - 'VI' ) - COUNTRYNAME="`gettext "Virgin Islands (US)"`" - ;; - 'VN' ) - COUNTRYNAME="`gettext "Vietnam"`" - ;; - 'VU' ) - COUNTRYNAME="`gettext "Vanuatu"`" - ;; - 'WF' ) - COUNTRYNAME="`gettext "Wallis and Futuna"`" - ;; - 'WS' ) - COUNTRYNAME="`gettext "Samoa (Western)"`" - ;; - 'YE' ) - COUNTRYNAME="`gettext "Yemen"`" - ;; - 'YT' ) - COUNTRYNAME="`gettext "Mayotte"`" - ;; - 'ZA' ) - COUNTRYNAME="`gettext "South Africa"`" - ;; - 'ZM' ) - COUNTRYNAME="`gettext "Zambia"`" - ;; - 'ZW' ) - COUNTRYNAME="`gettext "Zimbabwe"`" - ;; - * ) - COUNTRYNAME="`gettext "Unknown"`" - - esac - - echo $COUNTRYNAME - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getCurrentLocale.sh b/Scripts/centos-art.sh/Functions/cli_getCurrentLocale.sh deleted file mode 100755 index 3a44fb3..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getCurrentLocale.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# cli_getCurrentLocale.sh -- This function checks LANG environment -# variable and returns the current locale information in the LL_CC -# format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getCurrentLocale { - - local CURRENTLOCALE='' - local OPTION="$1" - - # Redefine current locale using LL_CC format. - CURRENTLOCALE=$(echo $LANG | sed -r 's!(^[a-z]{2,3}_[A-Z]{2}).+$!\1!') - - # Define centos-art.sh script default current locale. If - # centos-art.sh script doesn't support current system locale, use - # English language from United States as default current locale. - if [[ $CURRENTLOCALE == '' ]];then - CURRENTLOCALE='en_US' - fi - - # Output current locale. - case $OPTION in - - '--langcode-only' ) - echo "${CURRENTLOCALE}" | cut -d_ -f1 - ;; - - '--langcode-and-countrycode'| * ) - echo "${CURRENTLOCALE}" - ;; - esac -} diff --git a/Scripts/centos-art.sh/Functions/cli_getFilesList.sh b/Scripts/centos-art.sh/Functions/cli_getFilesList.sh deleted file mode 100755 index 679cec5..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getFilesList.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# -# cli_getFilesList.sh -- This function defines the list of FILES to -# process. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getFilesList { - - local LOCATION='' - local FILTER='' - local FILES='' - - # If first argument is provided to cli_getFilesList, use it as - # default location. Otherwise, if first argument is not provided, - # location takes the action value (ACTIONVAL) as default. - if [[ "$1" != '' ]];then - LOCATION="$1" - else - LOCATION="$ACTIONVAL" - fi - - # If second argument is provided to cli_getFilesList, use it as - # default extension to look for files. Otherwise, if second - # argument is not provided, use flag filter instead. - if [[ "$2" != '' ]];then - FILTER="$2" - else - FILTER="$FLAG_FILTER" - fi - - # Define filter as regular expression pattern. When we use regular - # expressions with find, regular expressions are evaluated against - # the whole file path. This way, when the regular expression is - # specified, we need to build it in a way that matches the whole - # path. Doing so, everytime we pass the `--filter' option in the - # command-line might be a tedious task. Instead, in the sake of - # reducing some typing, we prepare the regular expression here to - # match the whole path using the regular expression provided by - # the user as pattern. - FILTER="^${LOCATION}/${FILTER}$" - - # Define list of files to process. - if [[ -d $LOCATION ]];then - FILES=$(find $LOCATION -regextype posix-egrep -type f -regex "${FILTER}" | sort) - elif [[ -f $LOCATION ]];then - FILES=$LOCATION - fi - - # Output list of files to process. - echo "$FILES" - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getFunctions.sh b/Scripts/centos-art.sh/Functions/cli_getFunctions.sh deleted file mode 100644 index 375b552..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getFunctions.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# -# cli_getFunctions.sh -- This function loads funtionalities supported by -# centos-art.sh script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getFunctions { - - # Define variables as local to avoid conflicts outside. - local FUNCNAMCALL='' - local FUNCFILES='' - - # Build action-specifc script file list. - FUNCFILES=$(ls ${FUNCDIR}/${FUNCDIRNAM}/${FUNCNAM}*.sh) - - for FILE in $FUNCFILES;do - - if [[ -x ${FILE} ]];then - - # Initialize action-specific functions. - . $FILE - - # Export action-specific functions to current shell script - # environment. - FUNCNAMCALL=$(grep '^function ' $FILE | cut -d' ' -f2) - export -f $FUNCNAMCALL - - else - - cli_printMessage "`eval_gettext "The \\\$FILE hasn't execution rights."`" 'AsErrorLine' - cli_printMessage "$(caller)" "AsToKnowMoreLine" - - fi - - done - - # Execute action passed to centos-art.sh script. - if [[ $FUNCNAM != '' ]];then - eval $FUNCNAM - fi - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getLangCodes.sh b/Scripts/centos-art.sh/Functions/cli_getLangCodes.sh deleted file mode 100755 index 2c46d9b..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getLangCodes.sh +++ /dev/null @@ -1,223 +0,0 @@ -#!/bin/bash -# -# cli_getLangCodes.sh -- This function outputs a list with language -# codes as defined in ISO639 standard. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getLangCodes { - - local FILTER="$(echo $1 | cut -d_ -f1)" - - LANGCODES="aa - ab - ae - af - ak - am - an - ar - as - av - ay - az - ba - be - bg - bh - bi - bm - bn - bo - br - bs - ca - ce - ch - co - cr - cs - cu - cv - cy - da - de - dv - dz - ee - el - en - eo - es - et - eu - fa - ff - fi - fj - fo - fr - fy - ga - gd - gl - gn - gu - gv - ha - he - hi - ho - hr - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - io - is - it - iu - ja - jv - ka - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ku - kv - kw - ky - la - lb - lg - li - ln - lo - lt - lu - lv - mg - mh - mi - mk - ml - mn - mo - mr - ms - mt - my - na - nb - nd - ne - ng - nl - nn - no - nr - nv - ny - oc - oj - om - or - os - pa - pi - pl - ps - pt - qu - rm - rn - ro - ru - rw - sa - sc - sd - se - sg - si - sk - sl - sm - sn - so - sq - sr - ss - st - su - sv - sw - ta - te - tg - th - ti - tk - tl - tn - to - tr - ts - tt - tw - ty - ug - uk - ur - uz - ve - vi - vo - wa - wo - xh - yi - yo - za - zh - zu" - - if [[ $FILTER != '' ]];then - echo "$LANGCODES" | egrep "$FILTER" | sed -r 's![[:space:]]+!!g' - else - echo "$LANGCODES" - fi - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getLangName.sh b/Scripts/centos-art.sh/Functions/cli_getLangName.sh deleted file mode 100755 index e49f116..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getLangName.sh +++ /dev/null @@ -1,781 +0,0 @@ -#!/bin/bash -# -# cli_getLangName.sh -- This function reads one language locale code -# in the format LL_CC and outputs its language name. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getLangName { - - local LANGCODE="$(echo "$1" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]')" - local LANGNAME='' - - case $LANGCODE in - - 'aa' ) - LANGNAME="`gettext "Afar"`" - ;; - - 'ab' ) - LANGNAME="`gettext "Abkhazian"`" - ;; - - 'ae' ) - LANGNAME="`gettext "Avestan"`" - ;; - - 'af' ) - LANGNAME="`gettext "Afrikaans"`" - ;; - - 'ak' ) - LANGNAME="`gettext "Akan"`" - ;; - - 'am' ) - LANGNAME="`gettext "Amharic"`" - ;; - - 'an' ) - LANGNAME="`gettext "Aragonese"`" - ;; - - 'ar' ) - LANGNAME="`gettext "Arabic"`" - ;; - - 'as' ) - LANGNAME="`gettext "Assamese"`" - ;; - - 'av' ) - LANGNAME="`gettext "Avaric"`" - ;; - - 'ay' ) - LANGNAME="`gettext "Aymara"`" - ;; - - 'az' ) - LANGNAME="`gettext "Azerbaijani"`" - ;; - - 'ba' ) - LANGNAME="`gettext "Bashkir"`" - ;; - - 'be' ) - LANGNAME="`gettext "Byelorussian"`" - ;; - - 'bg' ) - LANGNAME="`gettext "Bulgarian"`" - ;; - - 'bh' ) - LANGNAME="`gettext "Bihari"`" - ;; - - 'bi' ) - LANGNAME="`gettext "Bislama"`" - ;; - - 'bm' ) - LANGNAME="`gettext "Bambara"`" - ;; - - 'bn' ) - LANGNAME="`gettext "Bengali"`" - ;; - - 'bo' ) - LANGNAME="`gettext "Tibetan"`" - ;; - - 'br' ) - LANGNAME="`gettext "Breton"`" - ;; - - 'bs' ) - LANGNAME="`gettext "Bosnian"`" - ;; - - 'ca' ) - LANGNAME="`gettext "Catalan"`" - ;; - - 'ce' ) - LANGNAME="`gettext "Chechen"`" - ;; - - 'ch' ) - LANGNAME="`gettext "Chamorro"`" - ;; - - 'co' ) - LANGNAME="`gettext "Corsican"`" - ;; - - 'cr' ) - LANGNAME="`gettext "Cree"`" - ;; - - 'cs' ) - LANGNAME="`gettext "Czech"`" - ;; - - 'cu' ) - LANGNAME="`gettext "Church Slavic"`" - ;; - - 'cv' ) - LANGNAME="`gettext "Chuvash"`" - ;; - - 'cy' ) - LANGNAME="`gettext "Welsh"`" - ;; - - 'da' ) - LANGNAME="`gettext "Danish"`" - ;; - - 'de' ) - LANGNAME="`gettext "German"`" - ;; - - 'dv' ) - LANGNAME="`gettext "Divehi"`" - ;; - - 'dz' ) - LANGNAME="`gettext "Dzongkha"`" - ;; - - 'ee' ) - LANGNAME="`gettext "E'we"`" - ;; - - 'el' ) - LANGNAME="`gettext "Greek"`" - ;; - - 'en' ) - LANGNAME="`gettext "English"`" - ;; - - 'eo' ) - LANGNAME="`gettext "Esperanto"`" - ;; - - 'es' ) - LANGNAME="`gettext "Spanish"`" - ;; - - 'et' ) - LANGNAME="`gettext "Estonian"`" - ;; - - 'eu' ) - LANGNAME="`gettext "Basque"`" - ;; - 'fa' ) - LANGNAME="`gettext "Persian"`" - ;; - - 'ff' ) - LANGNAME="`gettext "Fulah"`" - ;; - - 'fi' ) - LANGNAME="`gettext "Finnish"`" - ;; - - 'fj' ) - LANGNAME="`gettext "Fijian"`" - ;; - - 'fo' ) - LANGNAME="`gettext "Faroese"`" - ;; - - 'fr' ) - LANGNAME="`gettext "French"`" - ;; - - 'fy' ) - LANGNAME="`gettext "Frisian"`" - ;; - - 'ga' ) - LANGNAME="`gettext "Irish"`" - ;; - - 'gd' ) - LANGNAME="`gettext "Scots"`" - ;; - - 'gl' ) - LANGNAME="`gettext "Gallegan"`" - ;; - - 'gn' ) - LANGNAME="`gettext "Guarani"`" - ;; - - 'gu' ) - LANGNAME="`gettext "Gujarati"`" - ;; - - 'gv' ) - LANGNAME="`gettext "Manx"`" - ;; - - 'ha' ) - LANGNAME="`gettext "Hausa"`" - ;; - - 'he' ) - LANGNAME="`gettext "Hebrew"`" - ;; - - 'hi' ) - LANGNAME="`gettext "Hindi"`" - ;; - - 'ho' ) - LANGNAME="`gettext "Hiri Motu"`" - ;; - - 'hr' ) - LANGNAME="`gettext "Croatian"`" - ;; - - 'ht' ) - LANGNAME="`gettext "Haitian"`" - ;; - - 'hu' ) - LANGNAME="`gettext "Hungarian"`" - ;; - - 'hy' ) - LANGNAME="`gettext "Armenian"`" - ;; - - 'hz' ) - LANGNAME="`gettext "Herero"`" - ;; - - 'ia' ) - LANGNAME="`gettext "Interlingua"`" - ;; - - 'id' ) - LANGNAME="`gettext "Indonesian"`" - ;; - - 'ie' ) - LANGNAME="`gettext "Interlingue"`" - ;; - - 'ig' ) - LANGNAME="`gettext "Igbo"`" - ;; - - 'ii' ) - LANGNAME="`gettext "Sichuan Yi"`" - ;; - - 'ik' ) - LANGNAME="`gettext "Inupiak"`" - ;; - - 'io' ) - LANGNAME="`gettext "Ido"`" - ;; - - 'is' ) - LANGNAME="`gettext "Icelandic"`" - ;; - - 'it' ) - LANGNAME="`gettext "Italian"`" - ;; - - 'iu' ) - LANGNAME="`gettext "Inuktitut"`" - ;; - - 'ja' ) - LANGNAME="`gettext "Japanese"`" - ;; - - 'jv' ) - LANGNAME="`gettext "Javanese"`" - ;; - - 'ka' ) - LANGNAME="`gettext "Georgian"`" - ;; - - 'kg' ) - LANGNAME="`gettext "Kongo"`" - ;; - - 'ki' ) - LANGNAME="`gettext "Kikuyu"`" - ;; - - 'kj' ) - LANGNAME="`gettext "Kuanyama"`" - ;; - - 'kk' ) - LANGNAME="`gettext "Kazakh"`" - ;; - - 'kl' ) - LANGNAME="`gettext "Kalaallisut"`" - ;; - - 'km' ) - LANGNAME="`gettext "Khmer"`" - ;; - - 'kn' ) - LANGNAME="`gettext "Kannada"`" - ;; - - 'ko' ) - LANGNAME="`gettext "Korean"`" - ;; - - 'kr' ) - LANGNAME="`gettext "Kanuri"`" - ;; - - 'ks' ) - LANGNAME="`gettext "Kashmiri"`" - ;; - - 'ku' ) - LANGNAME="`gettext "Kurdish"`" - ;; - - 'kv' ) - LANGNAME="`gettext "Komi"`" - ;; - - 'kw' ) - LANGNAME="`gettext "Cornish"`" - ;; - - 'ky' ) - LANGNAME="`gettext "Kirghiz"`" - ;; - - 'la' ) - LANGNAME="`gettext "Latin"`" - ;; - - 'lb' ) - LANGNAME="`gettext "Letzeburgesch"`" - ;; - - 'lg' ) - LANGNAME="`gettext "Ganda"`" - ;; - - 'li' ) - LANGNAME="`gettext "Limburgish"`" - ;; - - 'ln' ) - LANGNAME="`gettext "Lingala"`" - ;; - - 'lo' ) - LANGNAME="`gettext "Lao"`" - ;; - - 'lt' ) - LANGNAME="`gettext "Lithuanian"`" - ;; - - 'lu' ) - LANGNAME="`gettext "Luba-Katanga"`" - ;; - - 'lv' ) - LANGNAME="`gettext "Latvian"`" - ;; - - 'mg' ) - LANGNAME="`gettext "Malagasy"`" - ;; - - 'mh' ) - LANGNAME="`gettext "Marshall"`" - ;; - - 'mi' ) - LANGNAME="`gettext "Maori"`" - ;; - - 'mk' ) - LANGNAME="`gettext "Macedonian"`" - ;; - - 'ml' ) - LANGNAME="`gettext "Malayalam"`" - ;; - - 'mn' ) - LANGNAME="`gettext "Mongolian"`" - ;; - - 'mo' ) - LANGNAME="`gettext "Moldavian"`" - ;; - - 'mr' ) - LANGNAME="`gettext "Marathi"`" - ;; - - 'ms' ) - LANGNAME="`gettext "Malay"`" - ;; - - 'mt' ) - LANGNAME="`gettext "Maltese"`" - ;; - - 'my' ) - LANGNAME="`gettext "Burmese"`" - ;; - - 'na' ) - LANGNAME="`gettext "Nauru"`" - ;; - - 'nb' ) - LANGNAME="`gettext "Norwegian Bokmaal"`" - ;; - - 'nd' ) - LANGNAME="`gettext "Ndebele, North"`" - ;; - - 'ne' ) - LANGNAME="`gettext "Nepali"`" - ;; - - 'ng' ) - LANGNAME="`gettext "Ndonga"`" - ;; - - 'nl' ) - LANGNAME="`gettext "Dutch"`" - ;; - - 'nn' ) - LANGNAME="`gettext "Norwegian Nynorsk"`" - ;; - - 'no' ) - LANGNAME="`gettext "Norwegian"`" - ;; - - 'nr' ) - LANGNAME="`gettext "Ndebele, South"`" - ;; - - 'nv' ) - LANGNAME="`gettext "Navajo"`" - ;; - - 'ny' ) - LANGNAME="`gettext "Chichewa"`" - ;; - - 'oc' ) - LANGNAME="`gettext "Occitan"`" - ;; - - 'oj' ) - LANGNAME="`gettext "Ojibwa"`" - ;; - - 'om' ) - LANGNAME="`gettext "(Afan) Oromo"`" - ;; - - 'or' ) - LANGNAME="`gettext "Oriya"`" - ;; - - 'os' ) - LANGNAME="`gettext "Ossetian; Ossetic"`" - ;; - - 'pa' ) - LANGNAME="`gettext "Panjabi; Punjabi"`" - ;; - - 'pi' ) - LANGNAME="`gettext "Pali"`" - ;; - - 'pl' ) - LANGNAME="`gettext "Polish"`" - ;; - - 'ps' ) - LANGNAME="`gettext "Pashto, Pushto"`" - ;; - - 'pt' ) - LANGNAME="`gettext "Portuguese"`" - ;; - - 'qu' ) - LANGNAME="`gettext "Quechua"`" - ;; - - 'rm' ) - LANGNAME="`gettext "Rhaeto-Romance"`" - ;; - - 'rn' ) - LANGNAME="`gettext "Rundi"`" - ;; - - 'ro' ) - LANGNAME="`gettext "Romanian"`" - ;; - - 'ru' ) - LANGNAME="`gettext "Russian"`" - ;; - - 'rw' ) - LANGNAME="`gettext "Kinyarwanda"`" - ;; - - 'sa' ) - LANGNAME="`gettext "Sanskrit"`" - ;; - - 'sc' ) - LANGNAME="`gettext "Sardinian"`" - ;; - - 'sd' ) - LANGNAME="`gettext "Sindhi"`" - ;; - - 'se' ) - LANGNAME="`gettext "Northern Sami"`" - ;; - - 'sg' ) - LANGNAME="`gettext "Sango; Sangro"`" - ;; - - 'si' ) - LANGNAME="`gettext "Sinhalese"`" - ;; - - 'sk' ) - LANGNAME="`gettext "Slovak"`" - ;; - - 'sl' ) - LANGNAME="`gettext "Slovenian"`" - ;; - - 'sm' ) - LANGNAME="`gettext "Samoan"`" - ;; - - 'sn' ) - LANGNAME="`gettext "Shona"`" - ;; - - 'so' ) - LANGNAME="`gettext "Somali"`" - ;; - - 'sq' ) - LANGNAME="`gettext "Albanian"`" - ;; - - 'sr' ) - LANGNAME="`gettext "Serbian"`" - ;; - - 'ss' ) - LANGNAME="`gettext "Swati; Siswati"`" - ;; - - 'st' ) - LANGNAME="`gettext "Sesotho; Sotho, Southern"`" - ;; - - 'su' ) - LANGNAME="`gettext "Sundanese"`" - ;; - - 'sv' ) - LANGNAME="`gettext "Swedish"`" - ;; - - 'sw' ) - LANGNAME="`gettext "Swahili"`" - ;; - - 'ta' ) - LANGNAME="`gettext "Tamil"`" - ;; - - 'te' ) - LANGNAME="`gettext "Telugu"`" - ;; - - 'tg' ) - LANGNAME="`gettext "Tajik"`" - ;; - - 'th' ) - LANGNAME="`gettext "Thai"`" - ;; - - 'ti' ) - LANGNAME="`gettext "Tigrinya"`" - ;; - - 'tk' ) - LANGNAME="`gettext "Turkmen"`" - ;; - - 'tl' ) - LANGNAME="`gettext "Tagalog"`" - ;; - - 'tn' ) - LANGNAME="`gettext "Tswana; Setswana"`" - ;; - - 'to' ) - LANGNAME="`gettext "Tonga (?)"`" - ;; - - 'tr' ) - LANGNAME="`gettext "Turkish"`" - ;; - - 'ts' ) - LANGNAME="`gettext "Tsonga"`" - ;; - - - 'tt' ) - LANGNAME="`gettext "Tatar"`" - ;; - - 'tw' ) - LANGNAME="`gettext "Twi"`" - ;; - - 'ty' ) - LANGNAME="`gettext "Tahitian"`" - ;; - - 'ug' ) - LANGNAME="`gettext "Uighur"`" - ;; - - 'uk' ) - LANGNAME="`gettext "Ukrainian"`" - ;; - - 'ur' ) - LANGNAME="`gettext "Urdu"`" - ;; - - 'uz' ) - LANGNAME="`gettext "Uzbek"`" - ;; - - 've' ) - LANGNAME="`gettext "Venda"`" - ;; - - 'vi' ) - LANGNAME="`gettext "Vietnamese"`" - ;; - - 'vo' ) - LANGNAME="`gettext "Volapuk; Volapuk"`" - ;; - - 'wa' ) - LANGNAME="`gettext "Walloon"`" - ;; - - 'wo' ) - LANGNAME="`gettext "Wolof"`" - ;; - - 'xh' ) - LANGNAME="`gettext "Xhosa"`" - ;; - - 'yi' ) - LANGNAME="`gettext "Yiddish (formerly ji)"`" - ;; - - 'yo' ) - LANGNAME="`gettext "Yoruba"`" - ;; - - 'za' ) - LANGNAME="`gettext "Zhuang"`" - ;; - - 'zh' ) - LANGNAME="`gettext "Chinese"`" - ;; - - 'zu' ) - LANGNAME="`gettext "Zulu"`" - ;; - - * ) - LANGNAME="`gettext "Unknown"`" - - esac - - echo $LANGNAME; -} - diff --git a/Scripts/centos-art.sh/Functions/cli_getLocales.sh b/Scripts/centos-art.sh/Functions/cli_getLocales.sh deleted file mode 100755 index e72fc3d..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getLocales.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# cli_getLocales.sh -- This function outputs/verifies locale codes in -# LL and LL_CC format. Combine both ISO639 and ISO3166 specification -# in order to build the final locale list. This function defines which -# translation locales are supported inside CentOS Artwork Repository. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getLocales { - - # Print locales supported by centos-art.sh script. - locale -a | egrep '^[a-z]{2,3}_[A-Z]{2}$' | sort | uniq - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getPathComponent.sh b/Scripts/centos-art.sh/Functions/cli_getPathComponent.sh deleted file mode 100755 index 6d0d078..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getPathComponent.sh +++ /dev/null @@ -1,230 +0,0 @@ -#!/bin/bash -# -# cli_getPathComponent.sh -- This function evaluates one repository -# path and output parts/components from it. Generally, the path -# information is passed to the function's first positional argument -# and the part/component we want to retrive is passed to the -# function's second positional argument. If second argument is not -# passed, then first argument is assumed to be the part/component we -# want to retrive, and action value (ACTIONVAL) variable is used -# instead as source path information. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getPathComponent { - - local -a PATTERN - local LOCATION='' - local OPTION='' - - # Define location which we retrive information from. - if [[ "$#" -eq 1 ]];then - LOCATION="$ACTIONVAL" - OPTION="$1" - elif [[ "$#" -eq 2 ]];then - LOCATION="$1" - OPTION="$2" - else - cli_printMessage "cli_getPathComponent: `gettext "Invalid arguments."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Define release pattern. - PATTERN[0]="(([[:digit:]]+)(\.([[:digit:]]+)){,1})" - - # Define architecture pattern. Make it match the architectures the - # CentOS distribution is able to be installed on. - PATTERN[1]="(i386|x86_64)" - - # Define theme pattern for trunk, branches, and tags directory - # structures. - # - # trunk: - # ------ - # Themes are made of `Models' and `Motifs'. `Models' controls the - # `Motifs' characteristcs and it is not rendereable. On the other - # hand, `Motifs' controls the theme visual style and do is - # renderable. Since we only need to know the theme name when we - # render something, we take the `Motifs' directory structure as - # reference to find out the theme name we are producing images - # for. - # - # `Motifs' are organized by names, so when we say `a theme name' - # we are really saying `the artistic motif name of a theme', but - # for short `theme name' is used instead. `Models' are also - # organized by names, but we do never use model names to name a - # thame. We always say the `theme models' or `the models of the - # theme` to refere the theme component that controls the - # characteristics of artistic motifs. We never name a thame as its - # model. We use artistic motifs name for such purpose. - # - # Inside artistic motif names, we organize different versions of - # the same artistic motif by means of numerical worklines. - # Worklines, inside trunk, have an integer numerical form and - # begin at `1'. They increment one unit each time a new/fresh - # visual style ---for the same artistic motif--- is conceived. - # - # For example, the Flame theme uses the flame filter of Gimp to - # produce different fractal patterns randomly. We use the flame - # filter to produce different visual styles under the same theme - # since all patterns we produce are based on the same pattern - # (i.e., the random fractal pattern of Gimp's flame filter). This - # way, if you no longer want to produce visual styles from flame - # filter, it is time to create a new artistic motif name for it. - # - # This schema is very convenient for designers and packagers, - # since different designers can create their own worklines and go - # on with them until CentOS distribution release date is close. At - # that time, a workline is selected and tagged for packaging. - # Translators and programmers can continue working indepently, and - # without affection, in their own directory structures. - # - # Example: - # +------> theme name - # |-->| - # trunk/.../Themes/Motifs/Flame/1 - # trunk/.../Themes/Motifs/Flame/2 - # trunk/.../Themes/Motifs/Flame/3 - # | - # +----> theme release version - # - # Sometimes we only need to retrive the theme name, but othertimes - # both the theme name and its work-line is required as well. - # - # branches: - # --------- - # The branch development line is treated just as trunk development - # line does, but we rarely use it since it could be confusing to - # know whether a tag was created from trunk or branches. - # - # Conceive an enumeration schema in order to differentiate - # branches from trunk is not convenient either, it would introduce - # an intermediate point to the final production of tags we would - # need to be aware of. Instead of such configuration, we prefer - # to go straightforward from trunk to tags. - # - # Intermediate branches for quality assurance might be good in - # some situations, but not when we produce themes. We need a - # simple structure, where we could design, render content (using - # centos-art.sh), and release for testing (through tags). If - # something goes wrong in the released tag, it would be fixed in - # trunk and later released in another tagged relase. - # - # Of course, care should be taken to avoid making of trunk - # development line a chaotic place. Everbody should know exactly - # what they are doing therein. We need to design protections to - # isolate possible damages and that way, we could know exactly - # what and where we need to concentrate in and put our time on. - # - # In resume, do not use branches if you don't need to. Use trunk - # development line instead. - # - # tags: - # ----- - # The tag frozen line is mainly used to perform theme releases. - # - # Example: - # +------> theme name - # |-->| - # tags/.../Themes/Motifs/Flame/1.0 - # trunk/.../Themes/Motifs/Flame/1 |--> minor update - # |----> major udpate - # - # Tags have the format X.Z, where X is the first number in the - # name (e.g., `1') and represents the trunk/branches artistic - # motif version. The Z represents the second number in the name - # (e.g., `0') which is the tag version itself. - # - # Tag versions start at `0' and increment one unit each time a new - # tag is created from the same artistic motif version. When a new - # tag is created for the same artistic motif version, the first - # number in the tag name remains intact. The first number in the - # tag name only changes when we create a new tag for a new - # artistic motif version. - # - # Consider the following relations: - # - # trunk/.../Themes/Motifs/Flame/1 - # tags/.../Themes/Motifs/Flame/1.0 - # tags/.../Themes/Motifs/Flame/1.1 - # tags/.../Themes/Motifs/Flame/1.2 - # - # trunk/.../Themes/Motifs/Flame/2 - # tags/.../Themes/Motifs/Flame/2.0 - # tags/.../Themes/Motifs/Flame/2.1 - # tags/.../Themes/Motifs/Flame/2.2 - # - # trunk/.../Themes/Motifs/TreeFlower/1 - # ... - # and so on. - # - # Tag versions are created to release fixes and improvements, Tags - # are immutable (i.e., once tags are created, they shouldn't be - # modified.). - PATTERN[2]="^.+/Identity/Themes/Motifs/(([A-Za-z0-9]+)/${PATTERN[0]})/.+$" - - # Identify which part of the release we want to output. - case "$OPTION" in - - '--release' ) - echo "$LOCATION" | sed -r "s!.+/${PATTERN[0]}/?!\1!" - ;; - - '--release-major' ) - echo "$LOCATION" | sed -r "s!.+/${PATTERN[0]}/?!\2!" - ;; - - '--release-minor' ) - echo "$LOCATION" | sed -r "s!.+/${PATTERN[0]}/?!\4!" - ;; - - '--release-pattern' ) - echo "${PATTERN[0]}" - ;; - - '--architecture' ) - echo "$LOCATION" | sed -r "s!${PATTERN[1]}!\1!" - ;; - - '--architecture-pattern' ) - echo "${PATTERN[1]}" - ;; - - '--theme' ) - echo "$LOCATION" | sed -r "s!${PATTERN[2]}!\1!" - ;; - - '--theme-name' ) - echo "$LOCATION" | sed -r "s!${PATTERN[2]}!\2!" - ;; - - '--theme-release' ) - echo "$LOCATION" | sed -r "s!${PATTERN[2]}!\3!" - ;; - - '--theme-pattern' ) - echo "${PATTERN[2]}" - ;; - - esac - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getRepoName.sh b/Scripts/centos-art.sh/Functions/cli_getRepoName.sh deleted file mode 100755 index 5d85cd3..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getRepoName.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/bash -# -# cli_getRepoName.sh -- This function sets naming convenction. Inside -# CentOS Artowrk Repository, regular files are written in lower case -# and directories are written in lower case but with the first letter -# in upper case. Use this function to sanitate the name of regular -# files and directory components of paths you work with. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getRepoName { - - local NAME="$1" - local TYPE="$2" - local DIRS='' - local DIR='' - local CLEANDIRS='' - local PREFIXDIR='' - - case $TYPE in - - 'f' | 'basename' ) - - # Reduce the path passed to use just the non-directory - # part of it (i.e., the last component in the path; _not_ - # the last "real" directory in the path). - NAME=$(basename $NAME) - - # Clean value. - NAME=$(echo $NAME \ - | tr -s ' ' '_' \ - | tr '[:upper:]' '[:lower:]') - ;; - - 'd' | 'dirname' ) - - # Reduce path information passed to use just the directory - # part of it. Of course, this is applied only if there is - # a directory part in the path. However, if there is no - # directory part but there is a non-empty value in the - # path, assume that value as directory part and clean it - # up. - if [[ $NAME =~ '.+/.+' ]];then - - # When path information is reduced, we need to take - # into account that absolute path may be provided. - # Absolute paths include directory structures outside - # the repository directory structure we don't want to - # sanitate (e.g., /home/, /home/centos/, - # /home/centos/artwork, /home/centos/artwork/turnk/, - # trunk/, etc.). In these cases, it is required that - # those path component remain untouched. So, in the - # sake of keeping path components, outside repository - # directory structure untouched, we use the PREFIXDIR - # variable to temporarly store the prefix directory - # structure we don't want to sanitate. - PREFIXDIR=$(echo $NAME \ - | sed -r "s,^((${HOME}/artwork/)?(trunk|branches|tags)/).+$,\1,") - - # ... and remove it from the path information we do - # want to sanitate. - DIRS=$(dirname "$NAME" \ - | sed -r "s!^${PREFIXDIR}!!" \ - | tr '/' ' ') - - else - - # At this point, there is not directory part in the - # information passed, so use the value passed as - # directory part as such. - DIRS=$NAME - - fi - - for DIR in $DIRS;do - - # Sanitate directory component. - if [[ $DIR =~ '^[a-z]' ]];then - DIR=$(echo ${DIR} \ - | tr -s ' ' '_' \ - | tr '[:upper:]' '[:lower:]' \ - | sed -r 's/^([[:alpha:]])/\u\1/') - fi - - # Rebuild path using sanitated values. - CLEANDIRS="${CLEANDIRS}/$DIR" - - done - - # Redefine path using sanitated values. - NAME=$(echo ${CLEANDIRS} | sed -r "s!^/!!") - - # Add prefix directory information to sanitated path - # information. - if [[ "$PREFIXDIR" != '' ]];then - NAME=${PREFIXDIR}${NAME} - fi - ;; - - 'fd' | 'basename-to-dirname' ) - - # Retrive non-directory part. - NAME=$(cli_getRepoName $NAME 'f') - - # Retrive cleaned directory part from non-directory part. - NAME=$(cli_getRepoName $NAME 'd') - ;; - - 'df' | 'dirname-to-basename' ) - - # Retrive cleaned directory part from non-directory part. - NAME=$(cli_getRepoName $NAME 'd') - - # Retrive non-directory part. - NAME=$(cli_getRepoName $NAME 'f') - ;; - - 'dfd' | 'dirname-to-basename-to-dirname' ) - - # Retrive cleaned directory part from non-directory part. - NAME=$(cli_getRepoName $NAME 'd') - - # Retrive non-directory part. - NAME=$(cli_getRepoName $NAME 'f') - - # Retrive cleaned directory part from non-directory part. - NAME=$(cli_getRepoName $NAME 'd') - ;; - esac - - # Output clean path information. - echo $NAME - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getRepoParallelDirs.sh b/Scripts/centos-art.sh/Functions/cli_getRepoParallelDirs.sh deleted file mode 100755 index 16cb0a1..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getRepoParallelDirs.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# -# cli_getRepoParallelDirs.sh -- This function returns the parallel -# directories related to the first positional paramenter passed as -# parent directory. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getRepoParallelDirs { - - local BOND='' - local TDIR='' - local -a PDIRS - - # Define bond string using first positional parameter as - # reference. - if [[ "$1" != '' ]];then - BOND="$1" - elif [[ "$ACTIONVAL" != '' ]];then - BOND="$ACTIONVAL" - else - cli_printMessage "cli_getRepoParallelDirs: `gettext "The bond string is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Define repository top level directory. - TDIR=$(cli_getRepoTLDir ${BOND}) - - # Define parallel directory base structures. - PDIRS[0]=Manuals/$(cli_getCurrentLocale)/Texinfo/Repository/$(cli_getRepoTLDir "${BOND}" '--relative') - PDIRS[1]=Scripts/Bash/Functions/Render/Config - PDIRS[2]=Locales - - # Redefine bond string without its top level directory structure. - BOND=$(echo $BOND | sed -r "s,^${TDIR}/(.+)$,\1,") - - # Concatenate repository top level directory, parallel directory - # base structure, and bond information; in order to produce the - # final parallel directory path. - for PDIR in "${PDIRS[@]}";do - echo ${TDIR}/${PDIR}/${BOND} - done - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getRepoStatus.sh b/Scripts/centos-art.sh/Functions/cli_getRepoStatus.sh deleted file mode 100755 index a7b42db..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getRepoStatus.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# cli_getRepoStatus.sh -- This function requests the working copy -# using the svn status command and returns the first character in the -# output line, as described in svn help status, for the LOCATION -# specified. Use this function to perform verifications based a -# repository LOCATION status. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getRepoStatus { - - local LOCATION="$1" - local STATUS='' - - # Define regular expression pattern to retrive first column, - # returned by subversion status command. This column is one - # character column as describes `svn help status' command. - local PATTERN='^( |A|C|D|I|M|R|X|\?|!|~).+$' - - # Verify the file used as source to retrive its status - # information. We only use regular files or directories inside the - # working copy. - cli_checkFiles "$LOCATION" 'fd' - cli_checkFiles "$LOCATION" 'isInWorkingCopy' - - # Use subversion `status' command to retrive the first character - # in the output. Discard standard error output. - STATUS="$(svn status "$LOCATION" | sed -r "s/${PATTERN}/\1/" 2>/dev/null)" - - # Outout status information. - echo -n "$STATUS" - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getRepoTLDir.sh b/Scripts/centos-art.sh/Functions/cli_getRepoTLDir.sh deleted file mode 100755 index ce6ed8f..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getRepoTLDir.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# -# cli_getRepoTLDir.sh -- This function returns the repository top -# level absolute path. The repository top level absolute path may be -# /home/centos/artwork/trunk, /home/centos/artwork/branches, or -# /home/centos/artwork/tags. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getRepoTLDir { - - local PATTERN='' - local REPLACE='' - local LOCATION='' - - # Define location. If first argument is provided use it as default - # location. Otherwise, if first argument is not provided, - # location takes the action value (ACTIONVAL) as default. - if [[ "$1" != '' ]];then - LOCATION="$1" - else - LOCATION="$ACTIONVAL" - fi - - # Verify location. - if [[ $LOCATION =~ '^/home/centos/artwork/(trunk|branches|tags)/.+$' ]];then - case "$2" in - -r|--relative ) - PATTERN='^/home/centos/artwork/(trunk|branches|tags)/.+$' - REPLACE='\1' - ;; - -a|--absolute|* ) - PATTERN='^(/home/centos/artwork/(trunk|branches|tags))/.+$' - REPLACE='\1' - ;; - esac - else - cli_printMessage "cli_getRepoTLDir: `eval_gettext "The location \\\`\\\$LOCATION' is not valid."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Print location. - echo $LOCATION | sed -r "s!${PATTERN}!${REPLACE}!g" - -} diff --git a/Scripts/centos-art.sh/Functions/cli_getTemporalFile.sh b/Scripts/centos-art.sh/Functions/cli_getTemporalFile.sh deleted file mode 100755 index 51ff71a..0000000 --- a/Scripts/centos-art.sh/Functions/cli_getTemporalFile.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# -# cli_getTemporalFile.sh -- This function returns absolute path to -# temporal file. Use this function whenever you need to create -# temporal files inside centos-art.sh script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getTemporalFile { - - # Check amount arguments passed to this function. - if [[ $# -ne 1 ]];then - cli_printMessage "cli_getTemporalFile: `gettext "First argument is required."`" - cli_printMessage "$(caller)" 'ToKnowMoreLine' - fi - - # Define default basename for temporal file. This is required when - # svg instances are created previous to be parsed by inkscape in - # order to be exported as png. In such cases .svg file exention is - # required in order to avoid inkscape complains. - local NAME="$1" - if [[ "$NAME" == '' ]];then - cli_printMessage "cli_getTemporalFile: `gettext "First argument cannot be empty."`" - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - else - NAME="-$(cli_getCurrentLocale)-$(cli_getRepoName "$1" 'f')" - fi - - # Define default source location where temporal files will be stored. - local TMPDIR='/tmp' - - # Define default prefix for temporal file. - local PREFIX='centos-art.sh-' - - # Define unique identifier for temporal file. - local UUID=$(cat /proc/sys/kernel/random/uuid) - - # Join default source location and filename to build final - # temporal file absolute path. - local TMPFILE=$(echo -n "${TMPDIR}/${PREFIX}${UUID}${NAME}") - - # Output absolute path to final temporal file. - echo $TMPFILE - -} diff --git a/Scripts/centos-art.sh/Functions/cli_printActionPreamble.sh b/Scripts/centos-art.sh/Functions/cli_printActionPreamble.sh deleted file mode 100755 index aade07a..0000000 --- a/Scripts/centos-art.sh/Functions/cli_printActionPreamble.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -# -# cli_printActionPreamble -- This function standardizes action -# preamble messages. Action preamble messages provides a confirmation -# message that illustrate what files will be affected in the action. -# -# Generally, actions are applied to parent directories. Each parent -# directory has parallel directories associated. If one parent -# directory is created/deleted, the parallel directories associated do -# need to be created/deleted too. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_printActionPreamble { - - local FILE='' - local COUNT=0 - local FILES="$1" - local ACTION="$2" - local FORMAT="$3" - - # Check list of files to process. If we have an empty list of - # files, inform about it and stop script execution. Otherwise - # print list of files. - if [[ "$FILES" == '' ]];then - cli_printMessage "`gettext "There is no file to process."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Verify that all function parameters are passed. If they are not, - # there is nothing else to do here. - if [[ $# -ne 3 ]];then - return - fi - - # Redefine total number of directories. - COUNT=$(echo "$FILES" | sed -r "s! +!\n!g" | wc -l) - - # Redefine preamble messages based on action. - case $ACTION in - - 'doCreate' ) - ACTION="`ngettext "The following entry will be created" \ - "The following entries will be created" $COUNT`:" - ;; - - 'doDelete' ) - ACTION="`ngettext "The following entry will be deleted" \ - "The following entries will be deleted" $COUNT`:" - ;; - - 'doLocale' ) - ACTION="`ngettext "Translatable strings will be retrived from the following entry" \ - "Translatable strings will be retrived from the following entries" $COUNT`:" - ;; - - 'doEdit' ) - ACTION="`ngettext "The following file will be edited" \ - "The following files will be edited" $COUNT`:" - ;; - - esac - - # Print preamble message. - cli_printMessage "$ACTION" - for FILE in $FILES;do - cli_printMessage "$FILE" "$FORMAT" - done - cli_printMessage "`gettext "Do you want to continue"`" 'AsYesOrNoRequestLine' - -} diff --git a/Scripts/centos-art.sh/Functions/cli_printMessage.sh b/Scripts/centos-art.sh/Functions/cli_printMessage.sh deleted file mode 100755 index 05db63a..0000000 --- a/Scripts/centos-art.sh/Functions/cli_printMessage.sh +++ /dev/null @@ -1,178 +0,0 @@ -#!/bin/bash -# -# cli_printMessage.sh -- This function outputs information in -# predifined formats to standard error. This function is the standard -# way to output information inside centos-art.sh script. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_printMessage { - - local MESSAGE="$1" - local FORMAT="$2" - - # Reduce paths inside output messages. The main purpose for this - # is to free horizontal space in output messages. - MESSAGE=$(echo "$MESSAGE" \ - | sed -r 's!/home/centos/artwork/(trunk|branches|tags)/!\1/!g') - - # Remove blank spaces from lines' begining. - MESSAGE=$(echo "$MESSAGE" | sed -r 's!^[[:space:]]+!!') - - # Define message formats. - case $FORMAT in - - 'AsUpdatingLine' ) - cli_printMessage "`gettext "Updating"`: $MESSAGE" - ;; - - 'AsDeletingLine' ) - cli_printMessage "`gettext "Deleting"`: $MESSAGE" - ;; - - 'AsCheckingLine' ) - cli_printMessage "`gettext "Checking"`: $MESSAGE" - ;; - - 'AsCreatingLine' ) - cli_printMessage "`gettext "Creating"`: $MESSAGE" - ;; - - 'AsSavedAsLine' ) - cli_printMessage "`gettext "Saved as"`: $MESSAGE" - ;; - - 'AsLinkToLine' ) - cli_printMessage "`gettext "Linked to"`: $MESSAGE" - ;; - - 'AsMovedToLine' ) - cli_printMessage "`gettext "Moved to"`: $MESSAGE" - ;; - - 'AsTranslationLine' ) - cli_printMessage "`gettext "Translation"`: $MESSAGE" - ;; - - 'AsDesignLine' ) - cli_printMessage "`gettext "Design"`: $MESSAGE" - ;; - - 'AsConfigurationLine' ) - cli_printMessage "`gettext "Configuration"`: $MESSAGE" - cli_printMessage '-' 'AsSeparatorLine' - ;; - - 'AsPaletteLine' ) - cli_printMessage "`gettext "Palette"`: $MESSAGE" - ;; - - 'AsResponseLine' ) - cli_printMessage "--> $MESSAGE" - ;; - - 'AsRequestLine' ) - cli_printMessage "${MESSAGE}: " 'AsNoTrailingNewLine' - ;; - - 'AsErrorLine' ) - # This option is used to print error messsages. - echo "${CLINAME}: ${MESSAGE}" > /dev/stderr - ;; - - 'AsToKnowMoreLine' ) - # This option receives the output of bash's caller - # built-in as message value and produces the documentation - # entry from it. - MESSAGE=$(cli_getRepoName "$(echo $MESSAGE | cut -d ' ' -f2-)" 'd') - cli_printMessage '-' 'AsSeparatorLine' - cli_printMessage "`gettext "To know more, run the following command"`:" - cli_printMessage "centos-art manual --read='$MESSAGE'" - cli_printMessage '-' 'AsSeparatorLine' - exit # <-- ATTENTION: Do not remove this line. We use this - # option as convenction to end script - # execution. - ;; - - 'AsYesOrNoRequestLine' ) - - # Define positive answer. - local Y="`gettext "yes"`" - - # Define negative answer. - local N="`gettext "no"`" - - if [[ $FLAG_ANSWER == 'false' ]];then - - # Print the question. - cli_printMessage "$MESSAGE [${Y}/${N}]: " 'AsNoTrailingNewLine' - - # Wait for user's answer to be entered. - read FLAG_ANSWER - - fi - - # Verify user's answer. Only positive answer let the - # script flow to continue. Otherwise, if something - # different from possitive answer is passed, the - # script terminates its execution immediatly. - if [[ ! ${FLAG_ANSWER} =~ "^${Y}" ]];then - exit - fi - ;; - - 'AsSeparatorLine' ) - - if [[ "$FLAG_QUIET" == 'false' ]];then - - # Define separator width. - local MAX=70 - - # Draw separator. - until [[ $MAX -eq 0 ]];do - printf "${MESSAGE}" > /dev/stderr - MAX=$(($MAX - 1)) - done - - # Output newline to end separator. - echo "" > /dev/stderr - - fi - ;; - - 'AsNoTrailingNewLine' ) - if [[ "$FLAG_QUIET" == 'false' ]];then - printf "$MESSAGE" > /dev/stderr - fi - ;; - - 'AsRegularLine' | * ) - if [[ "$FLAG_QUIET" == 'false' ]];then - echo "$MESSAGE" \ - | awk -f /home/centos/artwork/trunk/Scripts/Bash/Styles/output_forTwoColumns.awk \ - > /dev/stderr - fi - ;; - - esac - -} diff --git a/Scripts/centos-art.sh/Functions/cli_readFileContent.sh b/Scripts/centos-art.sh/Functions/cli_readFileContent.sh deleted file mode 100644 index ab4edaf..0000000 --- a/Scripts/centos-art.sh/Functions/cli_readFileContent.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# -# cli_readFileContent.sh -- This function outputs content of files, -# passed as first argument, to standard output as specified by second -# argument. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_readFileContent { - - local FILES="$1" - local PATTERN='Copyright (\(C\)|©) [0-9]+(-[0-9]+)? .+' - - # Verify existence of files but don't stop if it doesn't exist. - cli_checkFiles "$FILES" - - # Print content of files to standard output. - case "$2" in - - '--copyright-line' ) - cat "$FILES" | egrep "^ +${PATTERN}$" | head -n 1 | sed -r 's!^ +!!' - ;; - - '--last-line' ) - cat "$FILES" | tail -n 1 - ;; - - '--copyright-year' ) - if [[ $(cli_readFileContent "$FILES" '--copyright-line') =~ "^${PATTERN}$" ]];then - cli_readFileContent "$FILES" '--copyright-line' | cut -d' ' -f3 - fi - ;; - - '--copyright-holder' ) - if [[ $(cli_readFileContent "$FILES" '--copyright-line') =~ "^${PATTERN}$" ]];then - cli_readFileContent "$FILES" '--copyright-line' | cut -d' ' -f4- - fi - ;; - - '--all-lines' | * ) - cat "$FILES" - ;; - - esac - -} diff --git a/Scripts/centos-art.sh/Functions/cli_replaceTMarkers.sh b/Scripts/centos-art.sh/Functions/cli_replaceTMarkers.sh deleted file mode 100755 index 0b2da89..0000000 --- a/Scripts/centos-art.sh/Functions/cli_replaceTMarkers.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash -# -# cli_replaceTMarkers.sh -- This function standardizes -# replacements for common translation markers. Raplacements are -# applied to temporal instances used to produce the final file. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_replaceTMarkers { - - # Initialize variables. - local -a SRC - local -a DST - local COUNT=0 - local COUNTSRC=0 - local COUNTDST=0 - local LOCATION='' - - # Define source location on which sed replacements take place. - LOCATION="$1" - - # Verify file source location. - cli_checkFiles "$LOCATION" 'f' - - # Define translation markers. The translation marker definition - # order is important. Note that when we render concept directory - # structure, we make two replacements to produce the final - # copyright note. First, we replace =COPYRIGHT= translation marker - # and later the =THEMENAME= translation maker (not the oposite). - SRC[0]='=COPYRIGHT_YEAR=' - SRC[1]='=COPYRIGHT_HOLDER=' - SRC[2]='=LICENSE=' - SRC[3]='=LICENSE_URL=' - SRC[4]='=THEME=' - SRC[5]='=THEMENAME=' - SRC[6]='=THEMERELEASE=' - SRC[7]='=RELEASE=' - SRC[8]='=MAJOR_RELEASE=' - SRC[9]='=MINOR_RELEASE=' - SRC[10]='=URL=' - SRC[11]='=ARCH=' - SRC[12]='=URL_WIKI=' - SRC[13]='=URL_LISTS=' - SRC[14]='=URL_FORUMS=' - SRC[15]='=URL_MIRRORS=' - SRC[16]='=URL_DOCS=' - SRC[17]='=MAIL_DOCS=' - SRC[18]='=LOCALE_LL=' - - # Define replacements for translation markers. - DST[0]="$(cli_getCopyrightInfo '--copyright-year')" - DST[1]="$(cli_getCopyrightInfo '--copyright-holder')" - DST[2]="$(cli_getCopyrightInfo '--license')" - DST[3]="$(cli_getCopyrightInfo '--license-url')" - DST[4]="$(cli_getPathComponent "$OUTPUT" '--theme')" - DST[5]="$(cli_getPathComponent "$OUTPUT" '--theme-name')" - DST[6]="$(cli_getPathComponent "$OUTPUT" '--theme-release')" - DST[7]="$(cli_getPathComponent "$FLAG_RELEASE" '--release')" - DST[8]="$(cli_getPathComponent "$FLAG_RELEASE" '--release-major')" - DST[9]="$(cli_getPathComponent "$FLAG_RELEASE" '--release-minor')" - DST[10]="http://=LOCALE_LL=.centos.org/" - DST[11]="$(cli_getPathComponent "$FLAG_ARCHITECTURE" '--architecture')" - DST[12]="=URL=wiki/" - DST[13]="=URL=lists/" - DST[14]="=URL=forums/" - DST[15]="=URL=mirrors/" - DST[16]="=URL=docs/" - DST[17]="centos-docs@$(cli_getCurrentLocale '--langcode-only').centos.org" - DST[18]="$(cli_getCurrentLocale '--langcode-only')" - - # Do replacement of nested translation markers. - while [[ $COUNTDST -lt ${#DST[@]} ]];do - - # Verify existence of translation markers. If there is no - # translation marker on replacement, continue with the next - # one in the list. - if [[ ! ${DST[$COUNTDST]} =~ '=[A-Z_]+=' ]];then - # Increment destination counter. - COUNTDST=$(($COUNTDST + 1)) - # The current replacement value doesn't have translation - # marker inside, so skip it and evaluate the next - # replacement value in the list. - continue - fi - - while [[ $COUNTSRC -lt ${#SRC[*]} ]];do - - # Update replacements. - DST[$COUNTDST]=$(echo ${DST[$COUNTDST]} \ - | sed -r "s!${SRC[$COUNTSRC]}!${DST[$COUNTSRC]}!g") - - # Increment source counter. - COUNTSRC=$(($COUNTSRC + 1)) - - done - - # Reset source counter - COUNTSRC=0 - - # Increment destination counter. - COUNTDST=$(($COUNTDST + 1)) - - done - - # Apply replacements for translation markers. - while [[ ${COUNT} -lt ${#SRC[*]} ]];do - - # Use sed to replace translation markers inside the design - # model instance. - sed -r -i "s!${SRC[$COUNT]}!${DST[$COUNT]}!g" ${LOCATION} - - # Increment counter. - COUNT=$(($COUNT + 1)) - - done - - # Unset specific translation markers and specific replacement - # variables in order to clean them up. Otherwise, undesired values - # may ramain from one file to another. - unset SRC - unset DST - -} diff --git a/Scripts/centos-art.sh/Styles/output_forTwoColumns.awk b/Scripts/centos-art.sh/Styles/output_forTwoColumns.awk deleted file mode 100644 index 208e3dc..0000000 --- a/Scripts/centos-art.sh/Styles/output_forTwoColumns.awk +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/gawk -# -# output_forRendering.awk -- This file provides the output format for -# all rendering actions inside centos-art.sh script. -# -# Copyright (C) 2009-2010 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -BEGIN { FS=": " } - -{ - if ( $0 ~ /^-+$/ ) - print $0 - else - printf "%-15s\t%s\n", $1, $2 - -} - -END {} diff --git a/Scripts/centos-art.sh/Styles/renameFile.sh b/Scripts/centos-art.sh/Styles/renameFile.sh deleted file mode 100755 index 91d0dfe..0000000 --- a/Scripts/centos-art.sh/Styles/renameFile.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# renameFiles.sh -- Rename files names, inside svn repository, -# massively. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id: renameFile.sh 12 2010-09-10 09:55:08Z al $ -# ---------------------------------------------------------------------- - - -if [ ! $# = 4 ];then - cli_printMessage "`gettext "Syntax: ./update-filenames.sh "`" - exit; -fi - -ROOTDIR="$1" -FILTER="$2" -PATTERN="$3" -VALUE="$4" - -for FILE in `find $ROOTDIR -regex $FILTER`;do - DIR=`dirname $FILE` - FILE=`basename $FILE` - svn mv $DIR/$FILE $DIR/`echo $FILE | sed -r "s!$PATTERN!$VALUE!"` -done diff --git a/Scripts/centos-art.sh/init.sh b/Scripts/centos-art.sh/init.sh deleted file mode 100755 index 22ce82f..0000000 --- a/Scripts/centos-art.sh/init.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# -# centos-art.sh -- The CentOS Artwork Repository automation tool -# initialization script. -# -# This is the first script that centos-art command initiates. This -# script contains a serie of desition about which configuration script -# to load based. To determine which configuration script to load, the -# absolute path from which the command centos-art was initially called -# is used as reference. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id: centos-art.sh 70 2010-09-18 04:38:43Z al $ -# ---------------------------------------------------------------------- - -# Initizalize centos-art.sh gettext internazionalization. -. gettext.sh -export TEXTDOMAIN=centos-art.sh -export TEXTDOMAINDIR=/home/centos/artwork/trunk/Locales/Scripts/centos-art.sh/ - -# Initialize centos-art.sh personal information. -export CLINAME='centos-art' -export CLIVERSION='1.0 (beta)' - -# Initialize centos-art.sh function scripts. -FILES=$(ls /home/centos/artwork/trunk/Scripts/Bash/Functions/{cli,cli_*}.sh) -for FILE in $FILES;do - if [[ -x $FILE ]];then - . $FILE - FUNCTION=$(grep '^function ' $FILE | cut -d' ' -f2) - export -f $FUNCTION - else - echo `gettext "The $FILE needs to have execution rights."` - exit - fi -done - -# Unset all variables not considered global in order to start cli -# execution with a clean environment. -unset FILE -unset FILES -unset FUNCTION - -# Initialize command line interface. -cli "$@"