diff --git a/Documentation/Manpages/Locales/en_US/prepare.po b/Documentation/Manpages/Locales/en_US/prepare.po new file mode 100644 index 0000000..8472ab2 --- /dev/null +++ b/Documentation/Manpages/Locales/en_US/prepare.po @@ -0,0 +1,331 @@ +msgid "" +msgstr "" +"Project-Id-Version: prepare.asciidoc 0.6\n" +"POT-Creation-Date: 2013-11-07 14:49-0500\n" +"PO-Revision-Date: 2013-11-07 14:49-0500\n" +"Last-Translator: Localization SIG \n" +"Language-Team: English\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "prepare" +msgstr "prepare" + +msgid "1" +msgstr "1" + +msgid "Prepare your workstation for using the repository." +msgstr "Prepare your workstation for using the repository." + +msgid "centos-art.sh prepare [OPTIONS]" +msgstr "centos-art.sh prepare [OPTIONS]" + +msgid "Description" +msgstr "Description" + +msgid "" +"The first time you download the CentOS artwork repository into your " +"workstation, you only find source files inside the repository. In " +"order to produce each component of CentOS corporate visual " +"identity, it is necessary that you first transform the source files " +"(e.g., .svgz, .asciidoc, " +".po) into final files (e.g., .png, .html, .mo). This " +"process is known as preparing your workstation to use the " +"repository and is standardized through the prepare module. This way, the prepare module is the first command you " +"execute after downloading a fresh copy of CentOS artwork repository." +msgstr "" +"The first time you download the CentOS artwork repository into your " +"workstation, you only find source files inside the repository. In " +"order to produce each component of CentOS corporate visual " +"identity, it is necessary that you first transform the source files " +"(e.g., .svgz, .asciidoc, " +".po) into final files (e.g., .png, .html, .mo). This " +"process is known as preparing your workstation to use the " +"repository and is standardized through the prepare module. This way, the prepare module is the first command you " +"execute after downloading a fresh copy of CentOS artwork repository." + +msgid "" +"When you execute the prepare " +"module without any option, it first checks existence of required " +"packages (see --packages), then updates the locale information " +"required by centos-art.sh " +"script to show messages in your current locale, later renders " +"documentation (see --documents) and images (see --images) using " +"source files available inside the repository. Finally, it updates " +"the link relation that connects content inside the repository and " +"the applications outside it (see --links)." +msgstr "" +"When you execute the prepare " +"module without any option, it first checks existence of required " +"packages (see --packages), then updates the locale information " +"required by centos-art.sh " +"script to show messages in your current locale, later renders " +"documentation (see --documents) and images (see --images) using " +"source files available inside the repository. Finally, it updates " +"the link relation that connects content inside the repository and " +"the applications outside it (see --links)." + +msgid "" +"When you execute the prepare " +"module with options, the order in which preparation actions take " +"place is set by the order in which you passed the options. See " +", for more information about available " +"options and what they do." +msgstr "" +"When you execute the prepare " +"module with options, the order in which preparation actions take " +"place is set by the order in which you passed the options. See " +", for more information about available " +"options and what they do." + +msgid "" +"Once the prepare module " +"completes its execution, both your workstation and your copy of " +"CentOS artwork repository will be ready for production." +msgstr "" +"Once the prepare module " +"completes its execution, both your workstation and your copy of " +"CentOS artwork repository will be ready for production." + +msgid "Options" +msgstr "Options" + +msgid "" +"The prepare module accepts the " +"following options:" +msgstr "" +"The prepare module accepts the " +"following options:" + +msgid "--help" +msgstr "--help" + +msgid "Print module's documentation." +msgstr "Print module's documentation." + +msgid "--version" +msgstr "--version" + +msgid "Print module's version." +msgstr "Print module's version." + +msgid "--packages" +msgstr "--packages" + +msgid "" +"This option verifies whether you have installed the required " +"packages in your workstation or not. If they are not installed an " +"error will be printed telling you what the missing package is, so " +"you can install it. It is important that all the required packages " +"be installed for centos-art.sh " +"script modules to work as expected." +msgstr "" +"This option verifies whether you have installed the required " +"packages in your workstation or not. If they are not installed an " +"error will be printed telling you what the missing package is, so " +"you can install it. It is important that all the required packages " +"be installed for centos-art.sh " +"script modules to work as expected." + +msgid "" +"When you are verifying packages, be aware that it is required that " +"you have installed EPEL repository. The EPEL configuration package " +"(epel-release) isn't part of " +"CentOS distribution and you need to download it and install it " +"manually. The epel-release " +"package can be found in either of the locations (based on your " +"system version):" +msgstr "" +"When you are verifying packages, be aware that it is required that " +"you have installed EPEL repository. The EPEL configuration package " +"(epel-release) isn't part of " +"CentOS distribution and you need to download it and install it " +"manually. The epel-release " +"package can be found in either of the locations (based on your " +"system version):" + +msgid "" +"For CentOS-5: http://download.fedoraproject.org/pub/epel/5/i386/" +msgstr "" +"For CentOS-5: http://download.fedoraproject.org/pub/epel/5/i386/" + +msgid "" +"For CentOS-6: http://download.fedoraproject.org/pub/epel/6/i386/" +msgstr "" +"For CentOS-6: http://download.fedoraproject.org/pub/epel/6/i386/" + +msgid "--locales" +msgstr "--locales" + +msgid "" +"This option looks for all translatable strings inside the centos-art.sh script, updates the " +"related POT and PO files and produces the related MO file using the " +"specific locale environment information the script was run in. If " +"the PO file already have translations, they are preserved and used " +"to build the MO file." +msgstr "" +"This option looks for all translatable strings inside the centos-art.sh script, updates the " +"related POT and PO files and produces the related MO file using the " +"specific locale environment information the script was run in. If " +"the PO file already have translations, they are preserved and used " +"to build the MO file." + +msgid "--links" +msgstr "--links" + +msgid "" +"This updates the link information that connects the information " +"inside the repository with the information outside the repository. " +"For example, inside the repository we have the font information " +"required to build messages in specific typography, such information " +"isn't by default in the default system locations so we install them " +"in the home directory of the user running the prepare module, using symbolic links." +msgstr "" +"This updates the link information that connects the information " +"inside the repository with the information outside the repository. " +"For example, inside the repository we have the font information " +"required to build messages in specific typography, such information " +"isn't by default in the default system locations so we install them " +"in the home directory of the user running the prepare module, using symbolic links." + +msgid "" +"Whenever you need to update this information, use this option. Take " +"care that all links previously created in the target location will " +"be removed and recreated again. So, you can change the name " +"relation in the configuration files and install the changes without " +"leaving broken links in the target location." +msgstr "" +"Whenever you need to update this information, use this option. Take " +"care that all links previously created in the target location will " +"be removed and recreated again. So, you can change the name " +"relation in the configuration files and install the changes without " +"leaving broken links in the target location." + +msgid "" +"The file that controls the link configuration is inside the " +"repository at Automation/Modules/Prepare/Modules/Links/" +"Configs/render.conf." +msgstr "" +"The file that controls the link configuration is inside the " +"repository at Automation/Modules/Prepare/Modules/Links/" +"Configs/render.conf." + +msgid "--images" +msgstr "--images" + +msgid "" +"This option produces images from source files available inside the " +"repository, using the correct order. When you use this option, " +"centos-art.sh script calls the render module internally which " +"produces content for all configuration (render.conf) files found inside the repository." +msgstr "" +"This option produces images from source files available inside the " +"repository, using the correct order. When you use this option, " +"centos-art.sh script calls the render module internally which " +"produces content for all configuration (render.conf) files found inside the repository." + +msgid "--documents" +msgstr "--documents" + +msgid "" +"This options produces documentation from source files available " +"inside the repository. When you pass this option, the current " +"locale information is considered to produce the documentation. If " +"the current locale doesn't have translation files set for the " +"current locale information, English language is used as default " +"language." +msgstr "" +"This options produces documentation from source files available " +"inside the repository. When you pass this option, the current " +"locale information is considered to produce the documentation. If " +"the current locale doesn't have translation files set for the " +"current locale information, English language is used as default " +"language." + +msgid "Author" +msgstr "Author" + +msgid "" +"The prepare module has " +"received contributions from the following people:" +msgstr "" +"The prepare module has " +"received contributions from the following people:" + +msgid "" +"Alain Reguera Delgado <al@centos.org.cu>, 2009-2013" +msgstr "" +"Alain Reguera Delgado <al@centos.org.cu>, 2009-2013" + +msgid "Copyright" +msgstr "Copyright" + +msgid "Copyright © 2009-2013 The CentOS Project" +msgstr "Copyright © 2009-2013 The CentOS Project" + +msgid "" +"This program is free software; you can redistribute it and/or " +"modify it under the terms of the GNU General Public License as " +"published by the Free Software Foundation; either version 2 of the " +"License, or (at your option) any later version." +msgstr "" +"This program is free software; you can redistribute it and/or " +"modify it under the terms of the GNU General Public License as " +"published by the Free Software Foundation; either version 2 of the " +"License, or (at your option) any later version." + +msgid "" +"This program is distributed in the hope that it will be useful, but " +"WITHOUT ANY WARRANTY; without even the implied warranty of " +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU " +"General Public License for more details." +msgstr "" +"This program is distributed in the hope that it will be useful, but " +"WITHOUT ANY WARRANTY; without even the implied warranty of " +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU " +"General Public License for more details." + +msgid "" +"You should have received a copy of the GNU General Public License " +"along with this program; if not, write to the Free Software " +"Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." +msgstr "" +"You should have received a copy of the GNU General Public License " +"along with this program; if not, write to the Free Software " +"Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." + +msgid "See Also" +msgstr "See Also" + +msgid "" +"centos-art.sh(1), centos-art.sh-render(1), centos-art.sh-locale(1)" +msgstr "" +"centos-art.sh(1), centos-art.sh-render(1), centos-art.sh-locale(1)" + +#. Put one translator per line, in the form of NAME , YEAR1, YEAR2. +msgid "translator-credits" +msgstr "translator-credits" diff --git a/Documentation/Manpages/prepare.asciidoc b/Documentation/Manpages/prepare.asciidoc new file mode 100644 index 0000000..c0d014e --- /dev/null +++ b/Documentation/Manpages/prepare.asciidoc @@ -0,0 +1,149 @@ +prepare(1) +========== + +Name +---- + +prepare - Prepare your workstation for using the repository. + +Synopsis +-------- + +*centos-art.sh prepare [OPTIONS]* + +Description +----------- + +The first time you download the CentOS artwork repository into your +workstation, you only find source files inside the repository. In +order to produce each component of CentOS corporate visual identity, +it is necessary that you first transform the source files (e.g., ++.svgz+, +.asciidoc+, +.po+) into final files (e.g., +.png+, +.html+, ++.mo+). This process is known as _preparing your workstation to use +the repository_ and is standardized through the *prepare* module. This +way, the *prepare* module is the first command you execute after +downloading a fresh copy of CentOS artwork repository. + +When you execute the *prepare* module without any option, it first +checks existence of required packages (see --packages), then updates +the locale information required by *centos-art.sh* script to show +messages in your current locale, later renders documentation (see +--documents) and images (see --images) using source files available +inside the repository. Finally, it updates the link relation that +connects content inside the repository and the applications outside it +(see --links). + +When you execute the *prepare* module with options, the order in which +preparation actions take place is set by the order in which you passed +the options. See <>, for more information about available +options and what they do. + +Once the *prepare* module completes its execution, both your +workstation and your copy of CentOS artwork repository will be ready +for production. + +[[options]] +Options +------- + +The *prepare* module accepts the following options: + +*--help*:: + Print module's documentation. + +*--version*:: + Print module's version. + +*--packages*:: + This option verifies whether you have installed the required + packages in your workstation or not. If they are not installed an + error will be printed telling you what the missing package is, so + you can install it. It is important that all the required packages + be installed for *centos-art.sh* script modules to work as + expected. ++ +[NOTE] +====================================================================== +When you are verifying packages, be aware that it is required that you +have installed EPEL repository. The EPEL configuration package +(*epel-release*) isn't part of CentOS distribution and you need to +download it and install it manually. The *epel-release* package can be +found in either of the locations (based on your system version): + + * For CentOS-5: http://download.fedoraproject.org/pub/epel/5/i386/[http://download.fedoraproject.org/pub/epel/5/i386/] + * For CentOS-6: http://download.fedoraproject.org/pub/epel/6/i386/[http://download.fedoraproject.org/pub/epel/6/i386/] +====================================================================== + +*--locales*:: + This option looks for all translatable strings inside the + *centos-art.sh* script, updates the related POT and PO files and + produces the related MO file using the specific locale environment + information the script was run in. If the PO file already have + translations, they are preserved and used to build the MO file. + +*--links*:: + This updates the link information that connects the information + inside the repository with the information outside the repository. + For example, inside the repository we have the font information + required to build messages in specific typography, such + information isn't by default in the default system locations so we + install them in the home directory of the user running the + *prepare* module, using symbolic links. ++ +Whenever you need to update this information, use this option. Take +care that all links previously created in the target location will be +removed and recreated again. So, you can change the name relation in +the configuration files and install the changes without leaving broken +links in the target location. ++ +The file that controls the link configuration is inside the repository +at +Automation/Modules/Prepare/Modules/Links/Configs/render.conf+. + +*--images*:: + This option produces images from source files available inside the + repository, using the correct order. When you use this option, + centos-art.sh script calls the render module internally which + produces content for all configuration (+render.conf+) files found + inside the repository. + +*--documents*:: + This options produces documentation from source files available + inside the repository. When you pass this option, the current + locale information is considered to produce the documentation. If + the current locale doesn't have translation files set for the + current locale information, English language is used as default + language. + +Author +------ + +The *prepare* module has received contributions from the following +people: + + * Alain Reguera Delgado , 2009-2013 + +Copyright +--------- + +Copyright (C) 2009-2013 The CentOS Project + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +See Also +-------- + +centos-art.sh(1), centos-art.sh-render(1), centos-art.sh-locale(1) + +// vim: set syntax=asciidoc: diff --git a/Documentation/Manpages/render.conf b/Documentation/Manpages/render.conf index a297878..34f73b8 100644 --- a/Documentation/Manpages/render.conf +++ b/Documentation/Manpages/render.conf @@ -76,3 +76,10 @@ render-from = "hello.asciidoc" locale-from = "Locales/${TCAR_SCRIPT_LANG_LC}/hello.asciidoc.po" formats = "xhtml manpage" mansect = "1" +[prepare] +render-type = "asciidoc" +render-flow = "manpage" +render-from = "prepare.asciidoc" +locale-from = "Locales/${TCAR_SCRIPT_LANG_LC}/prepare.po" +formats = "xhtml manpage" +mansect = "1" diff --git a/Scripts/Modules/Prepare/Locales/es_ES/prepare.sh.po b/Scripts/Modules/Prepare/Locales/es_ES/prepare.sh.po new file mode 100644 index 0000000..0bf026e --- /dev/null +++ b/Scripts/Modules/Prepare/Locales/es_ES/prepare.sh.po @@ -0,0 +1,28 @@ +msgid "" +msgstr "" +"Project-Id-Version: prepare.sh 0.6\n" +"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" +"POT-Creation-Date: 2013-10-28 16:31-0400\n" +"PO-Revision-Date: 2013-10-28 16:31-0400\n" +"Last-Translator: Localization SIG \n" +"Language-Team: Spanish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: Automation/Modules/Prepare/Modules/Packages/packages.sh:54 +msgid "All required packages are installed already." +msgstr "Todos los paquetes requeridos ya est\'an instalados." + +#: Automation/Modules/Prepare/prepare_setRenderEnvironment.sh:55 +msgid "The option name cannot be empty." +msgstr "El nombre de la opción no puede estar vacío." + +#: Automation/Modules/Prepare/prepare_setRenderEnvironment.sh:64 +msgid "The option value cannot be empty." +msgstr "El valor de la opción no puede estar vacío." + +#: Automation/Modules/Prepare/prepare_setRenderEnvironment.sh:80 +msgid "The search path cannot be empty." +msgstr "El camino de búsqueda no puede estar vacío." diff --git a/Scripts/Modules/Prepare/Modules/Conf/Configs/asciidoc.render.conf.tpl b/Scripts/Modules/Prepare/Modules/Conf/Configs/asciidoc.render.conf.tpl new file mode 100644 index 0000000..3883162 --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Conf/Configs/asciidoc.render.conf.tpl @@ -0,0 +1,10 @@ +[=SECTION=.html] +render-type = "asciidoc" +render-flow = "article" +render-from = "=SECTION=.asciidoc" +locale-from = "Locales/${TCAR_SCRIPT_LANG_LC}/=SECTION=.asciidoc.po" +images-from = "${TCAR_BASEDIR}/Artworks/Icons/Webenv" +styles-from = "${TCAR_BASEDIR}/Artworks/Webenv/Docbook/1.69.1/Css" +formats = "xhtml" +render-page = "single chunks" + diff --git a/Scripts/Modules/Prepare/Modules/Conf/Configs/svg.render.conf.tpl b/Scripts/Modules/Prepare/Modules/Conf/Configs/svg.render.conf.tpl new file mode 100644 index 0000000..10d323d --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Conf/Configs/svg.render.conf.tpl @@ -0,0 +1,6 @@ +[=SECTION=.png] +render-type = "svg" +render-flow = "base" +render-from = "=SECTION=.svg" +locale-from = "Locales/${TCAR_SCRIPT_LANG_LC}/=SECTION=.svg.po" + diff --git a/Scripts/Modules/Prepare/Modules/Conf/Configs/svgz.render.conf.tpl b/Scripts/Modules/Prepare/Modules/Conf/Configs/svgz.render.conf.tpl new file mode 100644 index 0000000..6e45b4e --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Conf/Configs/svgz.render.conf.tpl @@ -0,0 +1,6 @@ +[=SECTION=.png] +render-type = "svg" +render-flow = "base" +render-from = "=SECTION=.svgz" +locale-from = "Locales/${TCAR_SCRIPT_LANG_LC}/=SECTION=.svgz.po" + diff --git a/Scripts/Modules/Prepare/Modules/Conf/conf.sh b/Scripts/Modules/Prepare/Modules/Conf/conf.sh new file mode 100755 index 0000000..4000d9f --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Conf/conf.sh @@ -0,0 +1,81 @@ +#!/bin/bash +###################################################################### +# +# conf.sh -- This module prepares configuration files used by both +# render and locale modules. +# +# To build the configuration file, this module creates a list of +# files to process based on the arguments provided in the +# command-line line. With this list, then, it creates the +# configuration file using configuration templates for each file +# extension supported inside the repository. +# +# The configuration file this module creates doesn't include options +# like brand which require information about the image you are about +# to produce. The intention of this module is create the +# configuration files you need to produce content right away in the +# simplest way possible and then letting you improve it as needed. +# +# The name and location of the final configuration file is that +# passed as argument to prepare module in the command-line. +# +# Written by: +# * Alain Reguera Delgado , 2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function conf { + + # Verify that a configuration file was provided as argument. + if [[ $# -eq 0 ]];then + tcar_printMessage "`gettext "The configuration file wasn't provided."`" --as-error-line + fi + + # Define configuration file. + local CONF_FILE=$(tcar_checkRepoDirSource "${1}") + tcar_checkFiles -m "\.conf$" ${CONF_FILE} + + # Define parent directory of configuration file. + local CONF_DIR=$(dirname ${CONF_FILE}) + tcar_checkFiles -ed "${CONF_DIR}" + + # Build the list of files to process. This is all the source files + # we want to produce th configuration file for. + local SOURCE_FILES=$(tcar_getFilesList ${CONF_DIR} \ + --mindepth=1 --maxdepth=1 --type=f \ + --pattern='.+\.(svgz|svg|asciidoc)$') + + # Verify the list of files to process. + tcar_checkFiles -ef ${SOURCE_FILES} + + # Print action message. + tcar_printMessage "${CONF_FILE}" --as-creating-line + + # Process list of files. + for SOURCE_FILE in ${SOURCE_FILES};do + + local CONF_FILE_NAME=$(tcar_getFileName "${SOURCE_FILE}") + local CONF_FILE_EXTENSION=$(tcar_getFileExtension "${SOURCE_FILE}") + local CONF_FILE_TEMPLATE=${TCAR_MODULE_DIR_CONFIGS}/${CONF_FILE_EXTENSION}.render.conf.tpl + + sed -r "s/=SECTION=/${CONF_FILE_NAME}/g" ${CONF_FILE_TEMPLATE} >> ${CONF_FILE} + + done + +} diff --git a/Scripts/Modules/Prepare/Modules/Documents/documents.sh b/Scripts/Modules/Prepare/Modules/Documents/documents.sh new file mode 100755 index 0000000..8f13836 --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Documents/documents.sh @@ -0,0 +1,46 @@ +#!/bin/bash +###################################################################### +# +# documents.sh -- This function renders all documentation files +# inside the repository using the render module. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function documents { + + # Define base location where configuration files will be searched + # from. You can provide more than one location here. + local DIRS='/' + + # Define the name of the option you want to look configuration + # files for. + local NAME='render-type' + + # Define the value of the option you want to look configuration + # files for. + local VALUE='asciidoc' + + # Render configuration files that match specified options and + # values in the search directories. + prepare_setRenderEnvironment -o "${NAME}" -v "${VALUE}" "${DIRS}" + +} diff --git a/Scripts/Modules/Prepare/Modules/Images/images.sh b/Scripts/Modules/Prepare/Modules/Images/images.sh new file mode 100755 index 0000000..5916d70 --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Images/images.sh @@ -0,0 +1,58 @@ +#!/bin/bash +###################################################################### +# +# images.sh -- This function renders all configuration images files +# inside the repository, using the render module and the correct +# production order. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function images { + + # CAUTION: The order in which repository components are processed + # affect the final result. For instance, in order for theme images + # to hold the CentOS branding information the `Artworks/Brands' + # directory must be rendered before the `Artworks/Themes' + # directory. The reason of this is that brand images are not + # drawn inside theme design models but combined with them using + # ImageMagick, once they both have been rendered as PNG files. + + # Define base location where configuration files will be searched + # from. You can provide more than one location here. + local DIRS="\ + Artworks/Brands\ + Artworks/Documentation\ + Artworks/Themes" + + # Define the name of the option you want to look configuration + # files for. + local NAME='render-type' + + # Define the value of the option you want to look configuration + # files for. + local VALUE='svg' + + # Render configuration files that match specified options and + # values in the search directories. + prepare_setRenderEnvironment -o "${NAME}" -v "${VALUE}" "${DIRS}" + +} diff --git a/Scripts/Modules/Prepare/Modules/Links/Configs/render.conf b/Scripts/Modules/Prepare/Modules/Links/Configs/render.conf new file mode 100755 index 0000000..6982fd7 --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Links/Configs/render.conf @@ -0,0 +1,26 @@ +# Install centos-art command. +[centos-art] +render-type = "symlink" +render-from = "${TCAR_BASEDIR}/Automation/centos-art.sh" +link-target = "${HOME}/bin" + +# Install vim's settings used as convention to edit files inside the +# repository. In case the conventions change, and link-target is +# updated inside the repository, the new conventions will be available +# to you immediately after fetching changes from central repository. +[.vimrc] +render-type = "symlink" +render-from = "${TCAR_BASEDIR}/Automation/Modules/Prepare/Modules/Links/Configs/vimrc" +link-target = "${HOME}" + +# Install corporate typography. +[denmark.ttf] +render-type = "symlink" +render-from = "${TCAR_BASEDIR}/Artworks/Fonts/denmark.ttf" +link-target = "${HOME}/.fonts" + +# Install corporate palette of colors (for inkscape). +[corporate.gpl] +render-type = "symlink" +render-from = "${TCAR_BASEDIR}/Artworks/Palettes/corporate.gpl" +link-target = "${HOME}/.inkscape/palettes" diff --git a/Scripts/Modules/Prepare/Modules/Links/Configs/vimrc b/Scripts/Modules/Prepare/Modules/Links/Configs/vimrc new file mode 100755 index 0000000..5737ebd --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Links/Configs/vimrc @@ -0,0 +1,8 @@ +set nu +set textwidth=70 +set autoindent +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab +set tags=./tags,tags diff --git a/Scripts/Modules/Prepare/Modules/Links/links.sh b/Scripts/Modules/Prepare/Modules/Links/links.sh new file mode 100755 index 0000000..d33b94a --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Links/links.sh @@ -0,0 +1,50 @@ +#!/bin/bash +###################################################################### +# +# links.sh -- This function renders configuration files inside +# automation scripts directory structure, using the render module. +# These configuration files are mainly used to connect content +# inside the repository with applications outside the repository, +# using symbolic links. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function links { + + # Define base location where configuration files will be searched + # from. You can provide more than one location here. + local DIRS="/" + + # Define the name of the option you want to look configuration + # files for. + local NAME='render-type' + + # Define the value of the option you want to look configuration + # files for. + local VALUE='symlink' + + # Render configuration files that match specified options and + # values in the search directories. + prepare_setRenderEnvironment -o "${NAME}" -v "${VALUE}" "${DIRS}" + +} + diff --git a/Scripts/Modules/Prepare/Modules/Locales/locales.sh b/Scripts/Modules/Prepare/Modules/Locales/locales.sh new file mode 100755 index 0000000..b733cb1 --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Locales/locales.sh @@ -0,0 +1,33 @@ +#!/bin/bash +###################################################################### +# +# locales.sh -- This module retrieves translatable strings from +# automation scripts and creates the related machine objects, so +# script messages can be rendered in different languages. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function locales { + + tcar_setModuleEnvironment locale "Automation/centos-art.sh" --update + +} diff --git a/Scripts/Modules/Prepare/Modules/Packages/packages.sh b/Scripts/Modules/Prepare/Modules/Packages/packages.sh new file mode 100755 index 0000000..17c0695 --- /dev/null +++ b/Scripts/Modules/Prepare/Modules/Packages/packages.sh @@ -0,0 +1,56 @@ +#!/bin/bash +###################################################################### +# +# packages.sh -- This function defines and verifies packages +# required by centos-art.sh script. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function packages { + + # Define required packages used by centos-art.sh script inside + # CentOS base repository. + local BASE_PACKAGES="ImageMagick netpbm netpbm-progs syslinux-perl + gimp coreutils texinfo texinfo-tex info tetex-latex + tetex-fonts tetex-xdvi tetex-dvips gettext texi2html libxml2 + gnome-doc-utils elinks docbook-style-xsl docbook-utils + docbook-dtds docbook-style-dsssl docbook-simple + docbook-utils-pdf docbook-slides firefox sudo yum rpm ctags + vim-enhanced" + + # Define required packages used by centos-art.sh script inside + # EPEL repository. Start verifying the package that contains + # repository configuration, then everything else. + local EPEL_PACKAGES="epel-release inkscape asciidoc" + + # Verify required packages. The order in which packages are + # verified my help to reduce some loops (e.g., verify packages + # containing the repository's configuration files first and + # packages from that repository later. It is rather possible that + # you won't be able to install any package from a repository you + # don't have configuration files for, in first place). + tcar_checkFiles -n ${BASE_PACKAGES} ${EPEL_PACKAGES} + + # Print a confirmation message here. + tcar_printMessage "`gettext "All required packages are installed already."`" --as-stdout-line + +} diff --git a/Scripts/Modules/Prepare/prepare.sh b/Scripts/Modules/Prepare/prepare.sh new file mode 100755 index 0000000..8a9f95c --- /dev/null +++ b/Scripts/Modules/Prepare/prepare.sh @@ -0,0 +1,52 @@ +#!/bin/bash +###################################################################### +# +# prepare.sh -- This module standardizes repository configuration +# tasks. +# +# When you download a fresh working copy of CentOS artwork +# repository, most of its content is in source format. You need to +# process source formats in order to produce final content and make +# the connections between components (e.g., render brand images so +# they can be applied to other images). This function takes care of +# those actions and should be the first module you run in your +# workstation after downloading a fresh working copy of CentOS +# artwork repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare { + + local ACTION='' + local ACTIONS='' + + prepare_getOptions + + if [[ -z ${ACTIONS} ]];then + ACTIONS='packages locales images docs links' + fi + + for ACTION in ${ACTIONS};do + tcar_setModuleEnvironment -m "${ACTION}" -t "child" ${TCAR_MODULE_ARGUMENT} + done + +} diff --git a/Scripts/Modules/Prepare/prepare_getOptions.sh b/Scripts/Modules/Prepare/prepare_getOptions.sh new file mode 100755 index 0000000..80b35e3 --- /dev/null +++ b/Scripts/Modules/Prepare/prepare_getOptions.sh @@ -0,0 +1,99 @@ +#!/bin/bash +###################################################################### +# +# prepare_getOptions.sh -- This function parses options passed to +# `centos-art.sh' script command-line, when the first argument is +# the `prepare' word. To parse options, this function makes use of +# getopt program. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare_getOptions { + + # Define short options we want to support. + local ARGSS="h::,v" + + # Define long options we want to support. + local ARGSL="help::,version,packages,locales,links,documents,images,conf" + + # Redefine arguments using getopt(1) command parser. + tcar_setModuleArguments + + # Reset positional parameters on this function, using output + # produced from (getopt) arguments parser. + eval set -- "${TCAR_MODULE_ARGUMENT}" + + # Look for options passed through command-line. + while true; do + case "${1}" in + + -h | --help ) + tcar_printHelp "${2}" + ;; + + -v | --version ) + tcar_printVersion "${TCAR_MODULE_NAME}" + ;; + + --packages ) + ACTIONS="${ACTIONS} packages" + shift 1 + ;; + + --locales ) + ACTIONS="${ACTIONS} locales" + shift 1 + ;; + + --links ) + ACTIONS="${ACTIONS} links" + shift 1 + ;; + + --documents ) + ACTIONS="${ACTIONS} documents" + shift 1 + ;; + + --images ) + ACTIONS="${ACTIONS} images" + shift 1 + ;; + + --conf ) + ACTIONS="${ACTIONS} conf" + shift 1 + ;; + + -- ) + shift 1 + break + ;; + + esac + done + + # Redefine arguments using current positional parameters. Only + # paths should remain as arguments, at this point. + TCAR_MODULE_ARGUMENT="${@}" + +} diff --git a/Scripts/Modules/Prepare/prepare_setRenderEnvironment.sh b/Scripts/Modules/Prepare/prepare_setRenderEnvironment.sh new file mode 100755 index 0000000..dc8d91e --- /dev/null +++ b/Scripts/Modules/Prepare/prepare_setRenderEnvironment.sh @@ -0,0 +1,113 @@ +#!/bin/bash +###################################################################### +# +# prepare_setRenderEnvironment.sh -- This function provides a secure +# interface to render content outside the render module. You can use +# this function to call the render module from other modules, +# safely. +# +# This function builds a list of all available configuration files +# in locations passed as argument and reduces the list by applying +# regular expression patterns to each file in the list. Only files +# that match the regular expression pattern will remain in the final +# list. The regular expression patterns are applied to file's +# content, generally to find out if it has an specific option, value +# or combination of both inside. Later, the resultant list of +# configuration files is passed to render module for processing. +# +# This function verifies the search path provided to render module +# to grant it is inside the repository before passing it to render +# module for processing. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare_setRenderEnvironment { + + OPTIND=1 + while getopts "o:,v:" OPTION "${@}"; do + + case "${OPTION}" in + + o ) + # Define the name of the option you want to look + # configuration files for. + local OPTION_NAME=${OPTARG} + if [[ -z ${OPTION_NAME} ]];then + tcar_printMessage "`gettext "The option name cannot be empty."`" --as-error-line + fi + ;; + + v ) + # Define the value of the option you want to look + # configuration files for. + local OPTION_VALUE=${OPTARG} + if [[ -z ${OPTION_VALUE} ]];then + tcar_printMessage "`gettext "The option value cannot be empty."`" --as-error-line + fi + ;; + + esac + + done + + # Clean up positional parameters to reflect the fact that options + # have been processed already. + shift $(( ${OPTIND} - 1 )) + + # Now that option arguments have been removed from positional + # parameter, verify all other remaining arguments (the search + # paths) do exist. They are required to search. + if [[ -z ${@} ]];then + tcar_printMessage "`gettext "The search path cannot be empty."`" --as-error-line + fi + + # Define array variable to store configuration file paths. + local -a CONFIGURATION_FILES + + # Define final filter regular expression. This regular expression + # must match the option = "value" format we are using inside + # configuration files. + local CONFIGURATION_PATTERN="^${OPTION_NAME}[[:space:]]*=[[:space:]]*\"${OPTION_VALUE}\"$" + + for DIRECTORY in ${@};do + + # Clean-up the search path. This location must point a + # directory inside the repository. References to directories + # outside the repository are not supported. + DIRECTORY=$(tcar_checkRepoDirSource ${DIRECTORY}) + + # Verify the search path. It must exist and being a directory. + tcar_checkFiles -ed ${DIRECTORY} + + # Define the list of configuration files the render module + # will use as reference to produce documentation. At this + # point it is very difficult that DIRECTORY doesn't exist or + # be outside the repository directory structure. + CONFIGURATION_FILES[++${#CONFIGURATION_FILES[*]}]=$(tcar_getFilesList \ + ${DIRECTORY} --pattern='.+\.conf$' --type='f' \ + | xargs egrep ${CONFIGURATION_PATTERN} | cut -d: -f1 | sort | uniq) + + done + + # Process the list of configuration files using the render module. + tcar_setModuleEnvironment -m "render" -t "parent" ${CONFIGURATION_FILES[*]} +}