From ff1822c2e0ae126060a8d0de5764169fc6f58f9a Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Jul 16 2013 04:35:36 +0000 Subject: Update prepare module from centos-art.sh script. - Remove prepare_seeEnvironment, prepare_updateEnvironment and prepare_getEnvars functions. I don't see any use for them. So, clean up. - Remove prepare_updateLocales function. There isn't need to produce locale files at first stage. They all will be under version control and managed by locale module. - Remove unused options from prepare_getOptions. - Rename prepare_update* functions to prepare_set* functions. - Change link rendition process. Previous to this commit, links were produced in the prepare_updateLinks function. In this commit, the function prepare_updateLinks is just an interface to prepare_setConfiguration which builds a list of all links.conf files inside the repository and sends it to render module. I found that configuration files are more flexible and adaptable to changes inside the repository directory structure than having all links definitions inside an script using variables. Note that configuration files are always inside directories and work relative to them, if you move the directory to another place the links will be created using the new location, the next time you run the render module over them. - Change images and manuals rendition process. Now they all are based on configuration files and handled by render module. - Add prepare.asciidoc file. This file holds the module's documentation. If you want to know the module's options and how to run it, see this file. It is also used as source to produce documentation in other formats like manpage. - Add prepare.conf file. This file contains all configuration variables related to prepare module. --- diff --git a/Automation/Modules/Prepare/Scripts/prepare_getEnvars.sh b/Automation/Modules/Prepare/Scripts/prepare_getEnvars.sh deleted file mode 100755 index 345bd34..0000000 --- a/Automation/Modules/Prepare/Scripts/prepare_getEnvars.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# -# prepare_getEnvars.sh -- This function outputs a brief description of -# relevant environment variables used by `centos-art.sh' script. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_getEnvars { - - local -a VARS - local -a INFO - local COUNT=0 - - # Define name of environment variables used by centos-art.sh - # script. - VARS[0]='EDITOR' - VARS[1]='TZ' - VARS[2]='TEXTDOMAIN' - VARS[3]='TEXTDOMAINDIR' - VARS[4]='LANG' - - # Define description of environment variables. - INFO[0]="`gettext "Default text editor"`" - INFO[1]="`gettext "Default time zone representation"`" - INFO[2]="`gettext "Default domain used to retrieve translated messages"`" - INFO[3]="`gettext "Default directory used to retrive translated messages"`" - INFO[4]="`gettext "Default locale information"`" - - until [[ $COUNT -eq ${#VARS[*]} ]];do - - # Let user to reduce output using regular expression as - # reference. - if [[ ${VARS[$COUNT]} =~ $FLAG_FILTER ]];then - - # Output list of environment variables using indirect - # expansion (what a beautiful feature!) to output variable - # value. - cli_printMessage "${INFO[$COUNT]}:" - cli_printMessage "${VARS[$COUNT]}=${!VARS[$COUNT]}" --as-response-line - - fi - - # Increment counter. - COUNT=$(($COUNT + 1)) - - done - -} diff --git a/Automation/Modules/Prepare/Scripts/prepare_getOptions.sh b/Automation/Modules/Prepare/Scripts/prepare_getOptions.sh index 484f8ac..621237e 100755 --- a/Automation/Modules/Prepare/Scripts/prepare_getOptions.sh +++ b/Automation/Modules/Prepare/Scripts/prepare_getOptions.sh @@ -1,9 +1,14 @@ #!/bin/bash +###################################################################### # -# prepare_getOptions.sh -- This function parses command options -# provided to `centos-art.sh' script when the first argument in the -# command-line is the `prepare' word. To parse options, this function -# makes use of getopt program. +# prepare_getOptions.sh -- This function parses command options +# provided to `centos-art.sh' script when the first argument in the +# command-line is the `prepare' word. To parse options, this +# function makes use of getopt program. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# Key fingerprint = D67D 0F82 4CBD 90BC 6421 DF28 7CCE 757C 17CA 3951 # # Copyright (C) 2009-2013 The CentOS Project # @@ -21,87 +26,83 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- +###################################################################### function prepare_getOptions { # Define short options we want to support. - local ARGSS="h,q" + local ARGSS="h,v,q" # Define long options we want to support. - local ARGSL="help,quiet,answer-yes,packages,locales,links,images,manuals,directories,set-environment,see-environment,synchronize" + local ARGSL="help,version,quiet,yes,packages,links,images,manuals,all,directories,synchronize" + + # Define module arguments local to this function. This is very + # important in order to provide option parsing for different + # function environment levels. + local TCAR_ARGUMENTS='' - # Redefine CLI_FUNCTION_ARGUMENTS using getopt(1) command parser. - cli_parseArguments + # Redefine arguments using getopt(1) command parser. + cli_setArguments "${@}" - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$CLI_FUNCTION_ARGUMENTS" + # Reset positional parameters on this function, using output + # produced from (getopt) arguments parser. + eval set -- "${TCAR_ARGUMENTS}" # Look for options passed through command-line. while true; do case "$1" in -h | --help ) - cli_runFnEnvironment help --read --format="texinfo" "tcar-fs::scripts:bash-functions-prepare" - shift 1 - exit - ;; - - -q | --quiet ) - FLAG_QUIET="true" - shift 1 + cli_printHelp ;; - --answer-yes ) - FLAG_ANSWER="true" - shift 1 + -v | --version ) + cli_printVersion ;; - --set-environment ) - ACTIONNAMS="${ACTIONNAMS} prepare_updateEnvironment" + -q | --quiet ) + TCAR_FLAG_QUIET="true" shift 1 ;; - --see-environment ) - ACTIONNAMS="${ACTIONNAMS} prepare_seeEnvironment" + --yes ) + TCAR_FLAG_YES="true" shift 1 ;; --packages ) - ACTIONNAMS="${ACTIONNAMS} prepare_updatePackages" + MODULE_ACTIONS="${MODULE_ACTIONS} prepare_setPackages" shift 1 ;; - --locales ) - ACTIONNAMS="${ACTIONNAMS} prepare_updateLocales" + --images ) + MODULE_ACTIONS="${MODULE_ACTIONS} prepare_setImages" shift 1 ;; - --links ) - ACTIONNAMS="${ACTIONNAMS} prepare_updateLinks" + --manuals ) + MODULE_ACTIONS="${MODULE_ACTIONS} prepare_setManuals" shift 1 ;; - --images ) - ACTIONNAMS="${ACTIONNAMS} prepare_updateImages" + --links ) + MODULE_ACTIONS="${MODULE_ACTIONS} prepare_setLinks" shift 1 ;; - --manuals ) - ACTIONNAMS="${ACTIONNAMS} prepare_updateManuals" + --all ) + MODULE_ACTIONS="prepare_setPackages prepare_setImages + prepare_setManuals prepare_setLinks" shift 1 ;; --directories ) - ACTIONNAMS="${ACTIONNAMS} prepare_updateDirectoryStructure" + MODULE_ACTIONS="${MODULE_ACTIONS} prepare_updateDirectoryStructure" shift 1 ;; --synchronize ) - FLAG_SYNCHRONIZE="true" + TCAR_FLAG_SYNCHRONIZE="true" shift 1 ;; @@ -122,8 +123,4 @@ function prepare_getOptions { esac done - # Redefine CLI_FUNCTION_ARGUMENTS variable using current - # positional parameters. - cli_parseArgumentsReDef "$@" - } diff --git a/Automation/Modules/Prepare/Scripts/prepare_seeEnvironment.sh b/Automation/Modules/Prepare/Scripts/prepare_seeEnvironment.sh deleted file mode 100755 index b0d98cf..0000000 --- a/Automation/Modules/Prepare/Scripts/prepare_seeEnvironment.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# -# prepare_seeEnvironment.sh -- This function outputs a brief description of -# relevant environment variables used by `centos-art.sh' script. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_seeEnvironment { - - local -a VARS - local -a INFO - local COUNT=0 - - # Define name of environment variables used by centos-art.sh - # script. - VARS[0]='EDITOR' - VARS[1]='TZ' - VARS[2]='TEXTDOMAIN' - VARS[3]='TEXTDOMAINDIR' - VARS[4]='LANG' - VARS[5]='TCAR_WORKDIR' - - # Define description of environment variables. - INFO[0]="`gettext "Default text editor"`" - INFO[1]="`gettext "Default time zone representation"`" - INFO[2]="`gettext "Default domain used to retrieve translated messages"`" - INFO[3]="`gettext "Default directory used to retrive translated messages"`" - INFO[4]="`gettext "Default locale information"`" - INFO[5]="`gettext "Default path to your working copy"`" - - until [[ $COUNT -eq ${#VARS[*]} ]];do - - # Let user to reduce output using regular expression as - # reference. - if [[ ${VARS[$COUNT]} =~ $FLAG_FILTER ]];then - - # Output list of environment variables using indirect - # expansion (what a beautiful feature!) to output variable - # value. - cli_printMessage "${INFO[$COUNT]}:" - cli_printMessage "${VARS[$COUNT]}=${!VARS[$COUNT]}" --as-response-line - - fi - - # Increment counter. - COUNT=$(($COUNT + 1)) - - done - -} diff --git a/Automation/Modules/Prepare/Scripts/prepare_setConfiguration.sh b/Automation/Modules/Prepare/Scripts/prepare_setConfiguration.sh new file mode 100755 index 0000000..533134d --- /dev/null +++ b/Automation/Modules/Prepare/Scripts/prepare_setConfiguration.sh @@ -0,0 +1,69 @@ +#!/bin/bash +###################################################################### +# +# prepare_setConfiguration.sh -- This function builds a list of +# configuration files and calls the render module for processing it. +# The list of configuration files is built using the first argument +# provided to this function as reference. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# Key fingerprint = D67D 0F82 4CBD 90BC 6421 DF28 7CCE 757C 17CA 3951 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare_setConfiguration { + + local FILENAME=${1} + + # Verify the file name passed to this function. Just to avoid + # trickery when building the list of configuration files. + cli_checkFiles "${FILENAME}" --match="^(images|links|manual)$" + + # Build list of configuration files to be produced. + local CONFIGURATION_FILES=$(cli_getFilesList \ + ${TCAR_BASEDIR} --type="f" --pattern=".+/${FILENAME}\.conf") + + # Verify list of configuration files. + if [[ -z ${CONFIGURATION_FILES} ]];then + return + fi + + # CAUTION: The order in which configuration files are processed is + # relevant to final production result. For example, in order for + # theme images to hold the branding information the + # `Artworks/Brands' directory must be rendered before the + # `Artworks/Themes' directory. The reason of this is that brand + # images are not drawn inside theme design models themselves, but + # combined with theme images using the ImageMagick tool suite once + # they both have been rendered as PNG files. + + # Rebuild the list of configuration files to grant brand correct + # production order when they are included in the list of files to + # produce. + echo "${CONFIGURATION_FILES}" | grep "${TCAR_BASEDIR}/Artworks/Brands" > /dev/null + if [[ $? -eq 0 ]];then + CONFIGURATION_FILES="${TCAR_BASEDIR}/Artworks/Brands + $(echo "${CONFIGURATION_FILES}" | grep -v "${TCAR_BASEDIR}/Artworks/Brands")" + fi + + # Process configuration files using render module. + cli_runFnEnvironment render ${CONFIGURATION_FILES} + +} diff --git a/Automation/Modules/Prepare/Scripts/prepare_setImages.sh b/Automation/Modules/Prepare/Scripts/prepare_setImages.sh new file mode 100755 index 0000000..6554ed0 --- /dev/null +++ b/Automation/Modules/Prepare/Scripts/prepare_setImages.sh @@ -0,0 +1,33 @@ +#!/bin/bash +###################################################################### +# +# prepare_setImages.sh -- This function is an interface for +# prepare_setConfiguration function. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# Key fingerprint = D67D 0F82 4CBD 90BC 6421 DF28 7CCE 757C 17CA 3951 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare_setImages { + + prepare_setConfiguration "images" + +} diff --git a/Automation/Modules/Prepare/Scripts/prepare_setLinks.sh b/Automation/Modules/Prepare/Scripts/prepare_setLinks.sh new file mode 100755 index 0000000..6239e14 --- /dev/null +++ b/Automation/Modules/Prepare/Scripts/prepare_setLinks.sh @@ -0,0 +1,33 @@ +#!/bin/bash +###################################################################### +# +# prepare_setImages.sh -- This function is an interface for +# prepare_setConfiguration function. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# Key fingerprint = D67D 0F82 4CBD 90BC 6421 DF28 7CCE 757C 17CA 3951 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare_setLinks { + + prepare_setConfiguration "links" + +} diff --git a/Automation/Modules/Prepare/Scripts/prepare_setManuals.sh b/Automation/Modules/Prepare/Scripts/prepare_setManuals.sh new file mode 100755 index 0000000..59c6348 --- /dev/null +++ b/Automation/Modules/Prepare/Scripts/prepare_setManuals.sh @@ -0,0 +1,33 @@ +#!/bin/bash +###################################################################### +# +# prepare_setImages.sh -- This function is an interface for +# prepare_setConfiguration function. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# Key fingerprint = D67D 0F82 4CBD 90BC 6421 DF28 7CCE 757C 17CA 3951 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare_setManuals { + + prepare_setConfiguration "manual" + +} diff --git a/Automation/Modules/Prepare/Scripts/prepare_setPackages.sh b/Automation/Modules/Prepare/Scripts/prepare_setPackages.sh new file mode 100755 index 0000000..00de94d --- /dev/null +++ b/Automation/Modules/Prepare/Scripts/prepare_setPackages.sh @@ -0,0 +1,73 @@ +#!/bin/bash +###################################################################### +# +# prepare_setPackages.sh -- This function verifies packages +# required by centos-art.sh script and prints a list of installed +# and missing packages based on it. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# Key fingerprint = D67D 0F82 4CBD 90BC 6421 DF28 7CCE 757C 17CA 3951 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare_setPackages { + + local PACKAGES_REQUIRED="inkscape ImageMagick netpbm + netpbm-progs syslinux gimp coreutils texinfo texinfo-tex info + tetex-latex tetex-fonts tetex-xdvi tetex-dvips gettext texi2html + gnome-doc-utils elinks docbook-style-xsl docbook-utils + docbook-dtds docbook-style-dsssl docbook-simple docbook-utils-pdf + docbook-slides firefox sudo yum rpm ctags vim-enhanced asciidoc + dblatex" + + local -x PACKAGES_THIRDPARTY='(inkscape|asciidoc|dblatex)' + + for PACKAGE in ${PACKAGES_REQUIRED};do + rpm -q ${PACKAGE} --quiet + if [[ $? -ne 0 ]];then + PACKAGES_UNINSTALLED="${PACKAGES_UNINSTALLED} ${PACKAGE}" + fi + done + + local YUM_OPTIONS='' + if [[ ${TCAR_FLAG_YES} == 'true' ]];then + YUM_OPTIONS='-y' + fi + if [[ ${TCAR_FLAG_QUIET} == 'true' ]];then + YUM_OPTIONS="${YUM_OPTIONS} --quiet" + fi + + if [[ ! -z ${PACKAGES_UNINSTALLED} ]];then + cli_printMessage "`gettext "The following packages need to be installed:"`" --as-banner-line + for PACKAGE in ${PACKAGES_UNINSTALLED};do + if [[ ${PACKAGE} =~ ${PACKAGES_THIRDPARTY} ]];then + cli_printMessage "${PACKAGE} (`gettext "from third party repository"`)" --as-response-line + else + cli_printMessage "${PACKAGE}" --as-response-line + fi + done + cli_printMessage '-' --as-separator-line + cli_printMessage "`gettext "Do you want to continue"`" --as-yesornorequest-line + sudo yum install ${YUM_OPTIONS} ${PACKAGES_UNINSTALLED} + else + cli_printMessage "`gettext "All required packages are already installed."`" --as-banner-line + fi + +} diff --git a/Automation/Modules/Prepare/Scripts/prepare_updateEnvironment.sh b/Automation/Modules/Prepare/Scripts/prepare_updateEnvironment.sh deleted file mode 100755 index 9128015..0000000 --- a/Automation/Modules/Prepare/Scripts/prepare_updateEnvironment.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# -# prepare_updateEnvironment.sh -- This function updates the -# `~/.bash_profile' file to provide default configuration values to -# centos-art.sh script. Those values which aren't set by this function -# are already set in the `bash_profile.conf' template file we use as -# reference to create the `~/.bash_profile' file. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_updateEnvironment { - - # Verify that centos-art.sh script is run using an absolute path. - # We use this information to determine the exact working copy - # location to use, later when `bash_profile' file is created. - if [[ ! $0 =~ "^${HOME}/.+/${CLI_NAME}.sh$" ]];then - cli_printMessage "`gettext "To set environment variables you should run centos-art.sh using its abosolute path."`" --as-error-line - fi - - local PROFILE=bash_profile - local SOURCE=${PREPARE_CONFIG_DIR}/${PROFILE}.conf - local TARGET=${HOME}/.${PROFILE} - - # Determine the repository absolute path using the script absolute - # path the script has been executed from. Be careful when you use - # the centos-art command. It points to ~/bin directory which is - # not (and must not be) the repository working copy absolute path. - if [[ $TCAR_WORKDIR =~ "^${HOME}/bin" ]];then - cli_printMessage "`eval_gettext "The repository working directory cannot be $HOME/bin"`" --as-error-line - else - local TCAR_WORKDIR=$(dirname "$0" | sed "s,/${TCAR_BASHSCRIPTS},,") - fi - - # Determine which is the brand information that will be used as - # repository brand information. By default we are using `centos' - # and shouldn't be change to anything else, at least if you - # pretend to produce content for The CentOS Project. - local TCAR_BRAND='centos' - - # Print action message. - cli_printMessage "${TARGET}" --as-updating-line - - # Copy default configuration file to its final destination. Note - # that we are not making a link here in order for different users - # to be able of using different values in their own environments. - cp -f $SOURCE $TARGET - - # Update bash_profile file with default values. - sed -i -r \ - -e "s,^(TCAR_WORKDIR=).*,\1${TCAR_WORKDIR}," \ - -e "s,^(TCAR_BRAND=).*,\1${TCAR_BRAND}," \ - ${TARGET} - -} diff --git a/Automation/Modules/Prepare/Scripts/prepare_updateImages.sh b/Automation/Modules/Prepare/Scripts/prepare_updateImages.sh deleted file mode 100755 index 6b5b030..0000000 --- a/Automation/Modules/Prepare/Scripts/prepare_updateImages.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# prepare_updateImages.sh -- This option initializes image files inside -# the working copy. When you provide this option, the centos-art.sh -# scripts renders image files from all design models available in the -# working copy. This step is required in order to satisfy dependencies -# from different components inside the working copy. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_updateImages { - - # Define list of directories that need to be rendered. - local DIRS=$(cli_getFilesList \ - ${TCAR_WORKDIR}/Identity/Images --maxdepth="1" \ - --mindepth="1" --type="d" --pattern=".+/[[:alnum:]]+") - - # CAUTION: The order in which the image components are rendered is - # very important. For example, in order for theme images to hold - # the branding information the `Identity/Images/Brands' directory - # must be rendered before the `Identity/Images/Themes' directory. - # The reason of this is that brand images are not draw inside - # theme design models themselves, but combined with theme images - # using the ImageMagick tool suite once both have been rendered. - - # Update list of directories to be sure that brands will always be - # rendered as first image component. Here we remove the brand - # component from the list and add it explicitly on top of all - # other directories in the list. - DIRS="${TCAR_WORKDIR}/Identity/Images/Brands - $(echo "$DIRS" | grep -v 'Identity/Images/Brands')" - - # Render image components using the list of directories. - cli_runFnEnvironment render ${DIRS} --with-brands - -} diff --git a/Automation/Modules/Prepare/Scripts/prepare_updateLinks.sh b/Automation/Modules/Prepare/Scripts/prepare_updateLinks.sh deleted file mode 100755 index 70a18fb..0000000 --- a/Automation/Modules/Prepare/Scripts/prepare_updateLinks.sh +++ /dev/null @@ -1,183 +0,0 @@ -#!/bin/bash -# -# prepare_updateLinks.sh -- This option creates/updates the symbolic links -# information required in your workstation to connect it with the -# files inside the working copy of The CentOS Artwork Repository. When -# you provide this option, the centos-art.sh put itself into your -# system's execution path and make common brushes, patterns, palettes -# and fonts available inside applications like GIMP, so you can make -# use of them without loosing version control over them. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_updateLinks { - - local -a LINKS_SRC - local -a LINKS_DST - local USERFILES='' - local PALETTE='' - local BRUSH='' - local PATTERN='' - local FONT='' - local FILE='' - local COUNT=0 - - # Define user's directories. Here is where configuration links are - # created in the local workstation. - local GIMP_DIR=${HOME}/.$(rpm -q gimp | cut -d. -f-2) - local GIMP_DIR_BRUSHES=${GIMP_DIR}/brushes - local GIMP_DIR_PALETTES=${GIMP_DIR}/palettes - local GIMP_DIR_PATTERNS=${GIMP_DIR}/patterns - local INKS_DIR=${HOME}/.inkscape - local INKS_DIR_PALETTES=${INKS_DIR}/palettes - local FONT_DIR=${HOME}/.fonts - local APPS_DIR=${HOME}/bin - - # Define the working copy directory structure. Here is where user - # specific configuration links in the workstation will point to. - local WCDIR=${TCAR_WORKDIR}/Identity - local WCDIR_BRUSHES=${WCDIR}/Brushes - local WCDIR_PALETTES=${WCDIR}/Palettes - local WCDIR_PATTERNS=${WCDIR}/Patterns - local WCDIR_FONTS=${WCDIR}/Fonts - local WCDIR_EDITOR=${PREPARE_CONFIG_DIR} - - # Verify required working copy directory structure. If these - # directories don't exist, there isn't a target location where - # configuration links can point to. To prevent such an issue - # output an error message and stop the script execution after it. - for DIR in $(echo "Brushes Palettes Patterns Fonts");do - cli_checkFiles ${WCDIR}/${DIR} - done - - # Define link relation for cli. - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${APPS_DIR}/${CLI_NAME} - LINKS_DST[((++${#LINKS_DST[*]}))]=${CLI_BASEDIR}/${CLI_NAME}.sh - USERFILES="${APPS_DIR}/${CLI_NAME}" - - # Define link relation for fonts. - for FONT in $(cli_getFilesList "${WCDIR_FONTS}" --pattern='^.+\.ttf$');do - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${FONT_DIR}/$(basename $FONT) - LINKS_DST[((++${#LINKS_DST[*]}))]=${FONT} - done - - # Define link relation for common palettes. - for PALETTE in $(cli_getFilesList "${WCDIR_PALETTES}" --pattern="^.+\.gpl$");do - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_PALETTES}/$(prepare_getLinkName ${WCDIR_PALETTES} ${PALETTE}) - LINKS_DST[((++${#LINKS_DST[*]}))]=${PALETTE} - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${INKS_DIR_PALETTES}/$(prepare_getLinkName ${WCDIR_PALETTES} ${PALETTE}) - LINKS_DST[((++${#LINKS_DST[*]}))]=${PALETTE} - done - - # Define link relation for common brushes. - for BRUSH in $(cli_getFilesList "${WCDIR_BRUSHES}" --pattern="^.+\.(gbr|gih)$");do - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_BRUSHES}/$(prepare_getLinkName ${WCDIR_BRUSHES} ${BRUSH}) - LINKS_DST[((++${#LINKS_DST[*]}))]=${BRUSH} - done - - # Define link relation for common patterns. - for PATTERN in $(cli_getFilesList "${WCDIR_PATTERNS}" --pattern="^.+\.png$");do - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_PATTERNS}/$(prepare_getLinkName ${WCDIR_BRUSHES} ${BRUSH}) - LINKS_DST[((++${#LINKS_DST[*]}))]=${PATTERN} - done - - # Define link relation for Vim text editor's configuration. - if [[ $EDITOR == '/usr/bin/vim' ]];then - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${HOME}/.vimrc - LINKS_DST[((++${#LINKS_DST[*]}))]=${WCDIR_EDITOR}/vim.conf - USERFILES="${USERFILES} ${HOME}/.vimrc" - fi - - # Define link relation for the `reset.css' file. The `reset.css' - # file is resets the web browser default style and use ours - # instead. The reset.css file is common for all web environments - # so there is no need to have duplicated files inside the working - # copy. Instead, create a symbolic link to it from different - # places using absolute paths and the default style guide as - # reference. - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${TCAR_WORKDIR}/Identity/Webenv/Themes/Default/Docbook/1.69.1/Css/reset.css - LINKS_DST[((++${#LINKS_DST[*]}))]=${TCAR_WORKDIR}/Identity/Webenv/Themes/Default/Style-guide/0.0.1/Css/reset.css - - # Define link relation for `images' directory used inside the - # default web environment style guide. The `images' directory - # contains common images used by all web environments. By default - # no image is under version control so we point out the output - # directory where this images produced, once rendered. - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${TCAR_WORKDIR}/Identity/Webenv/Themes/Default/Style-guide/0.0.1/Images - LINKS_DST[((++${#LINKS_DST[*]}))]=${TCAR_WORKDIR}/Identity/Images/Webenv - - # Define link relation for `Manuals' images. These images exists - # to help people describe ideas inside documentation. - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${TCAR_WORKDIR}/Identity/Images/Webenv/Manuals - LINKS_DST[((++${#LINKS_DST[*]}))]=${TCAR_WORKDIR}/Identity/Images/Manuals - - # Define link for `centos-logo.png', the branding information that - # should be used in all web applications on the left-top corner. - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${TCAR_WORKDIR}/Identity/Images/Webenv/logo-centos.png - LINKS_DST[((++${#LINKS_DST[*]}))]=${TCAR_WORKDIR}/Identity/Images/Brands/Logos/White/78/centos.png - - # Define which files inside the user's configuration directories - # need to be removed in order for centos-art.sh script to make a - # fresh installation of common patterns, common palettes and - # common brushes using symbolic links from the working copy to the - # user's configuration directories inside the workstation. - USERFILES=$(echo "$USERFILES"; - cli_getFilesList ${APPS_DIR} --pattern='^.+\.sh$'; - cli_getFilesList ${FONT_DIR} --pattern='^.+\.ttf$'; - cli_getFilesList ${GIMP_DIR_BRUSHES} --pattern='^.+\.(gbr|gih)$'; - cli_getFilesList ${GIMP_DIR_PATTERNS} --pattern='^.+\.(pat|png|jpg|bmp)$'; - cli_getFilesList ${GIMP_DIR_PALETTES} --pattern='^.+\.gpl$'; - cli_getFilesList ${INKS_DIR_PALETTES} --pattern='^.+\.gpl$';) - - # Remove user-specific configuration files from user's home - # directory before creating symbolic links from the working copy. - # Otherwise, we might end up having links inside the user's home - # directory that don't exist inside the working copy. - if [[ "$USERFILES" != '' ]];then - rm -r $USERFILES - fi - - while [[ $COUNT -lt ${#LINKS_SRC[*]} ]];do - - # Print action message. - cli_printMessage "${LINKS_SRC[$COUNT]}" --as-creating-line - - # Create symbolic link's parent directory if it doesn't exist. - if [[ ! -d $(dirname ${LINKS_SRC[$COUNT]}) ]];then - mkdir -p $(dirname ${LINKS_SRC[$COUNT]}) - fi - - # Remove symbolic link before creating it to prevent recursive - # creation once the first symbolic link be created and it be a - # directory. - if [[ -a ${LINKS_SRC[$COUNT]} ]];then - rm ${LINKS_SRC[$COUNT]} - fi - - # Create symbolic link. - ln ${LINKS_DST[$COUNT]} ${LINKS_SRC[$COUNT]} --symbolic --force - - # Increment counter. - COUNT=$(($COUNT + 1)) - - done - -} diff --git a/Automation/Modules/Prepare/Scripts/prepare_updateLocales.sh b/Automation/Modules/Prepare/Scripts/prepare_updateLocales.sh deleted file mode 100755 index bb66e22..0000000 --- a/Automation/Modules/Prepare/Scripts/prepare_updateLocales.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# prepare_updateLocales.sh -- This function creates/updates the -# machine object (.mo) file gettext uses to output translated messages -# when centos-art.sh script is running. Certainly, what this function -# really does is a call to the locale functionality of centos-art.sh -# script to realize and update action against itself. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_updateLocales { - - # Realize localization tasks only when the current locale - # information is different to English language. Otherwise - # centos-art.sh would complain with an `English language cannot be - # localized to itself' message. Avoid this noise in the - # preparation stuff. - if [[ ! ${CLI_LANG_LL} =~ '^en' ]];then - cli_runFnEnvironment locale Scripts/Bash --update - fi - -} diff --git a/Automation/Modules/Prepare/Scripts/prepare_updateManuals.sh b/Automation/Modules/Prepare/Scripts/prepare_updateManuals.sh deleted file mode 100755 index a5f5a40..0000000 --- a/Automation/Modules/Prepare/Scripts/prepare_updateManuals.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# prepare_updateManuals.sh -- This option initializes documentation files -# inside the working copy. When you provide this option, the -# centos-art.sh script renders all documentation manuals from their -# related source files so you can read them nicely. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_updateManuals { - - # Render key documentation manuals. - cli_runFnEnvironment render Documentation/Models/Docbook/Tcar-ug - cli_runFnEnvironment help --update --format="texinfo" tcar-fs::: - -} diff --git a/Automation/Modules/Prepare/Scripts/prepare_updatePackages.sh b/Automation/Modules/Prepare/Scripts/prepare_updatePackages.sh deleted file mode 100755 index fdf2fc0..0000000 --- a/Automation/Modules/Prepare/Scripts/prepare_updatePackages.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# -# prepare_updatePackages.sh -- This function verifies the required -# packages your workstation needs to have installed in order for -# `centos-art.sh' script to run correctly. If there is one or more -# missing packages, the `centos-art.sh' script asks you to confirm -# their installation through `sudo yum'. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_updatePackages { - - local PACKAGE='' - local PACKAGES='' - local PACKAGES_THIRDS='' - local -a PACKAGES_MISSING - local -a PACKAGES_INSTALL - local RPM='/bin/rpm' - local YUM='/usr/bin/yum' - local YUM_OPTIONS='' - - # Check execution rights of package managers. - cli_checkFiles -x $RPM - cli_checkFiles -x $YUM - - # Define required packages needed by centos-art.sh script. - PACKAGES="inkscape ImageMagick netpbm netpbm-progs syslinux gimp - coreutils texinfo texinfo-tex info tetex-latex tetex-fonts - tetex-xdvi tetex-dvips gettext texi2html gnome-doc-utils - elinks docbook-style-xsl docbook-utils docbook-dtds - docbook-style-dsssl docbook-simple docbook-utils-pdf - docbook-slides firefox sudo yum rpm ctags vim-enhanced" - - # Define packages from third party repositories (i.e., packages - # not included in CentOS [base] repository.) required by - # centos-art to work as expected. - PACKAGES_THIRDS="(inkscape|blender)" - - # Build list of installed and missing packages. - for PACKAGE in $PACKAGES;do - $RPM -q --queryformat "%{NAME}\n" $PACKAGE --quiet - if [[ $? -ne 0 ]];then - PACKAGES_MISSING[((++${#PACKAGES_MISSING[*]}))]=$PACKAGE - else - PACKAGES_INSTALL[((++${#PACKAGES_INSTALL[*]}))]=$PACKAGE - fi - done - - # Define relation between centos-art.sh options and yum options. - [[ $FLAG_ANSWER == 'true' ]] && YUM_OPTIONS="${YUM_OPTIONS} -y" - [[ $FLAG_QUIET == 'true' ]] && YUM_OPTIONS="${YUM_OPTIONS} -q" - - # Use `sudo yum' to install missing packages in your workstation. - if [[ ${#PACKAGES_MISSING[*]} -gt 0 ]];then - sudo ${YUM} ${YUM_OPTIONS} install ${PACKAGES_MISSING[*]} - fi - - # Use `sudo yum' to update installed packages in your workstation. - if [[ ${#PACKAGES_INSTALL[*]} -gt 0 ]];then - sudo ${YUM} ${YUM_OPTIONS} update ${PACKAGES_INSTALL[*]} - fi - -} diff --git a/Automation/Modules/Prepare/prepare.asciidoc b/Automation/Modules/Prepare/prepare.asciidoc new file mode 100644 index 0000000..1f895a3 --- /dev/null +++ b/Automation/Modules/Prepare/prepare.asciidoc @@ -0,0 +1,83 @@ +prepare(1) +========== + +Name +---- +prepare - Prepare your workstation to start using the CentOS artwork +repository. + +Synopsis +-------- +centos-art prepare [--help|--version|--quiet|--yes|--packages|--images|--manuals|--links|--directories|--synchronize] + +Description +----------- +The *prepare* module of *centos-art.sh* script standardizes the +configuration tasks you need to perform after downloading a fresh +working copy of CentOS artwork repository. + +Options +------- +The *prepare* module has the following options: + +*--help*:: + This option shows the module's documentation (this page). +*--version*:: + This option shows the module's name and version. +*--yes*:: + This option assumes yes to all questions. +*--quiet*:: + This option suppresses all outputs except script's errors. +*--packages*:: + This option verifies whether or not required packages are installed in the + workstation. When required packages are not installed in the workstation, + the *prepare* module executes the *yum install* command through *sudo* to + install the required packages. +*--images*:: + This option calls the *render* module of *centos-art.sh* script + and produces content related to all +images.conf+ files found + inside the repository's root directory. +*--manuals*:: + This option calls the *render* module of *centos-art.sh* script + and produces content related to all +manual.conf+ files found + inside the repository's root directory. +*--links*:: + This option calls the *render* module of *centos-art.sh* script + and produces content related to all +links.conf+ files found + inside the repository's root directory. +*--directories*:: + This option produces mirrored directories structures. +*--synchronize*:: + This option brings remote changes from central repository up to + the working copy and pushes local changes from working copy up to + the central repository, using the repository's version control + system (e.g., git or subversion). + +Reporting Bugs +-------------- +Report bugs on the *automation* category of *centos-artwork* project +at the https://centos.org.cu/bugs/[The CentOS Bugs] website. + +Author +------ +Written by mailto:al@centos.org.cu[Alain Reguera Delgado] + +Copyright +--------- +Copyright (C) 2013 The CentOS Project + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +// vim: set syntax=asciidoc: diff --git a/Automation/Modules/Prepare/prepare.conf b/Automation/Modules/Prepare/prepare.conf new file mode 100755 index 0000000..8e747e3 --- /dev/null +++ b/Automation/Modules/Prepare/prepare.conf @@ -0,0 +1,47 @@ +#!/bin/bash +###################################################################### +# +# prepare.conf -- This file provides default configuration values to +# centos-art.sh script's prepare module. +# +# Written by: +# * Alain Reguera Delgado , 2013 +# Key fingerprint = D67D 0F82 4CBD 90BC 6421 DF28 7CCE 757C 17CA 3951 +# +# Copyright (C) 2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +# -------------------------------------------------------------------- +# Module-specific configuration variables. +# -------------------------------------------------------------------- +declare -xr MODULE_VERSION='0.1' +declare -x MODULE_BASEDIR=${MODULE_DIR}/Modules +declare -x MODULE_ACTIONS='' + +# -------------------------------------------------------------------- +# Internationalization configuration variables. +# -------------------------------------------------------------------- +declare -x TEXTDOMAIN=${MODULE_NAME} +declare -x TEXTDOMAINDIR=${MODULE_DIR}/Locales + +# -------------------------------------------------------------------- +# Redefine manuals configuration values. +# -------------------------------------------------------------------- +declare -x TCAR_MANUAL_FILE=${MODULE_DIR}/${MODULE_NAME}.asciidoc +declare -x TCAR_MANUAL_SEARCHPATH=${MODULE_DIR}/Manuals +declare -x TCAR_MANUAL_READER="/usr/bin/man -M ${TCAR_MANUAL_SEARCHPATH}" diff --git a/Automation/Modules/Prepare/prepare.sh b/Automation/Modules/Prepare/prepare.sh index c28015e..4f81b52 100755 --- a/Automation/Modules/Prepare/prepare.sh +++ b/Automation/Modules/Prepare/prepare.sh @@ -1,9 +1,21 @@ #!/bin/bash +###################################################################### # -# prepare.sh (initialization) -- This function creates the base -# execution environment required to standardize final configuration -# stuff needed by your workstation, once the working copy of The -# CentOS Artwork Repository has been downloaded in it. +# prepare.sh -- This function standardizes configuration tasks +# needed by files inside the working copy. +# +# When you download a fresh working copy of CentOS artwork +# repository, most of its content is in source format. You need to +# process source formats in order to produce final content and make +# the connections between components (e.g., render brand images so +# they can be applied to other images). This function takes care of +# those actions and should be the first module you run in your +# workstation after downloading a fresh working copy of CentOS +# artwork repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# Key fingerprint = D67D 0F82 4CBD 90BC 6421 DF28 7CCE 757C 17CA 3951 # # Copyright (C) 2009-2013 The CentOS Project # @@ -21,51 +33,25 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- +###################################################################### function prepare { - echo 'Hi! I reached the "prepare" function.' - exit - - local ACTIONNAM='' - local ACTIONNAMS='' - - # Define absolute path to directory holding prepare's - # configuration files. - local PREPARE_CONFIG_DIR=${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}/Config + # Initialize module-specific configuration values. + if [[ -f ${MODULE_DIR}/${MODULE_NAME}.conf ]];then + . ${MODULE_DIR}/${MODULE_NAME}.conf + fi # Interpret arguments and options passed through command-line. - prepare_getOptions + prepare_getOptions "${@}" - # Redefine positional parameters using CLI_FUNCTION_ARGUMENTS. At - # this point, option arguments have been removed from - # CLI_FUNCTION_ARGUMENTS variable and only non-option arguments - # remain in it. - eval set -- "$CLI_FUNCTION_ARGUMENTS" + # Reset positional parameters on this function, using output + # produced from (getopt) arguments parser. + eval set -- "${TCAR_ARGUMENTS}" - # Execute action names based on whether they were provided or not. - if [[ $ACTIONNAMS == '' ]];then - - # When action names are not provided, define action names that - # will take place, explicitly. - prepare_updateEnvironment - prepare_updatePackages - prepare_updateLocales - prepare_updateLinks - prepare_updateImages - prepare_updateManuals - - else - - # When action names are provided, loop through them and - # execute them one by one. - for ACTIONNAM in $ACTIONNAMS;do - ${ACTIONNAM} $@ - done - - fi + # Execute module-specific actions. + for MODULE_ACTION in ${MODULE_ACTIONS};do + ${MODULE_ACTION} "${@}" + done }