diff --git a/Locales/es_ES/centos-art.sh.po b/Locales/es_ES/centos-art.sh.po index a19bb4d..afac9a6 100644 --- a/Locales/es_ES/centos-art.sh.po +++ b/Locales/es_ES/centos-art.sh.po @@ -1,9 +1,3 @@ -# Spanish translations for centos-art.sh package -# Traducciones al español para el paquete centos-art.sh. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the centos-art.sh package. -# Automatically generated, 2013. -# msgid "" msgstr "" "Project-Id-Version: centos-art.sh 0.6\n" @@ -20,3 +14,189 @@ msgstr "" #: Automation/centos-art.sh:65 msgid "has not execution rights." msgstr "no tiene permiso de ejecución." + +#: Automation/Scripts/tcar_checkFiles.sh:56 +msgid "isn't a directory." +msgstr "no es un directorio." + +#: Automation/Scripts/tcar_checkFiles.sh:62 +msgid "doesn't exist." +msgstr "no existe." + +#: Automation/Scripts/tcar_checkFiles.sh:68 +msgid "isn't a regular file." +msgstr "no es un fichero regular." + +#: Automation/Scripts/tcar_checkFiles.sh:74 +msgid "isn't a symbolic link." +msgstr "no es un enlace simbólico." + +#: Automation/Scripts/tcar_checkFiles.sh:80 +msgid "isn't an executable file." +msgstr "no es un fichero ejecutable." + +#: Automation/Scripts/tcar_checkFiles.sh:87 +#, sh-format +msgid "isn't a \"$MIME\" file." +msgstr "no es un fichero \"$MIME\"." + +#: Automation/Scripts/tcar_checkFiles.sh:93 +msgid "doesn't match its pattern." +msgstr "no coincide con su patrón." + +#: Automation/Scripts/tcar_checkFiles.sh:99 +msgid "isn't installed in the system." +msgstr "no está instalado en el sistema." + +#: Automation/Scripts/tcar_checkFiles.sh:119 +msgid "No file for processing found." +msgstr "Ningún fichero encontrado para procesar." + +#: Automation/Scripts/tcar_checkFiles.sh:146 +msgid "The condition command provided isn't supported." +msgstr "El comando condición suministrado no está soportado." + +#: Automation/Scripts/tcar_getTemporalFile.sh:46 +msgid "The first argument cannot be empty." +msgstr "El primer argumento no puede estar vacío." + +#: Automation/Scripts/tcar_printCopyrightInfo.sh:52 +msgid "Creative Common Attribution-ShareAlike 3.0 License" +msgstr "Licencia Creativa Común de Atribución-Compartida 3.0." + +#: Automation/Scripts/tcar_printCopyrightInfo.sh:125 +msgid "All rights reserved." +msgstr "Todos los derechos reservados." + +#: Automation/Scripts/tcar_printMessage.sh:40 +msgid "The message cannot be empty." +msgstr "El mensaje no puede estar vacío." + +#: Automation/Scripts/tcar_printMessage.sh:126 +msgid "To know more, run" +msgstr "Para conocer más, ejecuta" + +#: Automation/Scripts/tcar_printMessage.sh:132 +msgid "yes" +msgstr "sí" + +#: Automation/Scripts/tcar_printMessage.sh:135 +msgid "no" +msgstr "no" + +#: Automation/Scripts/tcar_printMessage.sh:222 +msgid "Processing" +msgstr "Procesando" + +#: Automation/Scripts/tcar_printMessage.sh:226 +msgid "Cropping from" +msgstr "Recortando desde" + +#: Automation/Scripts/tcar_printMessage.sh:230 +msgid "Tuning-up" +msgstr "Ajustando" + +#: Automation/Scripts/tcar_printMessage.sh:234 +msgid "Checking" +msgstr "Comprobando" + +#: Automation/Scripts/tcar_printMessage.sh:238 +msgid "Combining" +msgstr "Combinando" + +#: Automation/Scripts/tcar_printMessage.sh:242 +msgid "Editing" +msgstr "Editando" + +#: Automation/Scripts/tcar_printMessage.sh:247 +msgid "Updating" +msgstr "Actualizando" + +#: Automation/Scripts/tcar_printMessage.sh:249 +msgid "Creating" +msgstr "Creando" + +#: Automation/Scripts/tcar_printMessage.sh:254 +msgid "Deleting" +msgstr "Borrando" + +#: Automation/Scripts/tcar_printMessage.sh:258 +msgid "Reading" +msgstr "Leyendo" + +#: Automation/Scripts/tcar_printMessage.sh:262 +msgid "Saved as" +msgstr "Salvado como" + +#: Automation/Scripts/tcar_printMessage.sh:266 +msgid "Linked to" +msgstr "Enlazado como" + +#: Automation/Scripts/tcar_printMessage.sh:270 +msgid "Moved to" +msgstr "Movido a" + +#: Automation/Scripts/tcar_printMessage.sh:274 +msgid "Translation" +msgstr "Traducción" + +#: Automation/Scripts/tcar_printMessage.sh:278 +msgid "Translating" +msgstr "Traduciendo" + +#: Automation/Scripts/tcar_printMessage.sh:282 +msgid "Validating" +msgstr "Validando" + +#: Automation/Scripts/tcar_printMessage.sh:286 +msgid "Template" +msgstr "Plantilla" + +#: Automation/Scripts/tcar_printMessage.sh:290 +msgid "Configuration" +msgstr "Configuración" + +#: Automation/Scripts/tcar_printMessage.sh:294 +msgid "Palette" +msgstr "Paleta" + +#: Automation/Scripts/tcar_printVersion.sh:45 +#, sh-format +msgid "" +"$PROGRAM_NAME comes with NO WARRANTY, to the extent permitted by law. You " +"may redistribute copies of $PROGRAM_NAME under the terms of the GNU General " +"Public License. For more information about these matters, see the files " +"named COPYING." +msgstr "" +"$PROGRAM_NAME viene SIN GARANTÍAS, a todo el alcance permitido por la ley. " +"Usted puede distribuir copias de $PROGRAM_NAME bajo los términos de la " +"Licencia Pública General de GNU. Para más información sobre estos asuntos, " +"vea el fichero COPYING." + +#: Automation/Scripts/tcar_setModuleArguments.sh:95 +msgid "The argument verification failed." +msgstr "La verificación de argumento falló." + +#: Automation/Scripts/tcar_setModuleEnvironmentScripts.sh:53 +msgid "No function file was found." +msgstr "Ningún fichero de función fue encontrado." + +#: Automation/Scripts/tcar_setModuleEnvironment.sh:56 +msgid "Unknown" +msgstr "Desconocido" + +#: Automation/Scripts/tcar_setModuleEnvironment.sh:145 +msgid "Opening module" +msgstr "Abriendo módulo" + +#: Automation/Scripts/tcar_setModuleEnvironment.sh:149 +msgid "Closing module" +msgstr "Cerrando módulo" + +#: Automation/Scripts/tcar_setModuleEnvironment.sh:159 +msgid "Closing variables" +msgstr "Cerrando variables" + +#: Automation/Scripts/tcar_unsetModuleEnvironment.sh:37 +msgid "The export id was not provided." +msgstr "El identificador de exportación no fue suministrado." diff --git a/Scripts/Locales/es_ES/tcar_checkFiles.sh.po b/Scripts/Locales/es_ES/tcar_checkFiles.sh.po deleted file mode 100644 index 341b4e3..0000000 --- a/Scripts/Locales/es_ES/tcar_checkFiles.sh.po +++ /dev/null @@ -1,59 +0,0 @@ -# Spanish translations for tcar_checkFiles.sh-0.6 package -# Traducciones al español para el paquete tcar_checkFiles.sh-0.6. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the tcar_checkFiles.sh-0.6 package. -# Automatically generated, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: tcar_checkFiles.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 00:57-0400\n" -"PO-Revision-Date: 2013-10-07 00:57-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/Scripts/tcar_checkFiles.sh:56 -msgid "isn't a directory." -msgstr "no es un directorio." - -#: Automation/Scripts/tcar_checkFiles.sh:62 -msgid "doesn't exist." -msgstr "no existe." - -#: Automation/Scripts/tcar_checkFiles.sh:68 -msgid "isn't a regular file." -msgstr "no es un fichero regular." - -#: Automation/Scripts/tcar_checkFiles.sh:74 -msgid "isn't a symbolic link." -msgstr "no es un enlace simbólico." - -#: Automation/Scripts/tcar_checkFiles.sh:80 -msgid "isn't an executable file." -msgstr "no es un fichero ejecutable." - -#: Automation/Scripts/tcar_checkFiles.sh:87 -#, sh-format -msgid "isn't a \"$MIME\" file." -msgstr "no es un fichero \"$MIME\"." - -#: Automation/Scripts/tcar_checkFiles.sh:93 -msgid "doesn't match its pattern." -msgstr "no coincide con su patrón." - -#: Automation/Scripts/tcar_checkFiles.sh:99 -msgid "isn't installed in the system." -msgstr "no está instalado en el sistema." - -#: Automation/Scripts/tcar_checkFiles.sh:119 -msgid "No file for processing found." -msgstr "Ningún fichero encontrado para procesar." - -#: Automation/Scripts/tcar_checkFiles.sh:146 -msgid "The condition command provided isn't supported." -msgstr "El comando condición suministrado no está soportado." diff --git a/Scripts/Locales/es_ES/tcar_getTemporalFile.sh.po b/Scripts/Locales/es_ES/tcar_getTemporalFile.sh.po deleted file mode 100644 index 14d566f..0000000 --- a/Scripts/Locales/es_ES/tcar_getTemporalFile.sh.po +++ /dev/null @@ -1,22 +0,0 @@ -# Spanish translations for tcar_getTemporalFile.sh-0.6 package -# Traducciones al español para el paquete tcar_getTemporalFile.sh-0.6. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the tcar_getTemporalFile.sh-0.6 package. -# Automatically generated, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: tcar_getTemporalFile.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 00:57-0400\n" -"PO-Revision-Date: 2013-10-07 00:57-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/Scripts/tcar_getTemporalFile.sh:46 -msgid "The first argument cannot be empty." -msgstr "El primer argumento no puede estar vacío." diff --git a/Scripts/Locales/es_ES/tcar_printCopyrightInfo.sh.po b/Scripts/Locales/es_ES/tcar_printCopyrightInfo.sh.po deleted file mode 100644 index 1b860dc..0000000 --- a/Scripts/Locales/es_ES/tcar_printCopyrightInfo.sh.po +++ /dev/null @@ -1,26 +0,0 @@ -# Spanish translations for tcar_printCopyrightInfo.sh-0.6 package -# Traducciones al español para el paquete tcar_printCopyrightInfo.sh-0.6. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the tcar_printCopyrightInfo.sh-0.6 package. -# Automatically generated, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: tcar_printCopyrightInfo.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 00:57-0400\n" -"PO-Revision-Date: 2013-10-07 00:57-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/Scripts/tcar_printCopyrightInfo.sh:52 -msgid "Creative Common Attribution-ShareAlike 3.0 License" -msgstr "Licencia Creativa Común de Atribución-Compartida 3.0." - -#: Automation/Scripts/tcar_printCopyrightInfo.sh:125 -msgid "All rights reserved." -msgstr "Todos los derechos reservados." diff --git a/Scripts/Locales/es_ES/tcar_printMessage.sh.po b/Scripts/Locales/es_ES/tcar_printMessage.sh.po deleted file mode 100644 index 9b43e54..0000000 --- a/Scripts/Locales/es_ES/tcar_printMessage.sh.po +++ /dev/null @@ -1,110 +0,0 @@ -# Spanish translations for tcar_printMessage.sh-0.6 package -# Traducciones al español para el paquete tcar_printMessage.sh-0.6. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the tcar_printMessage.sh-0.6 package. -# Automatically generated, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: tcar_printMessage.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 00:58-0400\n" -"PO-Revision-Date: 2013-10-07 00:58-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/Scripts/tcar_printMessage.sh:40 -msgid "The message cannot be empty." -msgstr "El mensaje no puede estar vacío." - -#: Automation/Scripts/tcar_printMessage.sh:126 -msgid "To know more, run" -msgstr "Para conocer más, ejecuta" - -#: Automation/Scripts/tcar_printMessage.sh:132 -msgid "yes" -msgstr "sí" - -#: Automation/Scripts/tcar_printMessage.sh:135 -msgid "no" -msgstr "no" - -#: Automation/Scripts/tcar_printMessage.sh:222 -msgid "Processing" -msgstr "Procesando" - -#: Automation/Scripts/tcar_printMessage.sh:226 -msgid "Cropping from" -msgstr "Recortando desde" - -#: Automation/Scripts/tcar_printMessage.sh:230 -msgid "Tuning-up" -msgstr "Ajustando" - -#: Automation/Scripts/tcar_printMessage.sh:234 -msgid "Checking" -msgstr "Comprobando" - -#: Automation/Scripts/tcar_printMessage.sh:238 -msgid "Combining" -msgstr "Combinando" - -#: Automation/Scripts/tcar_printMessage.sh:242 -msgid "Editing" -msgstr "Editando" - -#: Automation/Scripts/tcar_printMessage.sh:247 -msgid "Updating" -msgstr "Actualizando" - -#: Automation/Scripts/tcar_printMessage.sh:249 -msgid "Creating" -msgstr "Creando" - -#: Automation/Scripts/tcar_printMessage.sh:254 -msgid "Deleting" -msgstr "Borrando" - -#: Automation/Scripts/tcar_printMessage.sh:258 -msgid "Reading" -msgstr "Leyendo" - -#: Automation/Scripts/tcar_printMessage.sh:262 -msgid "Saved as" -msgstr "Salvado como" - -#: Automation/Scripts/tcar_printMessage.sh:266 -msgid "Linked to" -msgstr "Enlazado como" - -#: Automation/Scripts/tcar_printMessage.sh:270 -msgid "Moved to" -msgstr "Movido a" - -#: Automation/Scripts/tcar_printMessage.sh:274 -msgid "Translation" -msgstr "Traducción" - -#: Automation/Scripts/tcar_printMessage.sh:278 -msgid "Translating" -msgstr "Traduciendo" - -#: Automation/Scripts/tcar_printMessage.sh:282 -msgid "Validating" -msgstr "Validando" - -#: Automation/Scripts/tcar_printMessage.sh:286 -msgid "Template" -msgstr "Plantilla" - -#: Automation/Scripts/tcar_printMessage.sh:290 -msgid "Configuration" -msgstr "Configuración" - -#: Automation/Scripts/tcar_printMessage.sh:294 -msgid "Palette" -msgstr "Paleta" diff --git a/Scripts/Locales/es_ES/tcar_printVersion.sh.po b/Scripts/Locales/es_ES/tcar_printVersion.sh.po deleted file mode 100644 index 5ccf8fe..0000000 --- a/Scripts/Locales/es_ES/tcar_printVersion.sh.po +++ /dev/null @@ -1,31 +0,0 @@ -# Spanish translations for tcar_printVersion.sh-0.6 package -# Traducciones al español para el paquete tcar_printVersion.sh-0.6. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the tcar_printVersion.sh-0.6 package. -# Automatically generated, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: tcar_printVersion.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 00:58-0400\n" -"PO-Revision-Date: 2013-10-07 00:58-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/Scripts/tcar_printVersion.sh:45 -#, sh-format -msgid "" -"$PROGRAM_NAME comes with NO WARRANTY, to the extent permitted by law. You " -"may redistribute copies of $PROGRAM_NAME under the terms of the GNU General " -"Public License. For more information about these matters, see the files " -"named COPYING." -msgstr "" -"$PROGRAM_NAME viene SIN GARANTÍAS, a todo el alcance permitido por la ley. " -"Usted puede distribuir copias de $PROGRAM_NAME bajo los términos de la " -"Licencia Pública General de GNU. Para más información sobre estos asuntos, " -"vea el fichero COPYING." diff --git a/Scripts/Locales/es_ES/tcar_setModuleArguments.sh.po b/Scripts/Locales/es_ES/tcar_setModuleArguments.sh.po deleted file mode 100644 index 5c6075a..0000000 --- a/Scripts/Locales/es_ES/tcar_setModuleArguments.sh.po +++ /dev/null @@ -1,22 +0,0 @@ -# Spanish translations for tcar_setModuleArguments.sh-0.6 package -# Traducciones al español para el paquete tcar_setModuleArguments.sh-0.6. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the tcar_setModuleArguments.sh-0.6 package. -# Automatically generated, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: tcar_setModuleArguments.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 00:58-0400\n" -"PO-Revision-Date: 2013-10-07 00:58-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/Scripts/tcar_setModuleArguments.sh:95 -msgid "The argument verification failed." -msgstr "La verificación de argumento falló." diff --git a/Scripts/Locales/es_ES/tcar_setModuleEnvironment.sh.po b/Scripts/Locales/es_ES/tcar_setModuleEnvironment.sh.po deleted file mode 100644 index c5ab3af..0000000 --- a/Scripts/Locales/es_ES/tcar_setModuleEnvironment.sh.po +++ /dev/null @@ -1,34 +0,0 @@ -# Spanish translations for tcar_setModuleEnvironment.sh-0.6 package -# Traducciones al español para el paquete tcar_setModuleEnvironment.sh-0.6. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the tcar_setModuleEnvironment.sh-0.6 package. -# Automatically generated, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: tcar_setModuleEnvironment.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 00:58-0400\n" -"PO-Revision-Date: 2013-10-07 00:58-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/Scripts/tcar_setModuleEnvironment.sh:56 -msgid "Unknown" -msgstr "Desconocido" - -#: Automation/Scripts/tcar_setModuleEnvironment.sh:145 -msgid "Opening module" -msgstr "Abriendo módulo" - -#: Automation/Scripts/tcar_setModuleEnvironment.sh:149 -msgid "Closing module" -msgstr "Cerrando módulo" - -#: Automation/Scripts/tcar_setModuleEnvironment.sh:159 -msgid "Closing variables" -msgstr "Cerrando variables" diff --git a/Scripts/Locales/es_ES/tcar_setModuleEnvironmentScripts.sh.po b/Scripts/Locales/es_ES/tcar_setModuleEnvironmentScripts.sh.po deleted file mode 100644 index 41c4cdc..0000000 --- a/Scripts/Locales/es_ES/tcar_setModuleEnvironmentScripts.sh.po +++ /dev/null @@ -1,22 +0,0 @@ -# Spanish translations for tcar_setModuleEnvironmentScripts.sh-0.6 package -# Traducciones al español para el paquete tcar_setModuleEnvironmentScripts.sh-0.6. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the tcar_setModuleEnvironmentScripts.sh-0.6 package. -# Automatically generated, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: tcar_setModuleEnvironmentScripts.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 00:58-0400\n" -"PO-Revision-Date: 2013-10-07 00:58-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/Scripts/tcar_setModuleEnvironmentScripts.sh:53 -msgid "No function file was found." -msgstr "Ningún fichero de función fue encontrado." diff --git a/Scripts/Locales/es_ES/tcar_unsetModuleEnvironment.sh.po b/Scripts/Locales/es_ES/tcar_unsetModuleEnvironment.sh.po deleted file mode 100644 index 9cb0f79..0000000 --- a/Scripts/Locales/es_ES/tcar_unsetModuleEnvironment.sh.po +++ /dev/null @@ -1,22 +0,0 @@ -# Spanish translations for tcar_unsetModuleEnvironment.sh-0.6 package -# Traducciones al español para el paquete tcar_unsetModuleEnvironment.sh-0.6. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the tcar_unsetModuleEnvironment.sh-0.6 package. -# Automatically generated, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: tcar_unsetModuleEnvironment.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 00:58-0400\n" -"PO-Revision-Date: 2013-10-07 00:58-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/Scripts/tcar_unsetModuleEnvironment.sh:37 -msgid "The export id was not provided." -msgstr "El identificador de exportación no fue suministrado." diff --git a/Scripts/tcar_checkFiles.sh b/Scripts/tcar_checkFiles.sh deleted file mode 100755 index 97aa0f0..0000000 --- a/Scripts/tcar_checkFiles.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_checkFiles.sh -- This function standardizes the way file -# conditional expressions are applied to files. Here is where -# centos-art.sh script answers questions like: is the file a regular -# file or a directory? Or, is it a symbolic link? Or even, does it -# have execution rights, etc. If the verification fails somehow at -# any point, an error message is output and centos-art.sh script -# finishes its execution. -# -# 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 tcar_checkFiles { - - # Define gettext-specific variables locally, to provide - # per-function localization. - local TEXTDOMAIN="${FUNCNAME}.sh" - local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" - - # Initialize local array variables. - local -a CONDITION_COMMAND - local -a CONDITION_PATTERN - local -a CONDITION_MESSAGE - - # Initialize local counter. - local COUNTER=0 - - OPTIND=1 - while getopts "i:,r,m:,n,d,e,f,h,x" OPTION "${@}"; do - - case "${OPTION}" in - - d ) - CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/test' - CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-d' - CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "isn't a directory."`" - ;; - - e ) - CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/test' - CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-e' - CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "doesn't exist."`" - ;; - - f ) - CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/test' - CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-f' - CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "isn't a regular file."`" - ;; - - h ) - CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/test' - CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-h' - CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "isn't a symbolic link."`" - ;; - - x ) - CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/test' - CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-x' - CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "isn't an executable file."`" - ;; - - i ) - local MIME=${OPTARG} - CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/file' - CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-bi' - CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`eval_gettext "isn't a \\\"\\\$MIME\\\" file."`" - ;; - - m ) - CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='match' - CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]="${OPTARG}" - CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "doesn't match its pattern."`" - ;; - - n ) - CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]="/bin/rpm" - CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]="-q --quiet" - CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "isn't installed in the system."`" - ;; - - esac - done - - # Clean up positional parameters to reflect the fact that options - # have been processed already. - shift $(( ${OPTIND} - 1 )) - - # Define list of files we want to apply verifications to, now that - # all option-like arguments have been removed from positional - # parameters list so we are free to go with the verifications. - local FILE='' - local FILES=${@} - - # Verify existence of files to prevent centos-art.sh script from - # using the current location in cases when it shouldn't (e.g., - # here it is expecting a list of files to process.). - if [[ -z ${FILES} ]];then - tcar_printMessage "`gettext "No file for processing found."`" --as-error-line - fi - - for FILE in ${FILES};do - - until [[ ${COUNTER} -eq ${#CONDITION_PATTERN[*]} ]];do - - case ${CONDITION_COMMAND[${COUNTER}]} in - - "/usr/bin/test" | "/bin/rpm" ) - ${CONDITION_COMMAND[${COUNTER}]} ${CONDITION_PATTERN[${COUNTER}]} ${FILE} \ - || tcar_printMessage "${FILE} ${CONDITION_MESSAGE[${COUNTER}]}" --as-error-line - ;; - - "/usr/bin/file" ) - if [[ ! $(${CONDITION_COMMAND[${COUNTER}]} ${CONDITION_PATTERN[${COUNTER}]} ${FILE}) =~ "^${MIME}" ]];then - tcar_printMessage "${FILE} ${CONDITION_MESSAGE[${COUNTER}]}" --as-error-line - fi - ;; - - "match" ) - if [[ ! ${FILE} =~ "${CONDITION_PATTERN[${COUNTER}]}" ]];then - tcar_printMessage "${FILE} ${CONDITION_MESSAGE[${COUNTER}]}" --as-error-line - fi - ;; - - * ) - tcar_printMessage "`gettext "The condition command provided isn't supported."`" --as-error-line - ;; - - esac - - COUNTER=$((${COUNTER} + 1)) - - done - - done - -} diff --git a/Scripts/tcar_checkModuleName.sh b/Scripts/tcar_checkModuleName.sh deleted file mode 100755 index c93a7d3..0000000 --- a/Scripts/tcar_checkModuleName.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_checkModuleName.sh -- This function uses the module's based -# directory to verify whether child and sibling modules do exist or -# not. -# -# 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 tcar_checkModuleName { - - local TCAR_MODULE_LIST=$(ls ${TCAR_MODULE_BASEDIR} | tr '\n' '|' \ - | sed -r 's/\|$//' | tr '[[:upper:]]' '[[:lower:]]') - - tcar_checkFiles -m "^(${TCAR_MODULE_LIST})$" "${TCAR_MODULE_NAME}" - - tcar_printMessage "TCAR_MODULE_LIST : ${TCAR_MODULE_LIST}" --as-debugger-line - -} diff --git a/Scripts/tcar_checkRepoDirSource.sh b/Scripts/tcar_checkRepoDirSource.sh deleted file mode 100755 index 05febd7..0000000 --- a/Scripts/tcar_checkRepoDirSource.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_checkRepoDirSource.sh -- This function standardizes the path -# construction of directories inside the working copy, using -# absolute paths. This function transforms relative paths passed as -# non-option arguments to centos-art.sh script command-line into -# absolute paths inside the working copy, based on whether you are -# using Subversion or Git as version control system. Further -# verifications, (e.g., whether they really exist as directories -# inside the working copy or not) should be realized outside this -# function. -# -# Use this function whenever you want to be sure non-option -# arguments passed to centos-art.sh script command-line do always -# point to directories inside the working copy. Transforming -# relative paths into absolute paths, before processing them, is -# very useful when you need to execute the centos-art.sh script as -# command (e.g., `centos-art') anywhere on your workstation. -# -# 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 tcar_checkRepoDirSource { - - # Define gettext-specific variables locally, to provide - # per-function localization. - local TEXTDOMAIN="${FUNCNAME}.sh" - local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" - - local LOCATION=${1} - - # Remove any dot from arguments passed to centos-art.sh script. - # This way it is possible to use a single dot to reflect the - # current location from which centos-art.sh was executed. Notice - # that using a dot as argument is optional (e.g.: when you pass no - # argument to centos-art command-line, the current location is - # used as default location). However, it might be useful to use a - # dot as argument when you want to include the current location in - # a list of arguments to process. Don't forget that dot slash can - # be used to refer locations relatively. - LOCATION=$(echo "${LOCATION}" | sed -r "s,^\.(/([[:alnum:]_/.-]+)?)?$,$(pwd)\1,g") - - # Remove the path to repository's base directory from location in - # order to avoid path duplications here. - LOCATION=$(echo "${LOCATION}" | sed "s,${TCAR_BASEDIR}/,,g") - - # When we use Git as version control system, there isn't a need of - # using the `trunk', `branches', `tags' convention we were using - # for Subversion. The working copy begins directly with the - # content of our repository (e.g., Documentation, Scripts, - # Identity and Locales). - # - # When we use Subversion as version control system, we follow the - # `trunk', `branches', `tags' convention to organize files inside - # the repository and need to redefine the source path in order to - # build the repository absolute path from the repository top level - # on. As convention, when you prepare your working copy through - # centos-art.sh script, the absolute path to the `trunk/' - # directory is used as working copy. This is, path arguments - # provided to centos-art.sh script will be interpreted from trunk/ - # directory level on. For example, the following command should - # work correctly in both Subversion and Git repositories: - # - # centos-art render Documentation/Manuals/Docbook/Tcar-ug - # - # There isn't a need of verifying the paths built here. This is - # something we do later, using the tcar_checkFiles function. We - # don't do the file verification here to avoid malformed error - # messages when we reassign variable values using this function as - # reference (e.g., in order to prevent error messages from being - # stored inside variables.). - LOCATION=${TCAR_BASEDIR}/${LOCATION} - - # Remove trailing slashes passed as argument. The single slash - # form is used to refer the repository's root directory. The - # single slash form passed as argument of centos-art.sh script is - # useful to execute commands over the - # entire repository tree. - echo "${LOCATION}" | sed -r -e 's,/+,/,g' -e 's,/+$,,g' - -} diff --git a/Scripts/tcar_getConfigLines.sh b/Scripts/tcar_getConfigLines.sh deleted file mode 100755 index 6c52553..0000000 --- a/Scripts/tcar_getConfigLines.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_getConfigLines.sh -- This function standardizes the way -# configuration lines are retrieved form configuration files. As -# arguments, the configuration file absolute path, the configuration -# section name, and the configuration option name must be provided. -# -# 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 tcar_getConfigLines { - - # Initialize absolute path to configuration file. - local CONFIGURATION_FILE="${1}" - - # Initialize configuration section name where the variable value - # we want to to retrieve is set in. - local CONFIGURATION_SECTION="${2}" - - # Initialize variable name we want to retrieve value from. - local CONFIGURATION_OPTION="${3}" - - # Verify configuration variable name. When no variable name is - # provided print all configuration lines that can be considered as - # well-formed paths. Be sure configuration variable name starts - # just at the beginning of the line. - if [[ ! ${CONFIGURATION_OPTION} =~ '^[[:alnum:]_./-]+$' ]];then - CONFIGURATION_OPTION='[[:alnum:]_./-]+[[:space:]]*=' - fi - - # Retrieve configuration lines from configuration file. Don't sort - # the value of this value so as to preserve the order given in the - # configuration file. This is important because configuration - # files are being used for setting render-from priorities. - local CONFIGURATION_LINES=$(cat ${CONFIGURATION_FILE} \ - | egrep -v '^#' \ - | egrep -v '^[[:space:]]*$' \ - | sed -r -n "/^\[${CONFIGURATION_SECTION}\][[:space:]]*$/,/^\[/p" \ - | egrep -v '^\[' \ - | egrep "^${CONFIGURATION_OPTION}") - - # Output value related to variable name. - echo "${CONFIGURATION_LINES}" - -} diff --git a/Scripts/tcar_getConfigSectionNames.sh b/Scripts/tcar_getConfigSectionNames.sh deleted file mode 100755 index 8da1206..0000000 --- a/Scripts/tcar_getConfigSectionNames.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_getConfigSectionNames.sh -- This function standardizes the way -# section names are retrieved from configuration files. Once section -# names are retrieved they are printed to standard output for -# further 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 tcar_getConfigSectionNames { - - # Define absolute path to configuration file we want to retrieve - # section names from. - local CONFIGURATION_FILE=${1} - - # Verify existence of configuration file. - tcar_checkFiles -ef ${CONFIGURATION_FILE} - - # Define regular expression pattern used to retrieve section names - # from configuration files. Don't permit any regular expression - # meta-character either. - local CONFIGURATION_SECTION_REGEX='^\[[[:alnum:]_.-]+\][[:space:]]*$' - - # Output all section names without brackets, one per line. Don't - # permit any kind of expansion here. Section names are used as - # reference to retrieve information from configuration file, - # expanding them would create different points of verifications. - egrep ${CONFIGURATION_SECTION_REGEX} ${CONFIGURATION_FILE} \ - | sed -r 's,\[(.+)\],\1,' - -} diff --git a/Scripts/tcar_getConfigValue.sh b/Scripts/tcar_getConfigValue.sh deleted file mode 100755 index 9b2f32f..0000000 --- a/Scripts/tcar_getConfigValue.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_getConfigValue.sh -- This function standardizes the way -# configuration values are retrieved from configuration files. As -# arguments, the configuration file absolute path, the configuration -# section name, and the configuration option name must be provided. -# -# 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 tcar_getConfigValue { - - local CONFIGURATION_FILE="${1}" - - local CONFIGURATION_SECTION="${2}" - - local CONFIGURATION_OPTION="${3}" - - local CONFIGURATION_LINES=$(tcar_getConfigLines \ - "${CONFIGURATION_FILE}" "${CONFIGURATION_SECTION}" "${CONFIGURATION_OPTION}") - - for CONFIGURATION_LINE in "${CONFIGURATION_LINES}";do - - local CONFIGURATION_VALUE=$(echo "${CONFIGURATION_LINE}" \ - | cut -d= -f2- | sed -r -e 's/"//g' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - - eval echo ${CONFIGURATION_VALUE} - - done - - -} diff --git a/Scripts/tcar_getFileExtension.sh b/Scripts/tcar_getFileExtension.sh deleted file mode 100755 index b00cb26..0000000 --- a/Scripts/tcar_getFileExtension.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_getFileExtension.sh -- This function retrieves the extension -# of a file. -# -# 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 tcar_getFileExtension { - - basename ${1} | sed -r 's/.+\.([[:alnum:]]+)$/\1/' - -} diff --git a/Scripts/tcar_getFileName.sh b/Scripts/tcar_getFileName.sh deleted file mode 100755 index 99bfb76..0000000 --- a/Scripts/tcar_getFileName.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_getFileName.sh -- This function retrieves the name of a file. -# -# 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 tcar_getFileName { - - basename ${1} | sed -r 's/\.([[:alnum:]]+)$//' - -} diff --git a/Scripts/tcar_getFilesList.sh b/Scripts/tcar_getFilesList.sh deleted file mode 100755 index 6bd611a..0000000 --- a/Scripts/tcar_getFilesList.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_getFilesList.sh -- This function standardizes the way list of -# files are built inside centos-art.sh script. This function outputs -# a sorted and unique list of files based on the options and -# locations passed as argument. -# -# 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 tcar_getFilesList { - - # Define short options. - local ARGSS='' - - # Define long options. - local ARGSL='pattern:,mindepth:,maxdepth:,type:,uid:' - - # Initialize pattern used to reduce the find output. - local PATTERN="${TCAR_FLAG_FILTER}" - - # Initialize options used with find command. - local OPTIONS='' - - # Initialize arguments with an empty value and set it as local - # variable to this function scope. Doing this is very important to - # avoid any clash with higher execution environments. - local TCAR_MODULE_ARGUMENT='' - - # Process all arguments currently available in this function - # environment. If either ARGSS or ARGSL local variables have been - # defined, argument processing goes through getopt for validation. - tcar_setModuleArguments "${@}" - - # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. - eval set -- "${TCAR_MODULE_ARGUMENT}" - - while true;do - case "${1}" in - - --pattern ) - PATTERN="${2}" - shift 2 - ;; - - --maxdepth ) - OPTIONS="${OPTIONS} -maxdepth ${2}" - shift 2 - ;; - - --mindepth ) - OPTIONS="${OPTIONS} -mindepth ${2}" - shift 2 - ;; - - --type ) - OPTIONS="${OPTIONS} -type ${2}" - shift 2 - ;; - - --uid ) - OPTIONS="${OPTIONS} -uid ${2}" - shift 2 - ;; - - -- ) - shift 1 - break - ;; - esac - done - - # At this point all options arguments have been processed and - # removed from positional parameters. Only non-option arguments - # remain so we use them as source location for find command to - # look files for. - - # Verify that locations does exist. - tcar_checkFiles -e ${@} - - # Redefine pattern as regular expression. 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 we are using. Doing so, every time we pass the `--filter' - # option in the command-line could 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. Do not use locations - # as part of regular expression so it could be possible to use - # path expansion. Using path expansion reduce the amount of - # places to find out things and so the time required to finish the - # task. - # - # Don't do such path expansion here. Instead, do it when you call - # this function. Otherwise you would be prohibiting the - # application of exact patterns. - #PATTERN="^/.*${PATTERN}$" - - # Define list of files to process. At this point we cannot verify - # whether the location is a directory or a file since path - # expansion could be introduced to it. The best we can do is - # verifying exit status and go on. - find ${@} -regextype posix-egrep ${OPTIONS} -regex "${PATTERN}" | sort | uniq - -} diff --git a/Scripts/tcar_getPathComponent.sh b/Scripts/tcar_getPathComponent.sh deleted file mode 100755 index d006768..0000000 --- a/Scripts/tcar_getPathComponent.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_getPathComponent.sh -- This function standardizes the way -# directory structures are organized inside the working copy of -# CentOS Artwork Repository. You can use this function to retrieve -# information from paths (e.g., releases, architectures and theme -# artistic motifs) or the patterns used to build the paths. -# -# 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 tcar_getPathComponent { - - # Define short options. - local ARGSS='' - - # Define long options. - local ARGSL='release,release-major,release-minor,release-pattern,architecture,architecture-pattern,motif,motif-name,motif-version,motif-pattern,repo-dir' - - # Define release pattern. - local VERSION="(([[:digit:]]+)(\.([[:digit:]]+))?)" - - # Define architecture pattern. Make it match the architectures the - # CentOS distribution is able to be installed on. - local ARCHITECTURE="(i386|x86_64)" - - # Define regular expression pattern that match the theme artistic - # motif component inside the path strings. - local THEME_MOTIF="Themes/Motifs/(([[:alnum:]]+)/(${VERSION}))" - - # Initialize arguments with an empty value and set it as local - # variable to this function scope. Doing this is very important to - # avoid any clash with higher execution environments. - local TCAR_MODULE_ARGUMENT='' - - # Process all arguments currently available in this function - # environment. If either ARGSS or ARGSL local variables have been - # defined, argument processing goes through getopt for validation. - tcar_setModuleArguments "${@}" - - # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. - eval set -- "${TCAR_MODULE_ARGUMENT}" - - # Define location we want to apply verifications to. - local LOCATION=$(echo ${@} | sed -r 's!^.*--[[:space:]](.+)$!\1!') - - # Look for options passed through positional parameters. - while true;do - - case "${1}" in - - --release ) - echo "${LOCATION}" | egrep "${VERSION}" | sed -r "s!.*/${VERSION}/.*!\1!" - shift 1 - break - ;; - - --release-major ) - echo "${LOCATION}" | egrep "${VERSION}" | sed -r "s!.*/${VERSION}/.*!\2!" - shift 1 - break - ;; - - --release-minor ) - echo "${LOCATION}" | egrep "${VERSION}" | sed -r "s!.*/${VERSION}/.*!\4!" - shift 1 - break - ;; - - --release-pattern ) - echo "${VERSION}" - shift 1 - break - ;; - - --architecture ) - echo "${LOCATION}" | egrep "${ARCHITECTURE}" | sed -r "s!${ARCHITECTURE}!\1!" - shift 1 - break - ;; - - --architecture-pattern ) - echo "${ARCHITECTURE}" - shift 1 - break - ;; - - --motif ) - echo "${LOCATION}" | egrep "${THEME_MOTIF}" | sed -r "s!.*${THEME_MOTIF}.*!\1!" - shift 1 - break - ;; - - --motif-name ) - echo "${LOCATION}" | egrep "${THEME_MOTIF}" | sed -r "s!.*${THEME_MOTIF}.*!\2!" - shift 1 - break - ;; - - --motif-version ) - echo "${LOCATION}" | egrep "${THEME_MOTIF}" | sed -r "s!.*${THEME_MOTIF}.*!\3!" - shift 1 - break - ;; - - --motif-pattern ) - echo "${THEME_MOTIF}" - shift 1 - break - ;; - - --repo-dir ) - echo "${LOCATION}" | sed "s,${TCAR_USER_WRKDIR}/,," - shift 1 - break - ;; - - esac - - done - -} diff --git a/Scripts/tcar_getRepoName.sh b/Scripts/tcar_getRepoName.sh deleted file mode 100755 index b572bf0..0000000 --- a/Scripts/tcar_getRepoName.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_getRepoName.sh -- This function standardizes files and -# directories name convection inside the working copy of CentOS -# Artowrk Repository. As convection, regular files are written in -# lower-case and directories are written capitalized. Use this -# function to sanitate the name of regular files and directories on -# paths you work with. -# -# 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 tcar_getRepoName { - - # Define the name we want to apply verifications to. - local NAME="${1}" - - # Avoid using options as it were names. When name value is empty - # but an option is provided, the option becomes the first - # positional argument and is evaluated as it were a name which is - # something we need to prevent from happening. - if [[ ${NAME} =~ '^-' ]];then - return - fi - - # Look for options passed through positional parameters. - case "${2}" 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 ) - - local DIR='' - local DIRS='' - local CLEANDIRS='' - local PREFIXDIR='' - - # In order to sanitate each directory in a path, it is - # required to break off the path string so each component - # can be worked out individually and later combine them - # back to create a clean path string. - - # Reduce path information passed to use the directory part - # of it only. Of course, this is applied if there is a - # directory part in the path. Assuming there is no - # directory part but a non-empty value in the path, use - # that value as directory part and clean it up. - if [[ ${NAME} =~ '.+/.+' ]];then - - # When path information is reduced, we need to - # consider that absolute paths contain some - # directories outside the working copy directory - # structure that shouldn't be sanitized (e.g., /home, - # /home/centos, /home/centos/artwork, - # /home/centos/artwork/turnk, trunk, etc.) So, we keep - # them unchanged for later use. - PREFIXDIR=$(echo ${NAME} \ - | sed -r "s,^((${TCAR_USER_WRKDIR}/)?(trunk|branches|tags)/)?.+$,\1,") - - # ... and remove them 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 sanitized values. - CLEANDIRS="${CLEANDIRS}/${DIR}" - - done - - # Redefine path using sanitized values. - NAME=$(echo ${CLEANDIRS} | sed -r "s!^/!!") - - # Add prefix directory information to sanitate path - # information. - if [[ "${PREFIXDIR}" != '' ]];then - NAME=${PREFIXDIR}${NAME} - fi - ;; - - esac - - # Print out the clean path string. - echo ${NAME} - -} diff --git a/Scripts/tcar_getTemporalFile.sh b/Scripts/tcar_getTemporalFile.sh deleted file mode 100755 index b182513..0000000 --- a/Scripts/tcar_getTemporalFile.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_getTemporalFile.sh -- This function returns the absolute path -# you need to use to create temporal files. Use this function -# whenever you need to create temporal files inside 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 tcar_getTemporalFile { - - # Define gettext-specific variables locally, to provide - # per-function localization. - local TEXTDOMAIN="${FUNCNAME}.sh" - local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" - - # Define base name 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 extension is - # required in order to avoid complains from inkscape. - local FILENAME="${RANDOM}${RANDOM}-$(tcar_getRepoName ${1} -f)" - - # Check default base name for temporal file, it can't be an empty - # value. - if [[ -z "${FILENAME}" ]];then - tcar_printMessage "`gettext "The first argument cannot be empty."`" --as-error-line - fi - - # Define absolute path for temporal file and send it out to - # standard output. - echo "${TCAR_SCRIPT_TEMPDIR}/${FILENAME}" - -} diff --git a/Scripts/tcar_printCaller.sh b/Scripts/tcar_printCaller.sh deleted file mode 100755 index 1ceab89..0000000 --- a/Scripts/tcar_printCaller.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_printCaller.sh -- This function standardizes the way caller -# information is retrieved. -# -# 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 tcar_printCaller { - - local EXPR=${1} - local OPTS=${2} - - case ${OPTS} in - - --line ) - caller ${EXPR} | gawk '{ print $1 }' - ;; - - --name ) - caller ${EXPR} | gawk '{ print $2 }' - ;; - - --path ) - caller ${EXPR} | gawk '{ print $3 }' - ;; - - * ) - # Define where the error was originated inside the - # centos-art.sh script. Print out the function name and - # line from the caller. - caller ${EXPR} | gawk '{ print $2 " L." $1 }' - ;; - - esac - -} diff --git a/Scripts/tcar_printCopyrightInfo.sh b/Scripts/tcar_printCopyrightInfo.sh deleted file mode 100755 index f50c4cd..0000000 --- a/Scripts/tcar_printCopyrightInfo.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_printCopyrightInfo.sh -- This function standardizes the -# copyright information printed on content produced by centos-art.sh -# script. -# -# As far as I understand, the copyright exists to make people create -# more. The copyright gives creators the legal power over their -# creations and so the freedom to distribute them under the ethical -# terms the creator considers better. At this moment I don't feel -# very confident about this legal affairs and their legal -# implications, but I need to decide what copyright information the -# centos-art.sh script will print out when someone request -# information about it. So, in that sake, I am using The CentOS -# Artwork SIG as copyright holder and the GNU Public License, -# version 2 or any later, for software distribution. -# -# 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 tcar_printCopyrightInfo { - - # Define gettext-specific variables locally, to provide - # per-function localization. - local TEXTDOMAIN="${FUNCNAME}.sh" - local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" - - case "${1}" in - - --license ) - - # Print the license name. - echo "`gettext "Creative Common Attribution-ShareAlike 3.0 License"`" - ;; - - --license-url ) - - # Print the url related to license name. - tcar_printUrl --cc-sharealike - ;; - - --first-year ) - - # The former year when I (as collaborator of The CentOS - # Project) started to consolidate The CentOS Project - # Corporate Visual Identity through the CentOS Artwork - # Repository. - echo '2009' - ;; - - --year|--last-year) - - # The last year when The CentOS Project stopped working in - # its Corporate Visual Identity through the CentOS Artwork - # Repository. That is something that I hope never happens, - # so assume the current year as last working year. - date +%Y - ;; - - --years-range ) - - local FIRST_YEAR=$(tcar_printCopyrightInfo --first-year) - local LAST_YEAR=$(tcar_printCopyrightInfo --last-year) - echo "${FIRST_YEAR}-${LAST_YEAR}" - ;; - - --years-list ) - - local FIRST_YEAR=$(tcar_printCopyrightInfo --first-year) - local LAST_YEAR=$(tcar_printCopyrightInfo --last-year) - - # Define full copyright year string based on first and - # last year. - local FULL_YEAR=$(\ - while [[ ${FIRST_YEAR} -le ${LAST_YEAR} ]];do - echo -n "${FIRST_YEAR}, " - FIRST_YEAR=$((${FIRST_YEAR} + 1)) - done) - - # Prepare full copyright year string and print it out. - echo "${FULL_YEAR}" | sed 's!, *$!!' - ;; - - --holder ) - - # Print centos-art.sh script default copyright holder. Be - # pragmatic about this information, please. The CentOS - # Project exists to produce The CentOS Distribution, not - # centos-art.sh script. Nevertheless, The CentOS Artwork - # SIG is an organizational unit of The CentOS Project - # which is focused on producing The CentOS Project - # corporate visual identity, by means of The CentOS - # Artwork Repository. The centos-art.sh script automates - # frequent tasks inside The CentOS Artwork Repository so, - # based on these considerations, the copyright holder of - # the centos-art.sh script is "closer" to be The CentOS - # Artwork SIG than it would be The CentOS Project. These - # are the logical choosing ideas behind the copyright - # holder of centos-art.sh script. - echo "The CentOS Artwork SIG" - ;; - - --holder-predicate ) - - local HOLDER=$(tcar_printCopyrightInfo --holder) - echo "${HOLDER}. `gettext "All rights reserved."`" - ;; - - * ) - - local YEAR=$(tcar_printCopyrightInfo --last-year) - local HOLDER=$(tcar_printCopyrightInfo --holder) - echo "Copyright © ${YEAR} ${HOLDER}" - ;; - - esac - -} diff --git a/Scripts/tcar_printFile.sh b/Scripts/tcar_printFile.sh deleted file mode 100755 index 303133e..0000000 --- a/Scripts/tcar_printFile.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_printFile.sh -- This function standardizes the way files are -# concatenated inside 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 tcar_printFile { - - # Define absolute path to file you want to print. Take into - # consideration that this file might be out of the repository - # (e.g., it would be a temporal file stored under - # /tmp/centos-art-XXXXXX/ directory). - local FILE="${1}" - - tcar_checkFiles -ef ${FILE} - - if [[ $(/usr/bin/file -b -i ${FILE}) =~ '^application/x-gzip$' ]];then - /bin/zcat ${FILE} - elif [[ $(/usr/bin/file -b -i ${FILE}) =~ '^application/x-bzip2$' ]];then - /bin/bzcat ${FILE} - else - /bin/cat ${FILE} - fi - -} diff --git a/Scripts/tcar_printHelp.sh b/Scripts/tcar_printHelp.sh deleted file mode 100755 index f585eb7..0000000 --- a/Scripts/tcar_printHelp.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_printHelp.sh -- This function standardizes the way -# centos-art.sh script prints help about itself. -# -# 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 tcar_printHelp { - - # Retrieve the man page name. This is the file name you want to retrieve - # documentation for. This value is optional. When it is not passed, the - # module name is used. - local TCAR_MANPAGE_NAME="${1:-${TCAR_MODULE_NAME}}" - - # When the module name has not been set and the tcar_printHelp - # function is called from centos-art.sh file, the page name come - # with with --help as opening string and probably as - # --help=filename.sh. In the first case it prints the script - # documentation. In the second case it prints documentation for - # the file specified. - if [[ -z ${TCAR_MODULE_NAME} ]];then - if [[ ${TCAR_MANPAGE_NAME} =~ '^--help=[[:alnum:]_-.]+' ]];then - TCAR_MANPAGE_NAME=$(echo ${TCAR_MANPAGE_NAME} | cut -d'=' -f2) - else - TCAR_MANPAGE_NAME=${TCAR_SCRIPT_NAME} - fi - fi - - # Print requested documentation. - /usr/bin/man -M ${TCAR_SCRIPT_DIR_MANUALS}:${TCAR_MODULE_DIR_MANUALS}/Final "${TCAR_MANPAGE_NAME}" - - # Finish script execution successfully. - exit 0 - -} diff --git a/Scripts/tcar_printMailingList.sh b/Scripts/tcar_printMailingList.sh deleted file mode 100755 index 3bac5a4..0000000 --- a/Scripts/tcar_printMailingList.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_printMailingList.sh -- This function standardizes the way -# mailing list addresses are printed on content produced 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 tcar_printMailingList { - - local MAILADDRS='' - - # Define short options. - local ARGSS='' - - # Define long options. - local ARGSL='as-html-link:,docs' - - # Initialize arguments with an empty value and set it as local - # variable to this function scope. Doing this is very important to - # avoid any clash with higher execution environments. - local TCAR_MODULE_ARGUMENT='' - - # Process all arguments currently available in this function - # environment. If either ARGSS or ARGSL local variables have been - # defined, argument processing goes through getopt for validation. - tcar_setModuleArguments "${@}" - - # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. - eval set -- "${TCAR_MODULE_ARGUMENT}" - - # Look for options passed through command-line. - while true; do - case "${1}" in - - --docs ) - MAILADDRS="${TCAR_BRAND}-docs@$(tcar_printUrl --domain)" - shift 1 - ;; - - --as-html-link ) - MAILADDRS="${2}" - shift 2 - ;; - - -- ) - - shift 1 - break - ;; - esac - done - - # Print mail address. - echo "${MAILADDRS}" - -} diff --git a/Scripts/tcar_printMessage.sh b/Scripts/tcar_printMessage.sh deleted file mode 100755 index 6e9914a..0000000 --- a/Scripts/tcar_printMessage.sh +++ /dev/null @@ -1,304 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_printMessage.sh -- This function standardizes the way messages -# are printed 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 tcar_printMessage { - - # Define gettext-specific variables locally, to provide - # per-function localization. - local TEXTDOMAIN="${FUNCNAME}.sh" - local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" - - local MESSAGE="${1}" - local FORMAT="${2}" - - # Verify message variable, it cannot have an empty value. - if [[ -z ${MESSAGE} ]];then - tcar_printMessage "`gettext "The message cannot be empty."`" --as-error-line - fi - - # Define message horizontal width. This is the max number of - # horizontal characters the message will use to be displayed on - # the screen. - local MESSAGE_WIDTH=66 - - # Remove empty spaces from message. - MESSAGE=$(printf %s "${MESSAGE}" | sed -r -e 's!^[[:space:]]+!!') - - # Print messages that will always be printed no matter what value - # the TCAR_FLAG_QUIET variable has. - case "${FORMAT}" in - - --as-stdout-line* ) - - local MARGIN_LEFT=15 - if [[ ${FORMAT} =~ '--as-stdout-line=[[:digit:]]+' ]];then - MARGIN_LEFT=$(echo ${FORMAT} | cut -d'=' -f2) - fi - - # Default printing format. This is the format used when no - # other specification is passed to this function. As - # convenience, we transform absolute paths into relative - # paths in order to free horizontal space on final output - # messages. - printf %s "${MESSAGE}" | sed -r \ - -e "s!${TCAR_BASEDIR}/!!g" \ - -e "s!> /!> !g" \ - -e "s!/{2,}!/!g" \ - | gawk 'BEGIN { FS=": " } - { - if ( $0 ~ /^-+$/ ) - print $0 - else - printf "%-'${MARGIN_LEFT}'s\t%s\n", $1, $2 - } - END {}' - ;; - - --as-error-line ) - - # Build the error trail. This is very useful for tracking - # the error down. - tcar_printMessage '-' --as-separator-line - tcar_printMessage "${FUNCNAME[*]}" --as-tree-line - - # Build the error message. - tcar_printMessage '-' --as-separator-line - tcar_printMessage "$(tcar_printCaller 1) ${MESSAGE}" --as-stderr-line - tcar_printMessage '-' --as-separator-line - - # Finish script execution with exit status 1 (SIGHUP) to - # imply the script finished because an error. We are - # using this as convention to finish the script execution. - # So, don't remove the following line, please. - exit 1 - ;; - - --as-debugger-line ) - if [[ ${TCAR_FLAG_DEBUG} == 'true' ]];then - tcar_printMessage "$(date +"%c") ${MESSAGE}" --as-stdout-line=60 - else - return - fi - ;; - - --as-tree-line ) - local NAME - local -a FN - for NAME in ${MESSAGE};do - FN[++((${#FN[*]}))]=${NAME} - done - local COUNT=$(( ${#FN[*]} - 2 )) - local SEPARATOR='`--' - local SPACES=0 - echo "${TCAR_SCRIPT_BASEDIR}/${TCAR_SCRIPT_NAME}" 1>&2 - while [[ ${COUNT} -gt 0 ]];do - if [[ ${COUNT} -eq $(( ${#FN[*]} - 2 )) ]];then - echo ${SEPARATOR} ${FN[${COUNT}]} 1>&2 - else - echo ${FN[${COUNT}]} \ - | gawk '{ printf "%'${SPACES}'s%s %s\n", "", "'${SEPARATOR}'", $1 }' 1>&2 - fi - COUNT=$((${COUNT} - 1)) - SPACES=$((${SPACES} + 4)) - done - ;; - - --as-toknowmore-line ) - tcar_printMessage "`gettext "To know more, run"` ${TCAR_SCRIPT_COMMAND} ${MESSAGE} --help" --as-stderr-line - ;; - - --as-yesornorequest-line ) - - # Define positive answer. - local Y="`gettext "yes"`" - - # Define negative answer. - local N="`gettext "no"`" - - # Define default answer. - local ANSWER=${N} - - if [[ ${TCAR_FLAG_YES} == 'true' ]];then - - ANSWER=${Y} - - else - - # Print the question to standard error. - tcar_printMessage "${MESSAGE} [${Y}/${N}]" --as-request-line - - # Redefine default answer based on user's input. - read ANSWER - - fi - - # Verify user's answer. Only positive answer let the - # script flow to continue. Otherwise, if something - # different from positive answer is passed, the script - # terminates its execution immediately. - if [[ ! ${ANSWER} =~ "^${Y}" ]];then - exit - fi - ;; - - --as-selection-line ) - # Create selection based on message. - local NAME='' - select NAME in ${MESSAGE};do - echo ${NAME} - break - done - ;; - - --as-response-line ) - tcar_printMessage "--> ${MESSAGE}" --as-stderr-line - ;; - - --as-request-line ) - tcar_printMessage "${MESSAGE}:\040" --as-notrailingnew-line - ;; - - --as-notrailingnew-line ) - echo -e -n "${MESSAGE}" | sed -r \ - -e "s!${TCAR_BASEDIR}/!!g" 1>&2 - ;; - - --as-stderr-line ) - echo "${MESSAGE}" | sed -r \ - -e "s!${TCAR_BASEDIR}/!!g" 1>&2 - ;; - - esac - - # Verify quiet option. The quiet option controls whether messages - # are printed or not. - if [[ "${TCAR_FLAG_QUIET}" == 'true' ]];then - return - fi - - # Print messages that will be printed only when the TCAR_FLAG_QUIET - # variable is provided to centos-art.sh script. - case "${FORMAT}" in - - --as-separator-line ) - - # Build the separator line. - MESSAGE=$(\ - until [[ ${MESSAGE_WIDTH} -eq 0 ]];do - echo -n "$(echo ${MESSAGE} | sed -r 's!(.).*!\1!')" - MESSAGE_WIDTH=$((${MESSAGE_WIDTH} - 1)) - done) - - # Draw the separator line. - echo "${MESSAGE}" 1>&2 - ;; - - --as-banner-line ) - tcar_printMessage '-' --as-separator-line - tcar_printMessage "${MESSAGE}" --as-stdout-line - tcar_printMessage '-' --as-separator-line - ;; - - --as-processing-line ) - tcar_printMessage "`gettext "Processing"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-cropping-line ) - tcar_printMessage "`gettext "Cropping from"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-tuningup-line ) - tcar_printMessage "`gettext "Tuning-up"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-checking-line ) - tcar_printMessage "`gettext "Checking"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-combining-line ) - tcar_printMessage "`gettext "Combining"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-editing-line ) - tcar_printMessage "`gettext "Editing"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-creating-line | --as-updating-line ) - if [[ -a "${MESSAGE}" ]];then - tcar_printMessage "`gettext "Updating"`: ${MESSAGE}" --as-stdout-line - else - tcar_printMessage "`gettext "Creating"`: ${MESSAGE}" --as-stdout-line - fi - ;; - - --as-deleting-line ) - tcar_printMessage "`gettext "Deleting"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-reading-line ) - tcar_printMessage "`gettext "Reading"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-savedas-line ) - tcar_printMessage "`gettext "Saved as"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-linkto-line ) - tcar_printMessage "`gettext "Linked to"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-movedto-line ) - tcar_printMessage "`gettext "Moved to"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-translation-line ) - tcar_printMessage "`gettext "Translation"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-translating-line ) - tcar_printMessage "`gettext "Translating"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-validating-line ) - tcar_printMessage "`gettext "Validating"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-template-line ) - tcar_printMessage "`gettext "Template"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-configuration-line ) - tcar_printMessage "`gettext "Configuration"`: ${MESSAGE}" --as-stdout-line - ;; - - --as-palette-line ) - tcar_printMessage "`gettext "Palette"`: ${MESSAGE}" --as-stdout-line - ;; - - esac - -} diff --git a/Scripts/tcar_printUrl.sh b/Scripts/tcar_printUrl.sh deleted file mode 100755 index ec9c7a2..0000000 --- a/Scripts/tcar_printUrl.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_printUrl.sh -- This function standardizes the way URLs are -# printed by centos-art.sh script. This function describes the -# domain organization of The CentOS Project through its URLs and -# provides a way to print them out when needed. -# -# 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 tcar_printUrl { - - local URL='' - - # Define short options. - local ARGSS='' - - # Define long options. - local ARGSL='domain,home,lists,wiki,forums,bugs,planet,docs,mirrors,projects,svn,trac,irc,cc-sharealike,with-locale,as-html-link' - - # Initialize arguments with an empty value and set it as local - # variable to this function scope. Doing this is very important to - # avoid any clash with higher execution environments. - local TCAR_MODULE_ARGUMENT='' - - # Process all arguments currently available in this function - # environment. If either ARGSS or ARGSL local variables have been - # defined, argument processing goes through getopt for validation. - tcar_setModuleArguments "${@}" - - # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. - eval set -- "${TCAR_MODULE_ARGUMENT}" - - # Look for options passed through command-line. - while true; do - case "${1}" in - - --domain ) - URL="centos.org" - shift 1 - ;; - - --home ) - URL="http://www.$(tcar_printUrl --domain)/" - shift 1 - ;; - - --lists ) - URL="http://lists.$(tcar_printUrl --domain)/" - shift 1 - ;; - - --wiki ) - URL="http://wiki.$(tcar_printUrl --domain)/" - shift 1 - ;; - - --forums ) - URL="http://forums.$(tcar_printUrl --domain)/" - shift 1 - ;; - - --bugs ) - URL="http://bugs.$(tcar_printUrl --domain)/" - shift 1 - ;; - - --projects ) - URL="https://projects.$(tcar_printUrl --domain)/" - shift 1 - ;; - - --svn ) - URL="$(tcar_printUrl --projects)svn/" - shift 1 - ;; - - --trac ) - URL="$(tcar_printUrl --projects)trac/" - shift 1 - ;; - - --planet ) - URL="http://planet.$(tcar_printUrl --domain)/" - shift 1 - ;; - - --docs ) - URL="http://docs.$(tcar_printUrl --domain)/" - shift 1 - ;; - - --mirrors ) - URL="http://mirrors.$(tcar_printUrl --domain)/" - shift 1 - ;; - - --irc ) - URL="http://$(tcar_printUrl --home)modules/tinycontent/index.php?id=8" - shift 1 - ;; - - --cc-sharealike ) - URL="http://creativecommons.org/licenses/by-sa/3.0/" - shift 1 - ;; - - --with-locale ) - if [[ ! ${LANG} =~ '^en' ]];then - URL="${URL}${TCAR_SCRIPT_LANG_LL}/" - fi - shift 1 - ;; - - --as-html-link ) - URL="${URL}" - shift 1 - ;; - - -- ) - - shift 1 - break - ;; - esac - done - - # Print Url. - echo "${URL}" - -} diff --git a/Scripts/tcar_printVersion.sh b/Scripts/tcar_printVersion.sh deleted file mode 100755 index d9c1cda..0000000 --- a/Scripts/tcar_printVersion.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_printVersion.sh -- This function standardizes the way -# centos-art.sh script prints version about itself. -# -# 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 tcar_printVersion { - - # Define gettext-specific variables locally, to provide - # per-function localization. - local TEXTDOMAIN="${FUNCNAME}.sh" - local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" - - local PROGRAM_NAME=${1:-${TCAR_SCRIPT_NAME}} - local YEAR=$(tcar_printCopyrightInfo --year) - local HOLDER=$(tcar_printCopyrightInfo --holder) - - if [[ ${PROGRAM_NAME} == ${TCAR_SCRIPT_NAME} ]];then - tcar_printMessage "${TCAR_SCRIPT_NAME} ${TCAR_SCRIPT_VERSION}" --as-stdout-line - else - tcar_printMessage "${PROGRAM_NAME} (${TCAR_SCRIPT_NAME}) ${TCAR_SCRIPT_VERSION}" --as-stdout-line - fi - tcar_printMessage "Copyright (C) ${YEAR} ${HOLDER}" --as-stdout-line - tcar_printMessage "`eval_gettext "\\\$PROGRAM_NAME comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of \\\$PROGRAM_NAME under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING."`" --as-stdout-line | fold --width=66 --spaces - - exit 0 - -} diff --git a/Scripts/tcar_setModuleArguments.sh b/Scripts/tcar_setModuleArguments.sh deleted file mode 100755 index 8926cd4..0000000 --- a/Scripts/tcar_setModuleArguments.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_setModuleArguments.sh -- This function uses getopt to process -# arguments passed to centos-art.sh script. -# -# This function works with the following three variables: -# -# ARGSS -# Stores getopt short arguments definition. -# -# ARGSL -# Stores getopt long arguments definition. -# -# TCAR_MODULE_ARGUMENT -# Stores arguments passed to functions or command-line -# interface depending the context it is defined. -# -# These three variables are not defined in this function but the -# function environment you want to provide option parsing for, -# through getopt command. Using local definition for these three -# variables let you to nest option parsing inside different -# function-environment levels. -# -# 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 tcar_setModuleArguments { - - # Define gettext-specific variables locally, to provide - # per-function localization. - local TEXTDOMAIN="${FUNCNAME}.sh" - local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" - - local ARGUMENT='' - - # Fill up arguments global variable with current positional - # parameter information. To avoid interpretation problems, use - # single quotes to enclose each argument (TCAR_MODULE_ARGUMENT) from - # command-line individually. - for ARGUMENT in "${@}"; do - - # Remove any single quote from arguments passed to - # centos-art.sh script. We will use single quotes for grouping - # option values so white space can be passed through them. - ARGUMENT=$(printf %s "${ARGUMENT}" | tr -d "'") - - # Concatenate arguments and enclose them to let getopt to - # process them when they have spaces inside. - TCAR_MODULE_ARGUMENT="${TCAR_MODULE_ARGUMENT} '${ARGUMENT}'" - - done - - # Verify non-option arguments passed to command-line. If there - # isn't any or dot is provided, redefine the TCAR_MODULE_ARGUMENT - # variable to use the current location the centos-art.sh script - # was called from. - if [[ -z "${TCAR_MODULE_ARGUMENT}" ]];then - TCAR_MODULE_ARGUMENT=${PWD} - fi - - # Verify presence of either short or long options in the - # environment. If they are present apply option validation through - # getopt. - if [[ ! -z ${ARGSS} ]] || [[ ! -z ${ARGSL} ]];then - - # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. - eval set -- "${TCAR_MODULE_ARGUMENT}" - - # Process positional parameters using getopt's option validation. - TCAR_MODULE_ARGUMENT=$(getopt -o "${ARGSS}" -l "${ARGSL}" \ - -n "${TCAR_SCRIPT_COMMAND} (${TCAR_MODULE_NAME})" -- "${@}") - - # Verify getopt's exit status and finish the script execution - # with an error message, if it failed. - if [[ $? -ne 0 ]];then - tcar_printMessage "`gettext "The argument verification failed."`" --as-error-line - fi - - fi - -} diff --git a/Scripts/tcar_setModuleEnvironment.sh b/Scripts/tcar_setModuleEnvironment.sh deleted file mode 100755 index eedc142..0000000 --- a/Scripts/tcar_setModuleEnvironment.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_setModuleEnvironment.sh -- This function initiates module -# environments inside the 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 tcar_setModuleEnvironment { - - local ARG_MODULE_NAME='' - local ARG_MODULE_TYPE='' - local ARG_MODULE_ARGS='' - - # Retrieve module's name and module's type from arguments passed - # through this function positional parameters. - OPTIND=1 - while getopts "m:,t:,g:" OPTION "${@}"; do - case "${OPTION}" in - m ) ARG_MODULE_NAME="${OPTARG}" ;; - t ) ARG_MODULE_TYPE="${OPTARG}" ;; - g ) ARG_MODULE_ARGS="${OPTARG} ${ARG_MODULE_ARGS}" ;; - esac - done - - # Clean up positional parameters to reflect the fact that options - # have been processed already. - shift $(( ${OPTIND} - 1 )) - - # Initialize module's global counter. - TCAR_MODULE_COUNT=${TCAR_MODULE_COUNT:-0} - - # When the last module in the chain of executed modules is the - # same module being currently executed, don't create a new - # position for it in the chain of modules. Instead, use the - # information it already has from its previous execution. In order - # for this to work, the current module must be executed as sibling - # module of other module or itself. - if [[ ${TCAR_MODULE_COUNT} -gt 0 ]];then - if [[ ${TCAR_MODULE_NAMES[((${TCAR_MODULE_COUNT} - 1))]} == ${ARG_MODULE_NAME} ]];then - if [[ ${ARG_MODULE_TYPE} == 'sibling' ]];then - tcar_printMessage '~~~~~~~~~~~~~~~~~~~~~~~~~> : '"${TCAR_MODULE_NAME} ${TCAR_MODULE_ARGUMENT}" --as-debugger-line - ${ARG_MODULE_NAME} ${ARG_MODULE_ARGS} ${@} - return - fi - fi - fi - - tcar_printMessage '=========================>: ['${TCAR_MODULE_COUNT}'] | '${FUNCNAME[1]} --as-debugger-line - - # Define module's base directory. This is the directory where the - # initialization script is stored in. - local TCAR_MODULE_BASEDIR=${TCAR_SCRIPT_MODULES_BASEDIR} - if [[ ${#TCAR_MODULE_BASEDIRS[*]} -gt 0 ]];then - if [[ ${ARG_MODULE_TYPE} == "parent" ]];then - TCAR_MODULE_BASEDIR=${TCAR_SCRIPT_MODULES_BASEDIR} - elif [[ ${ARG_MODULE_TYPE} == "sibling" ]];then - if [[ ${TCAR_MODULE_TYPES[((${TCAR_MODULE_COUNT} - 1 ))]} == 'sibling' ]];then - TCAR_MODULE_BASEDIR=${TCAR_MODULE_BASEDIRS[((${TCAR_MODULE_COUNT}-2))]} - else - TCAR_MODULE_BASEDIR=${TCAR_MODULE_BASEDIRS[((${TCAR_MODULE_COUNT}-1))]} - fi - else - TCAR_MODULE_BASEDIR=${TCAR_MODULE_BASEDIRS[${TCAR_MODULE_COUNT}]} - fi - fi - tcar_printMessage "TCAR_MODULE_BASEDIR : ${TCAR_MODULE_BASEDIR}" --as-debugger-line - - # Define module's name. - TCAR_MODULE_NAMES[${TCAR_MODULE_COUNT}]=$(tcar_getRepoName "${ARG_MODULE_NAME:-unknown}" "-f" | cut -d '-' -f1) - local TCAR_MODULE_NAME=${TCAR_MODULE_NAMES[${TCAR_MODULE_COUNT}]} - tcar_printMessage "TCAR_MODULE_NAME : [${TCAR_MODULE_COUNT}]=${TCAR_MODULE_NAME}" --as-debugger-line - - # Define module's type. - TCAR_MODULE_TYPES[${TCAR_MODULE_COUNT}]="${ARG_MODULE_TYPE:-parent}" - local TCAR_MODULE_TYPE=${TCAR_MODULE_TYPES[${TCAR_MODULE_COUNT}]} - tcar_printMessage "TCAR_MODULE_TYPE : ${TCAR_MODULE_TYPE}" --as-debugger-line - - # Define module's arguments. This variable is used in different - # module environments to pass positional parameters from one - # environment to another using local definitions. - TCAR_MODULE_ARGUMENTS[${TCAR_MODULE_COUNT}]="${ARG_MODULE_ARGS:-} ${@}" - local TCAR_MODULE_ARGUMENT=${TCAR_MODULE_ARGUMENTS[${TCAR_MODULE_COUNT}]} - tcar_printMessage "TCAR_MODULE_ARGUMENT : ${TCAR_MODULE_ARGUMENT}" --as-debugger-line - - # Check module's name possible values. - tcar_checkModuleName - - # Define module's directory. - TCAR_MODULE_DIRS[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_BASEDIR}/$(tcar_getRepoName "${TCAR_MODULE_NAME}" "-d") - local TCAR_MODULE_DIR=${TCAR_MODULE_DIRS[${TCAR_MODULE_COUNT}]} - tcar_printMessage "TCAR_MODULE_DIR : ${TCAR_MODULE_DIR}" --as-debugger-line - - # Define module's directories not reused from module's parent - # directory structure. - TCAR_MODULE_DIRS_MODULES[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIR}/Modules - local TCAR_MODULE_DIR_MODULES=${TCAR_MODULE_DIRS_MODULES[${TCAR_MODULE_COUNT}]} - tcar_printMessage "TCAR_MODULE_DIR_MODULES : ${TCAR_MODULE_DIR_MODULES}" --as-debugger-line - - TCAR_MODULE_DIRS_CONFIGS[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIR}/Configs - local TCAR_MODULE_DIR_CONFIGS=${TCAR_MODULE_DIRS_CONFIGS[${TCAR_MODULE_COUNT}]} - tcar_printMessage "TCAR_MODULE_DIR_CONFIGS : ${TCAR_MODULE_DIR_CONFIGS}" --as-debugger-line - - # Define module's directories reused from module's parent - # directory structure. - TCAR_MODULE_DIRS_MANUALS[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIRS[0]}/Manuals - local TCAR_MODULE_DIR_MANUALS=${TCAR_MODULE_DIRS_MANUALS[${TCAR_MODULE_COUNT}]} - tcar_printMessage "TCAR_MODULE_DIR_MANUALS : ${TCAR_MODULE_DIR_MANUALS}" --as-debugger-line - - TCAR_MODULE_DIRS_LOCALES[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIRS[0]}/Locales - local TCAR_MODULE_DIR_LOCALES=${TCAR_MODULE_DIRS_LOCALES[${TCAR_MODULE_COUNT}]} - tcar_printMessage "TCAR_MODULE_DIR_LOCALES : ${TCAR_MODULE_DIR_LOCALES}" --as-debugger-line - - # Define module's initialization file. - TCAR_MODULE_INIT_FILES[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIR}/${TCAR_MODULE_NAME}.sh - local TCAR_MODULE_INIT_FILE=${TCAR_MODULE_INIT_FILES[${TCAR_MODULE_COUNT}]} - tcar_printMessage "TCAR_MODULE_INIT_FILE : ${TCAR_MODULE_INIT_FILE}" --as-debugger-line - - # Define module's connection with their localization files. It is - # required that gettext-specific variables be defined locally, in - # order to implement per-module localization. - local TEXTDOMAIN=$(basename ${TCAR_MODULE_INIT_FILE}) - tcar_printMessage "TEXTDOMAIN: ${TEXTDOMAIN}" --as-debugger-line - local TEXTDOMAINDIR=${TCAR_MODULE_DIR_LOCALES} - tcar_printMessage "TEXTDOMAINDIR: ${TEXTDOMAINDIR}" --as-debugger-line - - # Increment module's counter just before creating next module's - # base directory. - TCAR_MODULE_COUNT=$(( ${TCAR_MODULE_COUNT} + 1 )) - - # Define next module's base directory. - TCAR_MODULE_BASEDIRS[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIR_MODULES} - - # Check function script execution rights. - tcar_checkFiles -ex ${TCAR_MODULE_INIT_FILE} - - # Load module-specific (function) scripts into current execution - # environment. Keep the tcar_setModuleEnvironmentScripts function - # call after all variables and arguments definitions. - tcar_setModuleEnvironmentScripts - - # Execute module's initialization script with its arguments. - tcar_printMessage '-------------------------> : '"${TCAR_MODULE_NAME} ${TCAR_MODULE_ARGUMENT}" --as-debugger-line - ${TCAR_MODULE_NAME} ${TCAR_MODULE_ARGUMENT} - - # Unset module-specific environment. - tcar_printMessage '<------------------------- : '"${TCAR_MODULE_NAME} ${TCAR_MODULE_ARGUMENT}" --as-debugger-line - tcar_unsetModuleEnvironment - - # Decrement module counter just after unset unused module - # environments. - TCAR_MODULE_COUNT=$(( ${TCAR_MODULE_COUNT} - 1 )) - - # Unset array and non-array variables used in this function. - if [[ ${TCAR_MODULE_COUNT} -eq 0 ]];then - unset TCAR_MODULE_NAMES - unset TCAR_MODULE_BASEDIRS - unset TCAR_MODULE_DIRS - unset TCAR_MODULE_DIRS_MODULES - unset TCAR_MODULE_DIRS_MANUALS - unset TCAR_MODULE_DIRS_LOCALES - unset TCAR_MODULE_DIRS_CONFIGS - unset TCAR_MODULE_NAME - unset TCAR_MODULE_DIR - unset TCAR_MODULE_DIR_MODULES - unset TCAR_MODULE_DIR_MANUALS - unset TCAR_MODULE_DIR_LOCALES - unset TCAR_MODULE_DIR_CONFIGS - fi - - tcar_printMessage '<=========================: ['${TCAR_MODULE_COUNT}'] | '${FUNCNAME[1]} --as-debugger-line - -} diff --git a/Scripts/tcar_setModuleEnvironmentScripts.sh b/Scripts/tcar_setModuleEnvironmentScripts.sh deleted file mode 100755 index 270d246..0000000 --- a/Scripts/tcar_setModuleEnvironmentScripts.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_setModuleEnvironmentScripts.sh -- This function standardizes -# the way specific functionalities are exported to centos-art.sh -# script environment. -# -# 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 tcar_setModuleEnvironmentScripts { - - # Define gettext-specific variables locally, to provide - # per-function localization. - local TEXTDOMAIN="${FUNCNAME}.sh" - local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" - - # Define the pattern used to retrieve function names from function - # files. - local FUNCTION_PATTERN="^function[[:space:]]+${TCAR_MODULE_NAME}(_[[:alnum:]]+)?[[:space:]]+{[[:space:]]*$" - - # Define the list of files. - local TCAR_MODULE_SCRIPT='' - local TCAR_MODULE_SCRIPTS="${TCAR_MODULE_INIT_FILE}" - if [[ -d ${TCAR_MODULE_DIR} ]];then - TCAR_MODULE_SCRIPTS="${TCAR_MODULE_SCRIPTS} - $(tcar_getFilesList ${TCAR_MODULE_DIR} \ - --pattern="${TCAR_MODULE_DIR}/${TCAR_MODULE_NAME}_[[:alnum:]]+\.sh$" --type='f')" - fi - - # Verify the list of files. If no function file exists for the - # location specified stop the script execution. Otherwise the - # script will surely try to execute a function that haven't been - # exported yet and report an error about it. - if [[ -z ${TCAR_MODULE_SCRIPTS} ]];then - tcar_printMessage "${FUNCNAME}: `gettext "No function file was found."`" --as-error-line - fi - - # Process the list of files. - for TCAR_MODULE_SCRIPT in ${TCAR_MODULE_SCRIPTS};do - - # Verify the execution rights for function file. - tcar_checkFiles -ex ${TCAR_MODULE_SCRIPT} - - # Retrieve the function's name from function's file. - local TCAR_MODULE_SCRIPT_FN=$(egrep "${FUNCTION_PATTERN}" ${TCAR_MODULE_SCRIPT} \ - | gawk '{ print $2 }') - - # Verify function's name. It cannot be an empty value. - if [[ -z "${TCAR_MODULE_SCRIPT_FN}" ]];then - tcar_printMessage "`gettext "No function definition found."`" --as-error-line - fi - - # Verify that function files have not been already exported. - # If they have been already exported don't export them again. - # Instead, continue with the next function file in the list. - declare -F | gawk '{ print $3 }' | egrep "^${TCAR_MODULE_SCRIPT}$" > /dev/null - if [[ $? -eq 0 ]];then - continue - fi - - # Initialize the function file. - . ${TCAR_MODULE_SCRIPT} - - # Export the function names inside the file to current shell - # script environment. - export -f ${TCAR_MODULE_SCRIPT_FN} - - tcar_printMessage "export -f : ${TCAR_MODULE_SCRIPT_FN}" --as-debugger-line - - done - -} diff --git a/Scripts/tcar_setTranslationMarkers.sh b/Scripts/tcar_setTranslationMarkers.sh deleted file mode 100755 index 1ec018e..0000000 --- a/Scripts/tcar_setTranslationMarkers.sh +++ /dev/null @@ -1,185 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_setTranslationMarkers.sh -- This function standardizes construction -# of translation markers and their related expansion. As convention, -# translation markers must be set inside source files (e.g., -# Docbook, Svg, etc.) and expanded inside temporal instances used to -# produce final contents. -# -# 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 tcar_setTranslationMarkers { - - # Initialize variables. - local -a SRC - local -a DST - local COUNT=0 - local COUNTSRC=0 - local COUNTDST=0 - - # Define source location on which sed replacements take place. - local LOCATION="${1}" - - # Verify that source location does exist. - tcar_checkFiles -ef ${LOCATION} - - # Define copyright translation markers. - SRC[((++${#SRC[*]}))]='=COPYRIGHT_YEAR_FIRST=' - DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --first-year)" - SRC[((++${#SRC[*]}))]='=COPYRIGHT_YEAR(_LAST)?=' - DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --year)" - SRC[((++${#SRC[*]}))]='=COPYRIGHT_YEAR(S)?_LIST=' - DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --years-list)" - SRC[((++${#SRC[*]}))]='=COPYRIGHT_HOLDER=' - DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --holder)" - SRC[((++${#SRC[*]}))]='=COPYRIGHT_HOLDER_PREDICATE=' - DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --holder-predicate)" - - # Define license translation markers. - SRC[((++${#SRC[*]}))]='=LICENSE=' - DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --license)" - SRC[((++${#SRC[*]}))]='=LICENSE_URL=' - DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --license-url)" - - # Define theme translation markers. - SRC[((++${#SRC[*]}))]='=THEME=' - DST[((++${#DST[*]}))]="$(tcar_getPathComponent ${RENDER_TARGET} --motif)" - SRC[((++${#SRC[*]}))]='=THEMENAME=' - DST[((++${#DST[*]}))]="$(tcar_getPathComponent ${RENDER_TARGET} --motif-name)" - SRC[((++${#SRC[*]}))]='=THEMERELEASE=' - DST[((++${#DST[*]}))]="$(tcar_getPathComponent ${RENDER_TARGET} --motif-version)" - - # Define url translation markers. - SRC[((++${#SRC[*]}))]='=URL=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--home' '--with-locale') - SRC[((++${#SRC[*]}))]='=URL_WIKI=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--wiki' '--with-locale') - SRC[((++${#SRC[*]}))]='=URL_LISTS=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--lists' '--with-locale') - SRC[((++${#SRC[*]}))]='=URL_FORUMS=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--forums' '--with-locale') - SRC[((++${#SRC[*]}))]='=URL_MIRRORS=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--mirrors' '--with-locale') - SRC[((++${#SRC[*]}))]='=URL_DOCS=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--docs' '--with-locale') - SRC[((++${#SRC[*]}))]='=URL_PROJECTS=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--projects' '--with-locale') - SRC[((++${#SRC[*]}))]='=URL_BUGS=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--bugs' '--with-locale') - SRC[((++${#SRC[*]}))]='=URL_SVN=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--svn' '--with-locale') - SRC[((++${#SRC[*]}))]='=URL_TRAC=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--trac' '--with-locale') - SRC[((++${#SRC[*]}))]='=URL_PLANET=' - DST[((++${#DST[*]}))]=$(tcar_printUrl '--planet' '--with-locale') - - # Define release translation markers. - SRC[((++${#SRC[*]}))]='=RELEASE=' - DST[((++${#DST[*]}))]=${RELEASE} - SRC[((++${#SRC[*]}))]='=MAJOR_RELEASE=' - DST[((++${#DST[*]}))]=${MAJOR_RELEASE} - - # Define emails translation markers. - SRC[((++${#SRC[*]}))]='=MAIL_DOCS=' - DST[((++${#DST[*]}))]="$(tcar_printMailingList --docs)" - - # Define locale translation markers. - SRC[((++${#SRC[*]}))]='=LOCALE=' - DST[((++${#DST[*]}))]="${TCAR_SCRIPT_LANG_LC}" - SRC[((++${#SRC[*]}))]='=LOCALE_LL=' - DST[((++${#DST[*]}))]="${TCAR_SCRIPT_LANG_LL}" - SRC[((++${#SRC[*]}))]='=LOCALE_CC=' - DST[((++${#DST[*]}))]="${TCAR_SCRIPT_LANG_CC}" - - # Define domain translation markers for domains. - SRC[((++${#SRC[*]}))]='=DOMAIN_LL=' - if [[ ! ${TCAR_SCRIPT_LANG_LL} =~ '^en' ]];then - DST[((++${#DST[*]}))]="${TCAR_SCRIPT_LANG_LL}" - else - DST[((++${#DST[*]}))]="" - fi - - # Define repository translation markers. - SRC[((++${#SRC[*]}))]='=(REPO_TLDIR|REPO_HOME|TCAR_BASEDIR|TCAR_WORKDIR)=' - DST[((++${#DST[*]}))]="${TCAR_BASEDIR}" - - # 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 - - # Remove escaped character from translation markers. This is one - # of the reasons why translation marker should be expanded in - # source files instances not the source files themselves. - # Escaping translation markers provides a way of talking about - # them without expanding them. - sed -r -i 's/(=)\\([A-Z_]+=)/\1\2/g' ${LOCATION} - - # Unset specific translation markers and specific replacement - # variables in order to clean them up. Otherwise, undesired values - # may remain from one file to another. - unset SRC - unset DST - -} diff --git a/Scripts/tcar_synchronizeRepoChanges.sh b/Scripts/tcar_synchronizeRepoChanges.sh deleted file mode 100755 index 0d87a38..0000000 --- a/Scripts/tcar_synchronizeRepoChanges.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_synchronizeRepoChanges.sh -- This function standardizes the -# way changes are synchronized between the working copy and the -# central repository. This function is an interface to the Svn -# functionality of the 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 tcar_synchronizeRepoChanges { - - # Verify synchronization flag. - if [[ ${FLAG_SYNCHRONIZE} != 'true' ]];then - return - fi - - # Verify existence of locations passed to this function. - tcar_checkFiles -e ${@} - - # Synchronize changes. - tcar_setModuleEnvironment vcs --synchronize ${@} - -} diff --git a/Scripts/tcar_terminateScriptExecution.sh b/Scripts/tcar_terminateScriptExecution.sh deleted file mode 100755 index 0f95ace..0000000 --- a/Scripts/tcar_terminateScriptExecution.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_terminateScriptExecution.sh -- This function standardizes the -# actions that must be realized just before leaving the script -# execution (e.g., cleaning temporal files). This function is the -# one called when interruption signals like EXIT, SIGHUP, SIGINT and -# SIGTERM are detected. -# -# 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 tcar_terminateScriptExecution { - - # Remove temporal directory. - rm -r ${TCAR_SCRIPT_TEMPDIR} - - # NOTE: Don't specify an exit status here. As convenction we do - # this when error messages are triggerd. See `--as-error-line' - # option from `tcar_printMessage' functionality. - -} diff --git a/Scripts/tcar_unsetModuleEnvironment.sh b/Scripts/tcar_unsetModuleEnvironment.sh deleted file mode 100755 index 69d3ae3..0000000 --- a/Scripts/tcar_unsetModuleEnvironment.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar_unsetModuleEnvironment.sh -- This function unsets -# functionalities from centos-art.sh script execution environment. -# -# 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 tcar_unsetModuleEnvironment { - - # Define gettext-specific variables locally, to provide - # per-function localization. - local TEXTDOMAIN="${FUNCNAME}.sh" - local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" - - # Verify suffix value used to retrieve function files. - if [[ -z ${TCAR_MODULE_NAME} ]];then - tcar_printMessage "`gettext "The export id was not provided."`" --as-error-line - fi - - # Define list of format-specific functionalities. This is the list - # of function definitions previously exported by - # `tcar_setModuleEnvironmentScripts'. Be sure to limit the list - # to function names that start with the suffix specified only. - local TCAR_MODULE_SCRIPT_FN='' - local TCAR_MODULE_SCRIPT_FNS=$(declare -F | gawk '{ print $3 }' | egrep "^${TCAR_MODULE_NAME}") - - # Unset function names from current execution environment. - for TCAR_MODULE_SCRIPT_FN in ${TCAR_MODULE_SCRIPT_FNS};do - unset -f ${TCAR_MODULE_SCRIPT_FN} - tcar_printMessage "unset -f : ${TCAR_MODULE_SCRIPT_FN}" --as-debugger-line - done - -} diff --git a/tcar.sh b/tcar.sh index 16b4532..39e6f58 100755 --- a/tcar.sh +++ b/tcar.sh @@ -43,11 +43,8 @@ declare -xr TCAR_BASEDIR=/usr/share/tcar # customized later by the user. declare -xr TCAR_WORKDIR=/tmp -# Base directory where repository automation scripts are installed in. -declare -xr TCAR_SCRIPT_BASEDIR=${TCAR_BASEDIR}/scripts - # Base directory where automation script modules are installed in. -declare -xr TCAR_SCRIPT_MODULES_BASEDIR=${TCAR_SCRIPT_BASEDIR}/modules +declare -xr TCAR_SCRIPT_MODULES_BASEDIR=${TCAR_BASEDIR}/modules # Directory to store temporal files. declare -xr TCAR_SCRIPT_TEMPDIR=$(mktemp -p /tmp -d ${TCAR_SCRIPT_NAME}-XXXXXX) @@ -126,7 +123,7 @@ declare -x TCAR_FLAG_DEBUG='false' ###################################################################### # Export script's environment functions. -for SCRIPT_FILE in $(ls ${TCAR_SCRIPT_BASEDIR}/Scripts/*.sh);do +for SCRIPT_FILE in $(ls ${TCAR_BASEDIR}/tcar_*.sh);do if [[ -x ${SCRIPT_FILE} ]];then . ${SCRIPT_FILE} export -f $(grep '^function ' ${SCRIPT_FILE} | cut -d' ' -f2) diff --git a/tcar_checkFiles.sh b/tcar_checkFiles.sh new file mode 100755 index 0000000..97aa0f0 --- /dev/null +++ b/tcar_checkFiles.sh @@ -0,0 +1,157 @@ +#!/bin/bash +###################################################################### +# +# tcar_checkFiles.sh -- This function standardizes the way file +# conditional expressions are applied to files. Here is where +# centos-art.sh script answers questions like: is the file a regular +# file or a directory? Or, is it a symbolic link? Or even, does it +# have execution rights, etc. If the verification fails somehow at +# any point, an error message is output and centos-art.sh script +# finishes its execution. +# +# 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 tcar_checkFiles { + + # Define gettext-specific variables locally, to provide + # per-function localization. + local TEXTDOMAIN="${FUNCNAME}.sh" + local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" + + # Initialize local array variables. + local -a CONDITION_COMMAND + local -a CONDITION_PATTERN + local -a CONDITION_MESSAGE + + # Initialize local counter. + local COUNTER=0 + + OPTIND=1 + while getopts "i:,r,m:,n,d,e,f,h,x" OPTION "${@}"; do + + case "${OPTION}" in + + d ) + CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/test' + CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-d' + CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "isn't a directory."`" + ;; + + e ) + CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/test' + CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-e' + CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "doesn't exist."`" + ;; + + f ) + CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/test' + CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-f' + CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "isn't a regular file."`" + ;; + + h ) + CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/test' + CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-h' + CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "isn't a symbolic link."`" + ;; + + x ) + CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/test' + CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-x' + CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "isn't an executable file."`" + ;; + + i ) + local MIME=${OPTARG} + CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='/usr/bin/file' + CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]='-bi' + CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`eval_gettext "isn't a \\\"\\\$MIME\\\" file."`" + ;; + + m ) + CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]='match' + CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]="${OPTARG}" + CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "doesn't match its pattern."`" + ;; + + n ) + CONDITION_COMMAND[((++${#CONDITION_COMMAND[*]}))]="/bin/rpm" + CONDITION_PATTERN[((++${#CONDITION_PATTERN[*]}))]="-q --quiet" + CONDITION_MESSAGE[((++${#CONDITION_MESSAGE[*]}))]="`gettext "isn't installed in the system."`" + ;; + + esac + done + + # Clean up positional parameters to reflect the fact that options + # have been processed already. + shift $(( ${OPTIND} - 1 )) + + # Define list of files we want to apply verifications to, now that + # all option-like arguments have been removed from positional + # parameters list so we are free to go with the verifications. + local FILE='' + local FILES=${@} + + # Verify existence of files to prevent centos-art.sh script from + # using the current location in cases when it shouldn't (e.g., + # here it is expecting a list of files to process.). + if [[ -z ${FILES} ]];then + tcar_printMessage "`gettext "No file for processing found."`" --as-error-line + fi + + for FILE in ${FILES};do + + until [[ ${COUNTER} -eq ${#CONDITION_PATTERN[*]} ]];do + + case ${CONDITION_COMMAND[${COUNTER}]} in + + "/usr/bin/test" | "/bin/rpm" ) + ${CONDITION_COMMAND[${COUNTER}]} ${CONDITION_PATTERN[${COUNTER}]} ${FILE} \ + || tcar_printMessage "${FILE} ${CONDITION_MESSAGE[${COUNTER}]}" --as-error-line + ;; + + "/usr/bin/file" ) + if [[ ! $(${CONDITION_COMMAND[${COUNTER}]} ${CONDITION_PATTERN[${COUNTER}]} ${FILE}) =~ "^${MIME}" ]];then + tcar_printMessage "${FILE} ${CONDITION_MESSAGE[${COUNTER}]}" --as-error-line + fi + ;; + + "match" ) + if [[ ! ${FILE} =~ "${CONDITION_PATTERN[${COUNTER}]}" ]];then + tcar_printMessage "${FILE} ${CONDITION_MESSAGE[${COUNTER}]}" --as-error-line + fi + ;; + + * ) + tcar_printMessage "`gettext "The condition command provided isn't supported."`" --as-error-line + ;; + + esac + + COUNTER=$((${COUNTER} + 1)) + + done + + done + +} diff --git a/tcar_checkModuleName.sh b/tcar_checkModuleName.sh new file mode 100755 index 0000000..c93a7d3 --- /dev/null +++ b/tcar_checkModuleName.sh @@ -0,0 +1,38 @@ +#!/bin/bash +###################################################################### +# +# tcar_checkModuleName.sh -- This function uses the module's based +# directory to verify whether child and sibling modules do exist or +# not. +# +# 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 tcar_checkModuleName { + + local TCAR_MODULE_LIST=$(ls ${TCAR_MODULE_BASEDIR} | tr '\n' '|' \ + | sed -r 's/\|$//' | tr '[[:upper:]]' '[[:lower:]]') + + tcar_checkFiles -m "^(${TCAR_MODULE_LIST})$" "${TCAR_MODULE_NAME}" + + tcar_printMessage "TCAR_MODULE_LIST : ${TCAR_MODULE_LIST}" --as-debugger-line + +} diff --git a/tcar_checkRepoDirSource.sh b/tcar_checkRepoDirSource.sh new file mode 100755 index 0000000..05febd7 --- /dev/null +++ b/tcar_checkRepoDirSource.sh @@ -0,0 +1,100 @@ +#!/bin/bash +###################################################################### +# +# tcar_checkRepoDirSource.sh -- This function standardizes the path +# construction of directories inside the working copy, using +# absolute paths. This function transforms relative paths passed as +# non-option arguments to centos-art.sh script command-line into +# absolute paths inside the working copy, based on whether you are +# using Subversion or Git as version control system. Further +# verifications, (e.g., whether they really exist as directories +# inside the working copy or not) should be realized outside this +# function. +# +# Use this function whenever you want to be sure non-option +# arguments passed to centos-art.sh script command-line do always +# point to directories inside the working copy. Transforming +# relative paths into absolute paths, before processing them, is +# very useful when you need to execute the centos-art.sh script as +# command (e.g., `centos-art') anywhere on your workstation. +# +# 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 tcar_checkRepoDirSource { + + # Define gettext-specific variables locally, to provide + # per-function localization. + local TEXTDOMAIN="${FUNCNAME}.sh" + local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" + + local LOCATION=${1} + + # Remove any dot from arguments passed to centos-art.sh script. + # This way it is possible to use a single dot to reflect the + # current location from which centos-art.sh was executed. Notice + # that using a dot as argument is optional (e.g.: when you pass no + # argument to centos-art command-line, the current location is + # used as default location). However, it might be useful to use a + # dot as argument when you want to include the current location in + # a list of arguments to process. Don't forget that dot slash can + # be used to refer locations relatively. + LOCATION=$(echo "${LOCATION}" | sed -r "s,^\.(/([[:alnum:]_/.-]+)?)?$,$(pwd)\1,g") + + # Remove the path to repository's base directory from location in + # order to avoid path duplications here. + LOCATION=$(echo "${LOCATION}" | sed "s,${TCAR_BASEDIR}/,,g") + + # When we use Git as version control system, there isn't a need of + # using the `trunk', `branches', `tags' convention we were using + # for Subversion. The working copy begins directly with the + # content of our repository (e.g., Documentation, Scripts, + # Identity and Locales). + # + # When we use Subversion as version control system, we follow the + # `trunk', `branches', `tags' convention to organize files inside + # the repository and need to redefine the source path in order to + # build the repository absolute path from the repository top level + # on. As convention, when you prepare your working copy through + # centos-art.sh script, the absolute path to the `trunk/' + # directory is used as working copy. This is, path arguments + # provided to centos-art.sh script will be interpreted from trunk/ + # directory level on. For example, the following command should + # work correctly in both Subversion and Git repositories: + # + # centos-art render Documentation/Manuals/Docbook/Tcar-ug + # + # There isn't a need of verifying the paths built here. This is + # something we do later, using the tcar_checkFiles function. We + # don't do the file verification here to avoid malformed error + # messages when we reassign variable values using this function as + # reference (e.g., in order to prevent error messages from being + # stored inside variables.). + LOCATION=${TCAR_BASEDIR}/${LOCATION} + + # Remove trailing slashes passed as argument. The single slash + # form is used to refer the repository's root directory. The + # single slash form passed as argument of centos-art.sh script is + # useful to execute commands over the + # entire repository tree. + echo "${LOCATION}" | sed -r -e 's,/+,/,g' -e 's,/+$,,g' + +} diff --git a/tcar_getConfigLines.sh b/tcar_getConfigLines.sh new file mode 100755 index 0000000..6c52553 --- /dev/null +++ b/tcar_getConfigLines.sh @@ -0,0 +1,64 @@ +#!/bin/bash +###################################################################### +# +# tcar_getConfigLines.sh -- This function standardizes the way +# configuration lines are retrieved form configuration files. As +# arguments, the configuration file absolute path, the configuration +# section name, and the configuration option name must be provided. +# +# 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 tcar_getConfigLines { + + # Initialize absolute path to configuration file. + local CONFIGURATION_FILE="${1}" + + # Initialize configuration section name where the variable value + # we want to to retrieve is set in. + local CONFIGURATION_SECTION="${2}" + + # Initialize variable name we want to retrieve value from. + local CONFIGURATION_OPTION="${3}" + + # Verify configuration variable name. When no variable name is + # provided print all configuration lines that can be considered as + # well-formed paths. Be sure configuration variable name starts + # just at the beginning of the line. + if [[ ! ${CONFIGURATION_OPTION} =~ '^[[:alnum:]_./-]+$' ]];then + CONFIGURATION_OPTION='[[:alnum:]_./-]+[[:space:]]*=' + fi + + # Retrieve configuration lines from configuration file. Don't sort + # the value of this value so as to preserve the order given in the + # configuration file. This is important because configuration + # files are being used for setting render-from priorities. + local CONFIGURATION_LINES=$(cat ${CONFIGURATION_FILE} \ + | egrep -v '^#' \ + | egrep -v '^[[:space:]]*$' \ + | sed -r -n "/^\[${CONFIGURATION_SECTION}\][[:space:]]*$/,/^\[/p" \ + | egrep -v '^\[' \ + | egrep "^${CONFIGURATION_OPTION}") + + # Output value related to variable name. + echo "${CONFIGURATION_LINES}" + +} diff --git a/tcar_getConfigSectionNames.sh b/tcar_getConfigSectionNames.sh new file mode 100755 index 0000000..8da1206 --- /dev/null +++ b/tcar_getConfigSectionNames.sh @@ -0,0 +1,51 @@ +#!/bin/bash +###################################################################### +# +# tcar_getConfigSectionNames.sh -- This function standardizes the way +# section names are retrieved from configuration files. Once section +# names are retrieved they are printed to standard output for +# further 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 tcar_getConfigSectionNames { + + # Define absolute path to configuration file we want to retrieve + # section names from. + local CONFIGURATION_FILE=${1} + + # Verify existence of configuration file. + tcar_checkFiles -ef ${CONFIGURATION_FILE} + + # Define regular expression pattern used to retrieve section names + # from configuration files. Don't permit any regular expression + # meta-character either. + local CONFIGURATION_SECTION_REGEX='^\[[[:alnum:]_.-]+\][[:space:]]*$' + + # Output all section names without brackets, one per line. Don't + # permit any kind of expansion here. Section names are used as + # reference to retrieve information from configuration file, + # expanding them would create different points of verifications. + egrep ${CONFIGURATION_SECTION_REGEX} ${CONFIGURATION_FILE} \ + | sed -r 's,\[(.+)\],\1,' + +} diff --git a/tcar_getConfigValue.sh b/tcar_getConfigValue.sh new file mode 100755 index 0000000..9b2f32f --- /dev/null +++ b/tcar_getConfigValue.sh @@ -0,0 +1,51 @@ +#!/bin/bash +###################################################################### +# +# tcar_getConfigValue.sh -- This function standardizes the way +# configuration values are retrieved from configuration files. As +# arguments, the configuration file absolute path, the configuration +# section name, and the configuration option name must be provided. +# +# 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 tcar_getConfigValue { + + local CONFIGURATION_FILE="${1}" + + local CONFIGURATION_SECTION="${2}" + + local CONFIGURATION_OPTION="${3}" + + local CONFIGURATION_LINES=$(tcar_getConfigLines \ + "${CONFIGURATION_FILE}" "${CONFIGURATION_SECTION}" "${CONFIGURATION_OPTION}") + + for CONFIGURATION_LINE in "${CONFIGURATION_LINES}";do + + local CONFIGURATION_VALUE=$(echo "${CONFIGURATION_LINE}" \ + | cut -d= -f2- | sed -r -e 's/"//g' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + + eval echo ${CONFIGURATION_VALUE} + + done + + +} diff --git a/tcar_getFileExtension.sh b/tcar_getFileExtension.sh new file mode 100755 index 0000000..b00cb26 --- /dev/null +++ b/tcar_getFileExtension.sh @@ -0,0 +1,32 @@ +#!/bin/bash +###################################################################### +# +# tcar_getFileExtension.sh -- This function retrieves the extension +# of a file. +# +# 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 tcar_getFileExtension { + + basename ${1} | sed -r 's/.+\.([[:alnum:]]+)$/\1/' + +} diff --git a/tcar_getFileName.sh b/tcar_getFileName.sh new file mode 100755 index 0000000..99bfb76 --- /dev/null +++ b/tcar_getFileName.sh @@ -0,0 +1,31 @@ +#!/bin/bash +###################################################################### +# +# tcar_getFileName.sh -- This function retrieves the name of a file. +# +# 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 tcar_getFileName { + + basename ${1} | sed -r 's/\.([[:alnum:]]+)$//' + +} diff --git a/tcar_getFilesList.sh b/tcar_getFilesList.sh new file mode 100755 index 0000000..6bd611a --- /dev/null +++ b/tcar_getFilesList.sh @@ -0,0 +1,125 @@ +#!/bin/bash +###################################################################### +# +# tcar_getFilesList.sh -- This function standardizes the way list of +# files are built inside centos-art.sh script. This function outputs +# a sorted and unique list of files based on the options and +# locations passed as argument. +# +# 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 tcar_getFilesList { + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='pattern:,mindepth:,maxdepth:,type:,uid:' + + # Initialize pattern used to reduce the find output. + local PATTERN="${TCAR_FLAG_FILTER}" + + # Initialize options used with find command. + local OPTIONS='' + + # Initialize arguments with an empty value and set it as local + # variable to this function scope. Doing this is very important to + # avoid any clash with higher execution environments. + local TCAR_MODULE_ARGUMENT='' + + # Process all arguments currently available in this function + # environment. If either ARGSS or ARGSL local variables have been + # defined, argument processing goes through getopt for validation. + tcar_setModuleArguments "${@}" + + # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. + eval set -- "${TCAR_MODULE_ARGUMENT}" + + while true;do + case "${1}" in + + --pattern ) + PATTERN="${2}" + shift 2 + ;; + + --maxdepth ) + OPTIONS="${OPTIONS} -maxdepth ${2}" + shift 2 + ;; + + --mindepth ) + OPTIONS="${OPTIONS} -mindepth ${2}" + shift 2 + ;; + + --type ) + OPTIONS="${OPTIONS} -type ${2}" + shift 2 + ;; + + --uid ) + OPTIONS="${OPTIONS} -uid ${2}" + shift 2 + ;; + + -- ) + shift 1 + break + ;; + esac + done + + # At this point all options arguments have been processed and + # removed from positional parameters. Only non-option arguments + # remain so we use them as source location for find command to + # look files for. + + # Verify that locations does exist. + tcar_checkFiles -e ${@} + + # Redefine pattern as regular expression. 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 we are using. Doing so, every time we pass the `--filter' + # option in the command-line could 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. Do not use locations + # as part of regular expression so it could be possible to use + # path expansion. Using path expansion reduce the amount of + # places to find out things and so the time required to finish the + # task. + # + # Don't do such path expansion here. Instead, do it when you call + # this function. Otherwise you would be prohibiting the + # application of exact patterns. + #PATTERN="^/.*${PATTERN}$" + + # Define list of files to process. At this point we cannot verify + # whether the location is a directory or a file since path + # expansion could be introduced to it. The best we can do is + # verifying exit status and go on. + find ${@} -regextype posix-egrep ${OPTIONS} -regex "${PATTERN}" | sort | uniq + +} diff --git a/tcar_getPathComponent.sh b/tcar_getPathComponent.sh new file mode 100755 index 0000000..d006768 --- /dev/null +++ b/tcar_getPathComponent.sh @@ -0,0 +1,141 @@ +#!/bin/bash +###################################################################### +# +# tcar_getPathComponent.sh -- This function standardizes the way +# directory structures are organized inside the working copy of +# CentOS Artwork Repository. You can use this function to retrieve +# information from paths (e.g., releases, architectures and theme +# artistic motifs) or the patterns used to build the paths. +# +# 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 tcar_getPathComponent { + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='release,release-major,release-minor,release-pattern,architecture,architecture-pattern,motif,motif-name,motif-version,motif-pattern,repo-dir' + + # Define release pattern. + local VERSION="(([[:digit:]]+)(\.([[:digit:]]+))?)" + + # Define architecture pattern. Make it match the architectures the + # CentOS distribution is able to be installed on. + local ARCHITECTURE="(i386|x86_64)" + + # Define regular expression pattern that match the theme artistic + # motif component inside the path strings. + local THEME_MOTIF="Themes/Motifs/(([[:alnum:]]+)/(${VERSION}))" + + # Initialize arguments with an empty value and set it as local + # variable to this function scope. Doing this is very important to + # avoid any clash with higher execution environments. + local TCAR_MODULE_ARGUMENT='' + + # Process all arguments currently available in this function + # environment. If either ARGSS or ARGSL local variables have been + # defined, argument processing goes through getopt for validation. + tcar_setModuleArguments "${@}" + + # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. + eval set -- "${TCAR_MODULE_ARGUMENT}" + + # Define location we want to apply verifications to. + local LOCATION=$(echo ${@} | sed -r 's!^.*--[[:space:]](.+)$!\1!') + + # Look for options passed through positional parameters. + while true;do + + case "${1}" in + + --release ) + echo "${LOCATION}" | egrep "${VERSION}" | sed -r "s!.*/${VERSION}/.*!\1!" + shift 1 + break + ;; + + --release-major ) + echo "${LOCATION}" | egrep "${VERSION}" | sed -r "s!.*/${VERSION}/.*!\2!" + shift 1 + break + ;; + + --release-minor ) + echo "${LOCATION}" | egrep "${VERSION}" | sed -r "s!.*/${VERSION}/.*!\4!" + shift 1 + break + ;; + + --release-pattern ) + echo "${VERSION}" + shift 1 + break + ;; + + --architecture ) + echo "${LOCATION}" | egrep "${ARCHITECTURE}" | sed -r "s!${ARCHITECTURE}!\1!" + shift 1 + break + ;; + + --architecture-pattern ) + echo "${ARCHITECTURE}" + shift 1 + break + ;; + + --motif ) + echo "${LOCATION}" | egrep "${THEME_MOTIF}" | sed -r "s!.*${THEME_MOTIF}.*!\1!" + shift 1 + break + ;; + + --motif-name ) + echo "${LOCATION}" | egrep "${THEME_MOTIF}" | sed -r "s!.*${THEME_MOTIF}.*!\2!" + shift 1 + break + ;; + + --motif-version ) + echo "${LOCATION}" | egrep "${THEME_MOTIF}" | sed -r "s!.*${THEME_MOTIF}.*!\3!" + shift 1 + break + ;; + + --motif-pattern ) + echo "${THEME_MOTIF}" + shift 1 + break + ;; + + --repo-dir ) + echo "${LOCATION}" | sed "s,${TCAR_USER_WRKDIR}/,," + shift 1 + break + ;; + + esac + + done + +} diff --git a/tcar_getRepoName.sh b/tcar_getRepoName.sh new file mode 100755 index 0000000..b572bf0 --- /dev/null +++ b/tcar_getRepoName.sh @@ -0,0 +1,135 @@ +#!/bin/bash +###################################################################### +# +# tcar_getRepoName.sh -- This function standardizes files and +# directories name convection inside the working copy of CentOS +# Artowrk Repository. As convection, regular files are written in +# lower-case and directories are written capitalized. Use this +# function to sanitate the name of regular files and directories on +# paths you work with. +# +# 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 tcar_getRepoName { + + # Define the name we want to apply verifications to. + local NAME="${1}" + + # Avoid using options as it were names. When name value is empty + # but an option is provided, the option becomes the first + # positional argument and is evaluated as it were a name which is + # something we need to prevent from happening. + if [[ ${NAME} =~ '^-' ]];then + return + fi + + # Look for options passed through positional parameters. + case "${2}" 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 ) + + local DIR='' + local DIRS='' + local CLEANDIRS='' + local PREFIXDIR='' + + # In order to sanitate each directory in a path, it is + # required to break off the path string so each component + # can be worked out individually and later combine them + # back to create a clean path string. + + # Reduce path information passed to use the directory part + # of it only. Of course, this is applied if there is a + # directory part in the path. Assuming there is no + # directory part but a non-empty value in the path, use + # that value as directory part and clean it up. + if [[ ${NAME} =~ '.+/.+' ]];then + + # When path information is reduced, we need to + # consider that absolute paths contain some + # directories outside the working copy directory + # structure that shouldn't be sanitized (e.g., /home, + # /home/centos, /home/centos/artwork, + # /home/centos/artwork/turnk, trunk, etc.) So, we keep + # them unchanged for later use. + PREFIXDIR=$(echo ${NAME} \ + | sed -r "s,^((${TCAR_USER_WRKDIR}/)?(trunk|branches|tags)/)?.+$,\1,") + + # ... and remove them 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 sanitized values. + CLEANDIRS="${CLEANDIRS}/${DIR}" + + done + + # Redefine path using sanitized values. + NAME=$(echo ${CLEANDIRS} | sed -r "s!^/!!") + + # Add prefix directory information to sanitate path + # information. + if [[ "${PREFIXDIR}" != '' ]];then + NAME=${PREFIXDIR}${NAME} + fi + ;; + + esac + + # Print out the clean path string. + echo ${NAME} + +} diff --git a/tcar_getTemporalFile.sh b/tcar_getTemporalFile.sh new file mode 100755 index 0000000..b182513 --- /dev/null +++ b/tcar_getTemporalFile.sh @@ -0,0 +1,53 @@ +#!/bin/bash +###################################################################### +# +# tcar_getTemporalFile.sh -- This function returns the absolute path +# you need to use to create temporal files. Use this function +# whenever you need to create temporal files inside 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 tcar_getTemporalFile { + + # Define gettext-specific variables locally, to provide + # per-function localization. + local TEXTDOMAIN="${FUNCNAME}.sh" + local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" + + # Define base name 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 extension is + # required in order to avoid complains from inkscape. + local FILENAME="${RANDOM}${RANDOM}-$(tcar_getRepoName ${1} -f)" + + # Check default base name for temporal file, it can't be an empty + # value. + if [[ -z "${FILENAME}" ]];then + tcar_printMessage "`gettext "The first argument cannot be empty."`" --as-error-line + fi + + # Define absolute path for temporal file and send it out to + # standard output. + echo "${TCAR_SCRIPT_TEMPDIR}/${FILENAME}" + +} diff --git a/tcar_printCaller.sh b/tcar_printCaller.sh new file mode 100755 index 0000000..1ceab89 --- /dev/null +++ b/tcar_printCaller.sh @@ -0,0 +1,56 @@ +#!/bin/bash +###################################################################### +# +# tcar_printCaller.sh -- This function standardizes the way caller +# information is retrieved. +# +# 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 tcar_printCaller { + + local EXPR=${1} + local OPTS=${2} + + case ${OPTS} in + + --line ) + caller ${EXPR} | gawk '{ print $1 }' + ;; + + --name ) + caller ${EXPR} | gawk '{ print $2 }' + ;; + + --path ) + caller ${EXPR} | gawk '{ print $3 }' + ;; + + * ) + # Define where the error was originated inside the + # centos-art.sh script. Print out the function name and + # line from the caller. + caller ${EXPR} | gawk '{ print $2 " L." $1 }' + ;; + + esac + +} diff --git a/tcar_printCopyrightInfo.sh b/tcar_printCopyrightInfo.sh new file mode 100755 index 0000000..f50c4cd --- /dev/null +++ b/tcar_printCopyrightInfo.sh @@ -0,0 +1,137 @@ +#!/bin/bash +###################################################################### +# +# tcar_printCopyrightInfo.sh -- This function standardizes the +# copyright information printed on content produced by centos-art.sh +# script. +# +# As far as I understand, the copyright exists to make people create +# more. The copyright gives creators the legal power over their +# creations and so the freedom to distribute them under the ethical +# terms the creator considers better. At this moment I don't feel +# very confident about this legal affairs and their legal +# implications, but I need to decide what copyright information the +# centos-art.sh script will print out when someone request +# information about it. So, in that sake, I am using The CentOS +# Artwork SIG as copyright holder and the GNU Public License, +# version 2 or any later, for software distribution. +# +# 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 tcar_printCopyrightInfo { + + # Define gettext-specific variables locally, to provide + # per-function localization. + local TEXTDOMAIN="${FUNCNAME}.sh" + local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" + + case "${1}" in + + --license ) + + # Print the license name. + echo "`gettext "Creative Common Attribution-ShareAlike 3.0 License"`" + ;; + + --license-url ) + + # Print the url related to license name. + tcar_printUrl --cc-sharealike + ;; + + --first-year ) + + # The former year when I (as collaborator of The CentOS + # Project) started to consolidate The CentOS Project + # Corporate Visual Identity through the CentOS Artwork + # Repository. + echo '2009' + ;; + + --year|--last-year) + + # The last year when The CentOS Project stopped working in + # its Corporate Visual Identity through the CentOS Artwork + # Repository. That is something that I hope never happens, + # so assume the current year as last working year. + date +%Y + ;; + + --years-range ) + + local FIRST_YEAR=$(tcar_printCopyrightInfo --first-year) + local LAST_YEAR=$(tcar_printCopyrightInfo --last-year) + echo "${FIRST_YEAR}-${LAST_YEAR}" + ;; + + --years-list ) + + local FIRST_YEAR=$(tcar_printCopyrightInfo --first-year) + local LAST_YEAR=$(tcar_printCopyrightInfo --last-year) + + # Define full copyright year string based on first and + # last year. + local FULL_YEAR=$(\ + while [[ ${FIRST_YEAR} -le ${LAST_YEAR} ]];do + echo -n "${FIRST_YEAR}, " + FIRST_YEAR=$((${FIRST_YEAR} + 1)) + done) + + # Prepare full copyright year string and print it out. + echo "${FULL_YEAR}" | sed 's!, *$!!' + ;; + + --holder ) + + # Print centos-art.sh script default copyright holder. Be + # pragmatic about this information, please. The CentOS + # Project exists to produce The CentOS Distribution, not + # centos-art.sh script. Nevertheless, The CentOS Artwork + # SIG is an organizational unit of The CentOS Project + # which is focused on producing The CentOS Project + # corporate visual identity, by means of The CentOS + # Artwork Repository. The centos-art.sh script automates + # frequent tasks inside The CentOS Artwork Repository so, + # based on these considerations, the copyright holder of + # the centos-art.sh script is "closer" to be The CentOS + # Artwork SIG than it would be The CentOS Project. These + # are the logical choosing ideas behind the copyright + # holder of centos-art.sh script. + echo "The CentOS Artwork SIG" + ;; + + --holder-predicate ) + + local HOLDER=$(tcar_printCopyrightInfo --holder) + echo "${HOLDER}. `gettext "All rights reserved."`" + ;; + + * ) + + local YEAR=$(tcar_printCopyrightInfo --last-year) + local HOLDER=$(tcar_printCopyrightInfo --holder) + echo "Copyright © ${YEAR} ${HOLDER}" + ;; + + esac + +} diff --git a/tcar_printFile.sh b/tcar_printFile.sh new file mode 100755 index 0000000..303133e --- /dev/null +++ b/tcar_printFile.sh @@ -0,0 +1,46 @@ +#!/bin/bash +###################################################################### +# +# tcar_printFile.sh -- This function standardizes the way files are +# concatenated inside 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 tcar_printFile { + + # Define absolute path to file you want to print. Take into + # consideration that this file might be out of the repository + # (e.g., it would be a temporal file stored under + # /tmp/centos-art-XXXXXX/ directory). + local FILE="${1}" + + tcar_checkFiles -ef ${FILE} + + if [[ $(/usr/bin/file -b -i ${FILE}) =~ '^application/x-gzip$' ]];then + /bin/zcat ${FILE} + elif [[ $(/usr/bin/file -b -i ${FILE}) =~ '^application/x-bzip2$' ]];then + /bin/bzcat ${FILE} + else + /bin/cat ${FILE} + fi + +} diff --git a/tcar_printHelp.sh b/tcar_printHelp.sh new file mode 100755 index 0000000..f585eb7 --- /dev/null +++ b/tcar_printHelp.sh @@ -0,0 +1,55 @@ +#!/bin/bash +###################################################################### +# +# tcar_printHelp.sh -- This function standardizes the way +# centos-art.sh script prints help about itself. +# +# 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 tcar_printHelp { + + # Retrieve the man page name. This is the file name you want to retrieve + # documentation for. This value is optional. When it is not passed, the + # module name is used. + local TCAR_MANPAGE_NAME="${1:-${TCAR_MODULE_NAME}}" + + # When the module name has not been set and the tcar_printHelp + # function is called from centos-art.sh file, the page name come + # with with --help as opening string and probably as + # --help=filename.sh. In the first case it prints the script + # documentation. In the second case it prints documentation for + # the file specified. + if [[ -z ${TCAR_MODULE_NAME} ]];then + if [[ ${TCAR_MANPAGE_NAME} =~ '^--help=[[:alnum:]_-.]+' ]];then + TCAR_MANPAGE_NAME=$(echo ${TCAR_MANPAGE_NAME} | cut -d'=' -f2) + else + TCAR_MANPAGE_NAME=${TCAR_SCRIPT_NAME} + fi + fi + + # Print requested documentation. + /usr/bin/man -M ${TCAR_SCRIPT_DIR_MANUALS}:${TCAR_MODULE_DIR_MANUALS}/Final "${TCAR_MANPAGE_NAME}" + + # Finish script execution successfully. + exit 0 + +} diff --git a/tcar_printMailingList.sh b/tcar_printMailingList.sh new file mode 100755 index 0000000..3bac5a4 --- /dev/null +++ b/tcar_printMailingList.sh @@ -0,0 +1,77 @@ +#!/bin/bash +###################################################################### +# +# tcar_printMailingList.sh -- This function standardizes the way +# mailing list addresses are printed on content produced 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 tcar_printMailingList { + + local MAILADDRS='' + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='as-html-link:,docs' + + # Initialize arguments with an empty value and set it as local + # variable to this function scope. Doing this is very important to + # avoid any clash with higher execution environments. + local TCAR_MODULE_ARGUMENT='' + + # Process all arguments currently available in this function + # environment. If either ARGSS or ARGSL local variables have been + # defined, argument processing goes through getopt for validation. + tcar_setModuleArguments "${@}" + + # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. + eval set -- "${TCAR_MODULE_ARGUMENT}" + + # Look for options passed through command-line. + while true; do + case "${1}" in + + --docs ) + MAILADDRS="${TCAR_BRAND}-docs@$(tcar_printUrl --domain)" + shift 1 + ;; + + --as-html-link ) + MAILADDRS="${2}" + shift 2 + ;; + + -- ) + + shift 1 + break + ;; + esac + done + + # Print mail address. + echo "${MAILADDRS}" + +} diff --git a/tcar_printMessage.sh b/tcar_printMessage.sh new file mode 100755 index 0000000..6e9914a --- /dev/null +++ b/tcar_printMessage.sh @@ -0,0 +1,304 @@ +#!/bin/bash +###################################################################### +# +# tcar_printMessage.sh -- This function standardizes the way messages +# are printed 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 tcar_printMessage { + + # Define gettext-specific variables locally, to provide + # per-function localization. + local TEXTDOMAIN="${FUNCNAME}.sh" + local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" + + local MESSAGE="${1}" + local FORMAT="${2}" + + # Verify message variable, it cannot have an empty value. + if [[ -z ${MESSAGE} ]];then + tcar_printMessage "`gettext "The message cannot be empty."`" --as-error-line + fi + + # Define message horizontal width. This is the max number of + # horizontal characters the message will use to be displayed on + # the screen. + local MESSAGE_WIDTH=66 + + # Remove empty spaces from message. + MESSAGE=$(printf %s "${MESSAGE}" | sed -r -e 's!^[[:space:]]+!!') + + # Print messages that will always be printed no matter what value + # the TCAR_FLAG_QUIET variable has. + case "${FORMAT}" in + + --as-stdout-line* ) + + local MARGIN_LEFT=15 + if [[ ${FORMAT} =~ '--as-stdout-line=[[:digit:]]+' ]];then + MARGIN_LEFT=$(echo ${FORMAT} | cut -d'=' -f2) + fi + + # Default printing format. This is the format used when no + # other specification is passed to this function. As + # convenience, we transform absolute paths into relative + # paths in order to free horizontal space on final output + # messages. + printf %s "${MESSAGE}" | sed -r \ + -e "s!${TCAR_BASEDIR}/!!g" \ + -e "s!> /!> !g" \ + -e "s!/{2,}!/!g" \ + | gawk 'BEGIN { FS=": " } + { + if ( $0 ~ /^-+$/ ) + print $0 + else + printf "%-'${MARGIN_LEFT}'s\t%s\n", $1, $2 + } + END {}' + ;; + + --as-error-line ) + + # Build the error trail. This is very useful for tracking + # the error down. + tcar_printMessage '-' --as-separator-line + tcar_printMessage "${FUNCNAME[*]}" --as-tree-line + + # Build the error message. + tcar_printMessage '-' --as-separator-line + tcar_printMessage "$(tcar_printCaller 1) ${MESSAGE}" --as-stderr-line + tcar_printMessage '-' --as-separator-line + + # Finish script execution with exit status 1 (SIGHUP) to + # imply the script finished because an error. We are + # using this as convention to finish the script execution. + # So, don't remove the following line, please. + exit 1 + ;; + + --as-debugger-line ) + if [[ ${TCAR_FLAG_DEBUG} == 'true' ]];then + tcar_printMessage "$(date +"%c") ${MESSAGE}" --as-stdout-line=60 + else + return + fi + ;; + + --as-tree-line ) + local NAME + local -a FN + for NAME in ${MESSAGE};do + FN[++((${#FN[*]}))]=${NAME} + done + local COUNT=$(( ${#FN[*]} - 2 )) + local SEPARATOR='`--' + local SPACES=0 + echo "${TCAR_SCRIPT_BASEDIR}/${TCAR_SCRIPT_NAME}" 1>&2 + while [[ ${COUNT} -gt 0 ]];do + if [[ ${COUNT} -eq $(( ${#FN[*]} - 2 )) ]];then + echo ${SEPARATOR} ${FN[${COUNT}]} 1>&2 + else + echo ${FN[${COUNT}]} \ + | gawk '{ printf "%'${SPACES}'s%s %s\n", "", "'${SEPARATOR}'", $1 }' 1>&2 + fi + COUNT=$((${COUNT} - 1)) + SPACES=$((${SPACES} + 4)) + done + ;; + + --as-toknowmore-line ) + tcar_printMessage "`gettext "To know more, run"` ${TCAR_SCRIPT_COMMAND} ${MESSAGE} --help" --as-stderr-line + ;; + + --as-yesornorequest-line ) + + # Define positive answer. + local Y="`gettext "yes"`" + + # Define negative answer. + local N="`gettext "no"`" + + # Define default answer. + local ANSWER=${N} + + if [[ ${TCAR_FLAG_YES} == 'true' ]];then + + ANSWER=${Y} + + else + + # Print the question to standard error. + tcar_printMessage "${MESSAGE} [${Y}/${N}]" --as-request-line + + # Redefine default answer based on user's input. + read ANSWER + + fi + + # Verify user's answer. Only positive answer let the + # script flow to continue. Otherwise, if something + # different from positive answer is passed, the script + # terminates its execution immediately. + if [[ ! ${ANSWER} =~ "^${Y}" ]];then + exit + fi + ;; + + --as-selection-line ) + # Create selection based on message. + local NAME='' + select NAME in ${MESSAGE};do + echo ${NAME} + break + done + ;; + + --as-response-line ) + tcar_printMessage "--> ${MESSAGE}" --as-stderr-line + ;; + + --as-request-line ) + tcar_printMessage "${MESSAGE}:\040" --as-notrailingnew-line + ;; + + --as-notrailingnew-line ) + echo -e -n "${MESSAGE}" | sed -r \ + -e "s!${TCAR_BASEDIR}/!!g" 1>&2 + ;; + + --as-stderr-line ) + echo "${MESSAGE}" | sed -r \ + -e "s!${TCAR_BASEDIR}/!!g" 1>&2 + ;; + + esac + + # Verify quiet option. The quiet option controls whether messages + # are printed or not. + if [[ "${TCAR_FLAG_QUIET}" == 'true' ]];then + return + fi + + # Print messages that will be printed only when the TCAR_FLAG_QUIET + # variable is provided to centos-art.sh script. + case "${FORMAT}" in + + --as-separator-line ) + + # Build the separator line. + MESSAGE=$(\ + until [[ ${MESSAGE_WIDTH} -eq 0 ]];do + echo -n "$(echo ${MESSAGE} | sed -r 's!(.).*!\1!')" + MESSAGE_WIDTH=$((${MESSAGE_WIDTH} - 1)) + done) + + # Draw the separator line. + echo "${MESSAGE}" 1>&2 + ;; + + --as-banner-line ) + tcar_printMessage '-' --as-separator-line + tcar_printMessage "${MESSAGE}" --as-stdout-line + tcar_printMessage '-' --as-separator-line + ;; + + --as-processing-line ) + tcar_printMessage "`gettext "Processing"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-cropping-line ) + tcar_printMessage "`gettext "Cropping from"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-tuningup-line ) + tcar_printMessage "`gettext "Tuning-up"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-checking-line ) + tcar_printMessage "`gettext "Checking"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-combining-line ) + tcar_printMessage "`gettext "Combining"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-editing-line ) + tcar_printMessage "`gettext "Editing"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-creating-line | --as-updating-line ) + if [[ -a "${MESSAGE}" ]];then + tcar_printMessage "`gettext "Updating"`: ${MESSAGE}" --as-stdout-line + else + tcar_printMessage "`gettext "Creating"`: ${MESSAGE}" --as-stdout-line + fi + ;; + + --as-deleting-line ) + tcar_printMessage "`gettext "Deleting"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-reading-line ) + tcar_printMessage "`gettext "Reading"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-savedas-line ) + tcar_printMessage "`gettext "Saved as"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-linkto-line ) + tcar_printMessage "`gettext "Linked to"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-movedto-line ) + tcar_printMessage "`gettext "Moved to"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-translation-line ) + tcar_printMessage "`gettext "Translation"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-translating-line ) + tcar_printMessage "`gettext "Translating"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-validating-line ) + tcar_printMessage "`gettext "Validating"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-template-line ) + tcar_printMessage "`gettext "Template"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-configuration-line ) + tcar_printMessage "`gettext "Configuration"`: ${MESSAGE}" --as-stdout-line + ;; + + --as-palette-line ) + tcar_printMessage "`gettext "Palette"`: ${MESSAGE}" --as-stdout-line + ;; + + esac + +} diff --git a/tcar_printUrl.sh b/tcar_printUrl.sh new file mode 100755 index 0000000..ec9c7a2 --- /dev/null +++ b/tcar_printUrl.sh @@ -0,0 +1,150 @@ +#!/bin/bash +###################################################################### +# +# tcar_printUrl.sh -- This function standardizes the way URLs are +# printed by centos-art.sh script. This function describes the +# domain organization of The CentOS Project through its URLs and +# provides a way to print them out when needed. +# +# 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 tcar_printUrl { + + local URL='' + + # Define short options. + local ARGSS='' + + # Define long options. + local ARGSL='domain,home,lists,wiki,forums,bugs,planet,docs,mirrors,projects,svn,trac,irc,cc-sharealike,with-locale,as-html-link' + + # Initialize arguments with an empty value and set it as local + # variable to this function scope. Doing this is very important to + # avoid any clash with higher execution environments. + local TCAR_MODULE_ARGUMENT='' + + # Process all arguments currently available in this function + # environment. If either ARGSS or ARGSL local variables have been + # defined, argument processing goes through getopt for validation. + tcar_setModuleArguments "${@}" + + # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. + eval set -- "${TCAR_MODULE_ARGUMENT}" + + # Look for options passed through command-line. + while true; do + case "${1}" in + + --domain ) + URL="centos.org" + shift 1 + ;; + + --home ) + URL="http://www.$(tcar_printUrl --domain)/" + shift 1 + ;; + + --lists ) + URL="http://lists.$(tcar_printUrl --domain)/" + shift 1 + ;; + + --wiki ) + URL="http://wiki.$(tcar_printUrl --domain)/" + shift 1 + ;; + + --forums ) + URL="http://forums.$(tcar_printUrl --domain)/" + shift 1 + ;; + + --bugs ) + URL="http://bugs.$(tcar_printUrl --domain)/" + shift 1 + ;; + + --projects ) + URL="https://projects.$(tcar_printUrl --domain)/" + shift 1 + ;; + + --svn ) + URL="$(tcar_printUrl --projects)svn/" + shift 1 + ;; + + --trac ) + URL="$(tcar_printUrl --projects)trac/" + shift 1 + ;; + + --planet ) + URL="http://planet.$(tcar_printUrl --domain)/" + shift 1 + ;; + + --docs ) + URL="http://docs.$(tcar_printUrl --domain)/" + shift 1 + ;; + + --mirrors ) + URL="http://mirrors.$(tcar_printUrl --domain)/" + shift 1 + ;; + + --irc ) + URL="http://$(tcar_printUrl --home)modules/tinycontent/index.php?id=8" + shift 1 + ;; + + --cc-sharealike ) + URL="http://creativecommons.org/licenses/by-sa/3.0/" + shift 1 + ;; + + --with-locale ) + if [[ ! ${LANG} =~ '^en' ]];then + URL="${URL}${TCAR_SCRIPT_LANG_LL}/" + fi + shift 1 + ;; + + --as-html-link ) + URL="${URL}" + shift 1 + ;; + + -- ) + + shift 1 + break + ;; + esac + done + + # Print Url. + echo "${URL}" + +} diff --git a/tcar_printVersion.sh b/tcar_printVersion.sh new file mode 100755 index 0000000..d9c1cda --- /dev/null +++ b/tcar_printVersion.sh @@ -0,0 +1,49 @@ +#!/bin/bash +###################################################################### +# +# tcar_printVersion.sh -- This function standardizes the way +# centos-art.sh script prints version about itself. +# +# 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 tcar_printVersion { + + # Define gettext-specific variables locally, to provide + # per-function localization. + local TEXTDOMAIN="${FUNCNAME}.sh" + local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" + + local PROGRAM_NAME=${1:-${TCAR_SCRIPT_NAME}} + local YEAR=$(tcar_printCopyrightInfo --year) + local HOLDER=$(tcar_printCopyrightInfo --holder) + + if [[ ${PROGRAM_NAME} == ${TCAR_SCRIPT_NAME} ]];then + tcar_printMessage "${TCAR_SCRIPT_NAME} ${TCAR_SCRIPT_VERSION}" --as-stdout-line + else + tcar_printMessage "${PROGRAM_NAME} (${TCAR_SCRIPT_NAME}) ${TCAR_SCRIPT_VERSION}" --as-stdout-line + fi + tcar_printMessage "Copyright (C) ${YEAR} ${HOLDER}" --as-stdout-line + tcar_printMessage "`eval_gettext "\\\$PROGRAM_NAME comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of \\\$PROGRAM_NAME under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING."`" --as-stdout-line | fold --width=66 --spaces + + exit 0 + +} diff --git a/tcar_setModuleArguments.sh b/tcar_setModuleArguments.sh new file mode 100755 index 0000000..8926cd4 --- /dev/null +++ b/tcar_setModuleArguments.sh @@ -0,0 +1,100 @@ +#!/bin/bash +###################################################################### +# +# tcar_setModuleArguments.sh -- This function uses getopt to process +# arguments passed to centos-art.sh script. +# +# This function works with the following three variables: +# +# ARGSS +# Stores getopt short arguments definition. +# +# ARGSL +# Stores getopt long arguments definition. +# +# TCAR_MODULE_ARGUMENT +# Stores arguments passed to functions or command-line +# interface depending the context it is defined. +# +# These three variables are not defined in this function but the +# function environment you want to provide option parsing for, +# through getopt command. Using local definition for these three +# variables let you to nest option parsing inside different +# function-environment levels. +# +# 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 tcar_setModuleArguments { + + # Define gettext-specific variables locally, to provide + # per-function localization. + local TEXTDOMAIN="${FUNCNAME}.sh" + local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" + + local ARGUMENT='' + + # Fill up arguments global variable with current positional + # parameter information. To avoid interpretation problems, use + # single quotes to enclose each argument (TCAR_MODULE_ARGUMENT) from + # command-line individually. + for ARGUMENT in "${@}"; do + + # Remove any single quote from arguments passed to + # centos-art.sh script. We will use single quotes for grouping + # option values so white space can be passed through them. + ARGUMENT=$(printf %s "${ARGUMENT}" | tr -d "'") + + # Concatenate arguments and enclose them to let getopt to + # process them when they have spaces inside. + TCAR_MODULE_ARGUMENT="${TCAR_MODULE_ARGUMENT} '${ARGUMENT}'" + + done + + # Verify non-option arguments passed to command-line. If there + # isn't any or dot is provided, redefine the TCAR_MODULE_ARGUMENT + # variable to use the current location the centos-art.sh script + # was called from. + if [[ -z "${TCAR_MODULE_ARGUMENT}" ]];then + TCAR_MODULE_ARGUMENT=${PWD} + fi + + # Verify presence of either short or long options in the + # environment. If they are present apply option validation through + # getopt. + if [[ ! -z ${ARGSS} ]] || [[ ! -z ${ARGSL} ]];then + + # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. + eval set -- "${TCAR_MODULE_ARGUMENT}" + + # Process positional parameters using getopt's option validation. + TCAR_MODULE_ARGUMENT=$(getopt -o "${ARGSS}" -l "${ARGSL}" \ + -n "${TCAR_SCRIPT_COMMAND} (${TCAR_MODULE_NAME})" -- "${@}") + + # Verify getopt's exit status and finish the script execution + # with an error message, if it failed. + if [[ $? -ne 0 ]];then + tcar_printMessage "`gettext "The argument verification failed."`" --as-error-line + fi + + fi + +} diff --git a/tcar_setModuleEnvironment.sh b/tcar_setModuleEnvironment.sh new file mode 100755 index 0000000..eedc142 --- /dev/null +++ b/tcar_setModuleEnvironment.sh @@ -0,0 +1,192 @@ +#!/bin/bash +###################################################################### +# +# tcar_setModuleEnvironment.sh -- This function initiates module +# environments inside the 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 tcar_setModuleEnvironment { + + local ARG_MODULE_NAME='' + local ARG_MODULE_TYPE='' + local ARG_MODULE_ARGS='' + + # Retrieve module's name and module's type from arguments passed + # through this function positional parameters. + OPTIND=1 + while getopts "m:,t:,g:" OPTION "${@}"; do + case "${OPTION}" in + m ) ARG_MODULE_NAME="${OPTARG}" ;; + t ) ARG_MODULE_TYPE="${OPTARG}" ;; + g ) ARG_MODULE_ARGS="${OPTARG} ${ARG_MODULE_ARGS}" ;; + esac + done + + # Clean up positional parameters to reflect the fact that options + # have been processed already. + shift $(( ${OPTIND} - 1 )) + + # Initialize module's global counter. + TCAR_MODULE_COUNT=${TCAR_MODULE_COUNT:-0} + + # When the last module in the chain of executed modules is the + # same module being currently executed, don't create a new + # position for it in the chain of modules. Instead, use the + # information it already has from its previous execution. In order + # for this to work, the current module must be executed as sibling + # module of other module or itself. + if [[ ${TCAR_MODULE_COUNT} -gt 0 ]];then + if [[ ${TCAR_MODULE_NAMES[((${TCAR_MODULE_COUNT} - 1))]} == ${ARG_MODULE_NAME} ]];then + if [[ ${ARG_MODULE_TYPE} == 'sibling' ]];then + tcar_printMessage '~~~~~~~~~~~~~~~~~~~~~~~~~> : '"${TCAR_MODULE_NAME} ${TCAR_MODULE_ARGUMENT}" --as-debugger-line + ${ARG_MODULE_NAME} ${ARG_MODULE_ARGS} ${@} + return + fi + fi + fi + + tcar_printMessage '=========================>: ['${TCAR_MODULE_COUNT}'] | '${FUNCNAME[1]} --as-debugger-line + + # Define module's base directory. This is the directory where the + # initialization script is stored in. + local TCAR_MODULE_BASEDIR=${TCAR_SCRIPT_MODULES_BASEDIR} + if [[ ${#TCAR_MODULE_BASEDIRS[*]} -gt 0 ]];then + if [[ ${ARG_MODULE_TYPE} == "parent" ]];then + TCAR_MODULE_BASEDIR=${TCAR_SCRIPT_MODULES_BASEDIR} + elif [[ ${ARG_MODULE_TYPE} == "sibling" ]];then + if [[ ${TCAR_MODULE_TYPES[((${TCAR_MODULE_COUNT} - 1 ))]} == 'sibling' ]];then + TCAR_MODULE_BASEDIR=${TCAR_MODULE_BASEDIRS[((${TCAR_MODULE_COUNT}-2))]} + else + TCAR_MODULE_BASEDIR=${TCAR_MODULE_BASEDIRS[((${TCAR_MODULE_COUNT}-1))]} + fi + else + TCAR_MODULE_BASEDIR=${TCAR_MODULE_BASEDIRS[${TCAR_MODULE_COUNT}]} + fi + fi + tcar_printMessage "TCAR_MODULE_BASEDIR : ${TCAR_MODULE_BASEDIR}" --as-debugger-line + + # Define module's name. + TCAR_MODULE_NAMES[${TCAR_MODULE_COUNT}]=$(tcar_getRepoName "${ARG_MODULE_NAME:-unknown}" "-f" | cut -d '-' -f1) + local TCAR_MODULE_NAME=${TCAR_MODULE_NAMES[${TCAR_MODULE_COUNT}]} + tcar_printMessage "TCAR_MODULE_NAME : [${TCAR_MODULE_COUNT}]=${TCAR_MODULE_NAME}" --as-debugger-line + + # Define module's type. + TCAR_MODULE_TYPES[${TCAR_MODULE_COUNT}]="${ARG_MODULE_TYPE:-parent}" + local TCAR_MODULE_TYPE=${TCAR_MODULE_TYPES[${TCAR_MODULE_COUNT}]} + tcar_printMessage "TCAR_MODULE_TYPE : ${TCAR_MODULE_TYPE}" --as-debugger-line + + # Define module's arguments. This variable is used in different + # module environments to pass positional parameters from one + # environment to another using local definitions. + TCAR_MODULE_ARGUMENTS[${TCAR_MODULE_COUNT}]="${ARG_MODULE_ARGS:-} ${@}" + local TCAR_MODULE_ARGUMENT=${TCAR_MODULE_ARGUMENTS[${TCAR_MODULE_COUNT}]} + tcar_printMessage "TCAR_MODULE_ARGUMENT : ${TCAR_MODULE_ARGUMENT}" --as-debugger-line + + # Check module's name possible values. + tcar_checkModuleName + + # Define module's directory. + TCAR_MODULE_DIRS[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_BASEDIR}/$(tcar_getRepoName "${TCAR_MODULE_NAME}" "-d") + local TCAR_MODULE_DIR=${TCAR_MODULE_DIRS[${TCAR_MODULE_COUNT}]} + tcar_printMessage "TCAR_MODULE_DIR : ${TCAR_MODULE_DIR}" --as-debugger-line + + # Define module's directories not reused from module's parent + # directory structure. + TCAR_MODULE_DIRS_MODULES[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIR}/Modules + local TCAR_MODULE_DIR_MODULES=${TCAR_MODULE_DIRS_MODULES[${TCAR_MODULE_COUNT}]} + tcar_printMessage "TCAR_MODULE_DIR_MODULES : ${TCAR_MODULE_DIR_MODULES}" --as-debugger-line + + TCAR_MODULE_DIRS_CONFIGS[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIR}/Configs + local TCAR_MODULE_DIR_CONFIGS=${TCAR_MODULE_DIRS_CONFIGS[${TCAR_MODULE_COUNT}]} + tcar_printMessage "TCAR_MODULE_DIR_CONFIGS : ${TCAR_MODULE_DIR_CONFIGS}" --as-debugger-line + + # Define module's directories reused from module's parent + # directory structure. + TCAR_MODULE_DIRS_MANUALS[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIRS[0]}/Manuals + local TCAR_MODULE_DIR_MANUALS=${TCAR_MODULE_DIRS_MANUALS[${TCAR_MODULE_COUNT}]} + tcar_printMessage "TCAR_MODULE_DIR_MANUALS : ${TCAR_MODULE_DIR_MANUALS}" --as-debugger-line + + TCAR_MODULE_DIRS_LOCALES[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIRS[0]}/Locales + local TCAR_MODULE_DIR_LOCALES=${TCAR_MODULE_DIRS_LOCALES[${TCAR_MODULE_COUNT}]} + tcar_printMessage "TCAR_MODULE_DIR_LOCALES : ${TCAR_MODULE_DIR_LOCALES}" --as-debugger-line + + # Define module's initialization file. + TCAR_MODULE_INIT_FILES[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIR}/${TCAR_MODULE_NAME}.sh + local TCAR_MODULE_INIT_FILE=${TCAR_MODULE_INIT_FILES[${TCAR_MODULE_COUNT}]} + tcar_printMessage "TCAR_MODULE_INIT_FILE : ${TCAR_MODULE_INIT_FILE}" --as-debugger-line + + # Define module's connection with their localization files. It is + # required that gettext-specific variables be defined locally, in + # order to implement per-module localization. + local TEXTDOMAIN=$(basename ${TCAR_MODULE_INIT_FILE}) + tcar_printMessage "TEXTDOMAIN: ${TEXTDOMAIN}" --as-debugger-line + local TEXTDOMAINDIR=${TCAR_MODULE_DIR_LOCALES} + tcar_printMessage "TEXTDOMAINDIR: ${TEXTDOMAINDIR}" --as-debugger-line + + # Increment module's counter just before creating next module's + # base directory. + TCAR_MODULE_COUNT=$(( ${TCAR_MODULE_COUNT} + 1 )) + + # Define next module's base directory. + TCAR_MODULE_BASEDIRS[${TCAR_MODULE_COUNT}]=${TCAR_MODULE_DIR_MODULES} + + # Check function script execution rights. + tcar_checkFiles -ex ${TCAR_MODULE_INIT_FILE} + + # Load module-specific (function) scripts into current execution + # environment. Keep the tcar_setModuleEnvironmentScripts function + # call after all variables and arguments definitions. + tcar_setModuleEnvironmentScripts + + # Execute module's initialization script with its arguments. + tcar_printMessage '-------------------------> : '"${TCAR_MODULE_NAME} ${TCAR_MODULE_ARGUMENT}" --as-debugger-line + ${TCAR_MODULE_NAME} ${TCAR_MODULE_ARGUMENT} + + # Unset module-specific environment. + tcar_printMessage '<------------------------- : '"${TCAR_MODULE_NAME} ${TCAR_MODULE_ARGUMENT}" --as-debugger-line + tcar_unsetModuleEnvironment + + # Decrement module counter just after unset unused module + # environments. + TCAR_MODULE_COUNT=$(( ${TCAR_MODULE_COUNT} - 1 )) + + # Unset array and non-array variables used in this function. + if [[ ${TCAR_MODULE_COUNT} -eq 0 ]];then + unset TCAR_MODULE_NAMES + unset TCAR_MODULE_BASEDIRS + unset TCAR_MODULE_DIRS + unset TCAR_MODULE_DIRS_MODULES + unset TCAR_MODULE_DIRS_MANUALS + unset TCAR_MODULE_DIRS_LOCALES + unset TCAR_MODULE_DIRS_CONFIGS + unset TCAR_MODULE_NAME + unset TCAR_MODULE_DIR + unset TCAR_MODULE_DIR_MODULES + unset TCAR_MODULE_DIR_MANUALS + unset TCAR_MODULE_DIR_LOCALES + unset TCAR_MODULE_DIR_CONFIGS + fi + + tcar_printMessage '<=========================: ['${TCAR_MODULE_COUNT}'] | '${FUNCNAME[1]} --as-debugger-line + +} diff --git a/tcar_setModuleEnvironmentScripts.sh b/tcar_setModuleEnvironmentScripts.sh new file mode 100755 index 0000000..270d246 --- /dev/null +++ b/tcar_setModuleEnvironmentScripts.sh @@ -0,0 +1,91 @@ +#!/bin/bash +###################################################################### +# +# tcar_setModuleEnvironmentScripts.sh -- This function standardizes +# the way specific functionalities are exported to centos-art.sh +# script environment. +# +# 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 tcar_setModuleEnvironmentScripts { + + # Define gettext-specific variables locally, to provide + # per-function localization. + local TEXTDOMAIN="${FUNCNAME}.sh" + local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" + + # Define the pattern used to retrieve function names from function + # files. + local FUNCTION_PATTERN="^function[[:space:]]+${TCAR_MODULE_NAME}(_[[:alnum:]]+)?[[:space:]]+{[[:space:]]*$" + + # Define the list of files. + local TCAR_MODULE_SCRIPT='' + local TCAR_MODULE_SCRIPTS="${TCAR_MODULE_INIT_FILE}" + if [[ -d ${TCAR_MODULE_DIR} ]];then + TCAR_MODULE_SCRIPTS="${TCAR_MODULE_SCRIPTS} + $(tcar_getFilesList ${TCAR_MODULE_DIR} \ + --pattern="${TCAR_MODULE_DIR}/${TCAR_MODULE_NAME}_[[:alnum:]]+\.sh$" --type='f')" + fi + + # Verify the list of files. If no function file exists for the + # location specified stop the script execution. Otherwise the + # script will surely try to execute a function that haven't been + # exported yet and report an error about it. + if [[ -z ${TCAR_MODULE_SCRIPTS} ]];then + tcar_printMessage "${FUNCNAME}: `gettext "No function file was found."`" --as-error-line + fi + + # Process the list of files. + for TCAR_MODULE_SCRIPT in ${TCAR_MODULE_SCRIPTS};do + + # Verify the execution rights for function file. + tcar_checkFiles -ex ${TCAR_MODULE_SCRIPT} + + # Retrieve the function's name from function's file. + local TCAR_MODULE_SCRIPT_FN=$(egrep "${FUNCTION_PATTERN}" ${TCAR_MODULE_SCRIPT} \ + | gawk '{ print $2 }') + + # Verify function's name. It cannot be an empty value. + if [[ -z "${TCAR_MODULE_SCRIPT_FN}" ]];then + tcar_printMessage "`gettext "No function definition found."`" --as-error-line + fi + + # Verify that function files have not been already exported. + # If they have been already exported don't export them again. + # Instead, continue with the next function file in the list. + declare -F | gawk '{ print $3 }' | egrep "^${TCAR_MODULE_SCRIPT}$" > /dev/null + if [[ $? -eq 0 ]];then + continue + fi + + # Initialize the function file. + . ${TCAR_MODULE_SCRIPT} + + # Export the function names inside the file to current shell + # script environment. + export -f ${TCAR_MODULE_SCRIPT_FN} + + tcar_printMessage "export -f : ${TCAR_MODULE_SCRIPT_FN}" --as-debugger-line + + done + +} diff --git a/tcar_setTranslationMarkers.sh b/tcar_setTranslationMarkers.sh new file mode 100755 index 0000000..1ec018e --- /dev/null +++ b/tcar_setTranslationMarkers.sh @@ -0,0 +1,185 @@ +#!/bin/bash +###################################################################### +# +# tcar_setTranslationMarkers.sh -- This function standardizes construction +# of translation markers and their related expansion. As convention, +# translation markers must be set inside source files (e.g., +# Docbook, Svg, etc.) and expanded inside temporal instances used to +# produce final contents. +# +# 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 tcar_setTranslationMarkers { + + # Initialize variables. + local -a SRC + local -a DST + local COUNT=0 + local COUNTSRC=0 + local COUNTDST=0 + + # Define source location on which sed replacements take place. + local LOCATION="${1}" + + # Verify that source location does exist. + tcar_checkFiles -ef ${LOCATION} + + # Define copyright translation markers. + SRC[((++${#SRC[*]}))]='=COPYRIGHT_YEAR_FIRST=' + DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --first-year)" + SRC[((++${#SRC[*]}))]='=COPYRIGHT_YEAR(_LAST)?=' + DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --year)" + SRC[((++${#SRC[*]}))]='=COPYRIGHT_YEAR(S)?_LIST=' + DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --years-list)" + SRC[((++${#SRC[*]}))]='=COPYRIGHT_HOLDER=' + DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --holder)" + SRC[((++${#SRC[*]}))]='=COPYRIGHT_HOLDER_PREDICATE=' + DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --holder-predicate)" + + # Define license translation markers. + SRC[((++${#SRC[*]}))]='=LICENSE=' + DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --license)" + SRC[((++${#SRC[*]}))]='=LICENSE_URL=' + DST[((++${#DST[*]}))]="$(tcar_printCopyrightInfo --license-url)" + + # Define theme translation markers. + SRC[((++${#SRC[*]}))]='=THEME=' + DST[((++${#DST[*]}))]="$(tcar_getPathComponent ${RENDER_TARGET} --motif)" + SRC[((++${#SRC[*]}))]='=THEMENAME=' + DST[((++${#DST[*]}))]="$(tcar_getPathComponent ${RENDER_TARGET} --motif-name)" + SRC[((++${#SRC[*]}))]='=THEMERELEASE=' + DST[((++${#DST[*]}))]="$(tcar_getPathComponent ${RENDER_TARGET} --motif-version)" + + # Define url translation markers. + SRC[((++${#SRC[*]}))]='=URL=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--home' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_WIKI=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--wiki' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_LISTS=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--lists' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_FORUMS=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--forums' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_MIRRORS=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--mirrors' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_DOCS=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--docs' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_PROJECTS=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--projects' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_BUGS=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--bugs' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_SVN=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--svn' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_TRAC=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--trac' '--with-locale') + SRC[((++${#SRC[*]}))]='=URL_PLANET=' + DST[((++${#DST[*]}))]=$(tcar_printUrl '--planet' '--with-locale') + + # Define release translation markers. + SRC[((++${#SRC[*]}))]='=RELEASE=' + DST[((++${#DST[*]}))]=${RELEASE} + SRC[((++${#SRC[*]}))]='=MAJOR_RELEASE=' + DST[((++${#DST[*]}))]=${MAJOR_RELEASE} + + # Define emails translation markers. + SRC[((++${#SRC[*]}))]='=MAIL_DOCS=' + DST[((++${#DST[*]}))]="$(tcar_printMailingList --docs)" + + # Define locale translation markers. + SRC[((++${#SRC[*]}))]='=LOCALE=' + DST[((++${#DST[*]}))]="${TCAR_SCRIPT_LANG_LC}" + SRC[((++${#SRC[*]}))]='=LOCALE_LL=' + DST[((++${#DST[*]}))]="${TCAR_SCRIPT_LANG_LL}" + SRC[((++${#SRC[*]}))]='=LOCALE_CC=' + DST[((++${#DST[*]}))]="${TCAR_SCRIPT_LANG_CC}" + + # Define domain translation markers for domains. + SRC[((++${#SRC[*]}))]='=DOMAIN_LL=' + if [[ ! ${TCAR_SCRIPT_LANG_LL} =~ '^en' ]];then + DST[((++${#DST[*]}))]="${TCAR_SCRIPT_LANG_LL}" + else + DST[((++${#DST[*]}))]="" + fi + + # Define repository translation markers. + SRC[((++${#SRC[*]}))]='=(REPO_TLDIR|REPO_HOME|TCAR_BASEDIR|TCAR_WORKDIR)=' + DST[((++${#DST[*]}))]="${TCAR_BASEDIR}" + + # 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 + + # Remove escaped character from translation markers. This is one + # of the reasons why translation marker should be expanded in + # source files instances not the source files themselves. + # Escaping translation markers provides a way of talking about + # them without expanding them. + sed -r -i 's/(=)\\([A-Z_]+=)/\1\2/g' ${LOCATION} + + # Unset specific translation markers and specific replacement + # variables in order to clean them up. Otherwise, undesired values + # may remain from one file to another. + unset SRC + unset DST + +} diff --git a/tcar_synchronizeRepoChanges.sh b/tcar_synchronizeRepoChanges.sh new file mode 100755 index 0000000..0d87a38 --- /dev/null +++ b/tcar_synchronizeRepoChanges.sh @@ -0,0 +1,43 @@ +#!/bin/bash +###################################################################### +# +# tcar_synchronizeRepoChanges.sh -- This function standardizes the +# way changes are synchronized between the working copy and the +# central repository. This function is an interface to the Svn +# functionality of the 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 tcar_synchronizeRepoChanges { + + # Verify synchronization flag. + if [[ ${FLAG_SYNCHRONIZE} != 'true' ]];then + return + fi + + # Verify existence of locations passed to this function. + tcar_checkFiles -e ${@} + + # Synchronize changes. + tcar_setModuleEnvironment vcs --synchronize ${@} + +} diff --git a/tcar_terminateScriptExecution.sh b/tcar_terminateScriptExecution.sh new file mode 100755 index 0000000..0f95ace --- /dev/null +++ b/tcar_terminateScriptExecution.sh @@ -0,0 +1,40 @@ +#!/bin/bash +###################################################################### +# +# tcar_terminateScriptExecution.sh -- This function standardizes the +# actions that must be realized just before leaving the script +# execution (e.g., cleaning temporal files). This function is the +# one called when interruption signals like EXIT, SIGHUP, SIGINT and +# SIGTERM are detected. +# +# 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 tcar_terminateScriptExecution { + + # Remove temporal directory. + rm -r ${TCAR_SCRIPT_TEMPDIR} + + # NOTE: Don't specify an exit status here. As convenction we do + # this when error messages are triggerd. See `--as-error-line' + # option from `tcar_printMessage' functionality. + +} diff --git a/tcar_unsetModuleEnvironment.sh b/tcar_unsetModuleEnvironment.sh new file mode 100755 index 0000000..69d3ae3 --- /dev/null +++ b/tcar_unsetModuleEnvironment.sh @@ -0,0 +1,53 @@ +#!/bin/bash +###################################################################### +# +# tcar_unsetModuleEnvironment.sh -- This function unsets +# functionalities from centos-art.sh script execution environment. +# +# 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 tcar_unsetModuleEnvironment { + + # Define gettext-specific variables locally, to provide + # per-function localization. + local TEXTDOMAIN="${FUNCNAME}.sh" + local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales" + + # Verify suffix value used to retrieve function files. + if [[ -z ${TCAR_MODULE_NAME} ]];then + tcar_printMessage "`gettext "The export id was not provided."`" --as-error-line + fi + + # Define list of format-specific functionalities. This is the list + # of function definitions previously exported by + # `tcar_setModuleEnvironmentScripts'. Be sure to limit the list + # to function names that start with the suffix specified only. + local TCAR_MODULE_SCRIPT_FN='' + local TCAR_MODULE_SCRIPT_FNS=$(declare -F | gawk '{ print $3 }' | egrep "^${TCAR_MODULE_NAME}") + + # Unset function names from current execution environment. + for TCAR_MODULE_SCRIPT_FN in ${TCAR_MODULE_SCRIPT_FNS};do + unset -f ${TCAR_MODULE_SCRIPT_FN} + tcar_printMessage "unset -f : ${TCAR_MODULE_SCRIPT_FN}" --as-debugger-line + done + +}