|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
d80041 |
# render.sh -- This function standardizes the way source files are
|
|
|
d80041 |
# rendered inside the working copy.
|
|
|
878a2b |
#
|
|
|
bfd78a |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
# it under the terms of the GNU General Public License as published by
|
|
|
878a2b |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
878a2b |
# your option) any later version.
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is distributed in the hope that it will be useful, but
|
|
|
878a2b |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
878a2b |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
# You should have received a copy of the GNU General Public License
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function render {
|
|
|
878a2b |
|
|
|
878a2b |
local ACTIONNAM=''
|
|
|
878a2b |
local ACTIONVAL=''
|
|
|
878a2b |
|
|
|
878a2b |
# Initialize `--releasever' option. The release version option
|
|
|
878a2b |
# controls the release number used to produce release-specific
|
|
|
878a2b |
# content. By default, the release number of The CentOS
|
|
|
878a2b |
# Distribution you have installed in your workstation is used.
|
|
|
878a2b |
local FLAG_RELEASEVER=$(cat /etc/redhat-release \
|
|
|
878a2b |
| gawk '{ print $3 }')
|
|
|
878a2b |
|
|
|
878a2b |
# Initialize `--basearch' option. The base architecture option
|
|
|
878a2b |
# controls the architecture type used to produce
|
|
|
878a2b |
# architecture-specific content. By default, the hardware
|
|
|
878a2b |
# platform of your workstation is used.
|
|
|
878a2b |
local FLAG_BASEARCH=$(uname -i)
|
|
|
878a2b |
|
|
|
878a2b |
# Initialize `--theme-model' option. The theme model option
|
|
|
d62ffc |
# specifies the theme model name used to produce theme
|
|
|
878a2b |
# artistic motifs.
|
|
|
878a2b |
local FLAG_THEME_MODEL='Default'
|
|
|
878a2b |
|
|
|
878a2b |
# Initialize `--post-rendition' option. This option defines what
|
|
|
d62ffc |
# command to use as post-rendition. Post-rendition takes place
|
|
|
878a2b |
# over base-rendition output.
|
|
|
878a2b |
local FLAG_POSTRENDITION=''
|
|
|
878a2b |
|
|
|
878a2b |
# Initialize `--last-rendition' option. This option defines what
|
|
|
d62ffc |
# command to use as last-rendition. Last-rendition takes place
|
|
|
878a2b |
# once both base-rendition and post-rendition has been performed
|
|
|
878a2b |
# in the same directory structure.
|
|
|
878a2b |
local FLAG_LASTRENDITION=''
|
|
|
878a2b |
|
|
|
878a2b |
# Initialize `--dont-dirspecific' option. This option can take two
|
|
|
878a2b |
# values only (e.g., `true' or `false') and controls whether to
|
|
|
878a2b |
# perform or not directory-specific rendition. Directory-specific
|
|
|
878a2b |
# rendition may use any of the three types of renditions (e.g.,
|
|
|
878a2b |
# base-rendition, post-rendition and last-rendition) to accomplish
|
|
|
878a2b |
# specific tasks when specific directory structures are detected
|
|
|
878a2b |
# in the rendition flow. By default, the centos-art.sh script
|
|
|
878a2b |
# performs directory-specific rendition.
|
|
|
878a2b |
local FLAG_DONT_DIRSPECIFIC='false'
|
|
|
878a2b |
|
|
|
878a2b |
# Initialize `--with-brands' option. This option controls whether
|
|
|
878a2b |
# to brand output images or not. By default output images are not
|
|
|
878a2b |
# branded.
|
|
|
878a2b |
local FLAG_WITH_BRANDS='false'
|
|
|
878a2b |
|
|
|
d80041 |
# Initialize list of supported file extensions. These file
|
|
|
d80041 |
# extensions are used to build the list of source files we'll use
|
|
|
d80041 |
# to create images from.
|
|
|
d80041 |
local RENDER_EXTENSIONS='svgz svg docbook conf'
|
|
|
d80041 |
|
|
|
d80041 |
# Initialize the rendition format name as an empty value. The name
|
|
|
d80041 |
# of rendition format is determined later at rendition time, based
|
|
|
d80041 |
# on template file extension.
|
|
|
24ece8 |
local RENDER_FORMAT=''
|
|
|
878a2b |
|
|
|
24ece8 |
# Initialize absolute path to format's base directory, the place
|
|
|
24ece8 |
# where format-specific directories are stored in.
|
|
|
24ece8 |
local RENDER_FORMAT_DIR="${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}"
|
|
|
878a2b |
|
|
|
878a2b |
# Interpret arguments and options passed through command-line.
|
|
|
878a2b |
render_getOptions
|
|
|
878a2b |
|
|
|
878a2b |
# Redefine positional parameters using ARGUMENTS. At this point,
|
|
|
878a2b |
# option arguments have been removed from ARGUMENTS variable and
|
|
|
878a2b |
# only non-option arguments remain in it.
|
|
|
878a2b |
eval set -- "$ARGUMENTS"
|
|
|
878a2b |
|
|
|
878a2b |
# Define action value. We use non-option arguments to define the
|
|
|
878a2b |
# action value (ACTIONVAL) variable.
|
|
|
878a2b |
for ACTIONVAL in "$@";do
|
|
|
878a2b |
|
|
|
741893 |
# Sanitate non-option arguments to be sure they match the
|
|
|
727117 |
# directory conventions established by centos-art.sh script
|
|
|
741893 |
# against source directory locations in the working copy.
|
|
|
dfe2cc |
ACTIONVAL=$(cli_checkRepoDirSource ${ACTIONVAL})
|
|
|
878a2b |
|
|
|
727117 |
# Verify non-option arguments passed to centos-art.sh
|
|
|
727117 |
# command-line. It should point to an existent directory under
|
|
|
727117 |
# version control inside the working copy. Otherwise, if it
|
|
|
727117 |
# doesn't point to a directory under version control, finish
|
|
|
727117 |
# the script execution with an error message.
|
|
|
727117 |
cli_checkFiles ${ACTIONVAL} -d --is-versioned
|
|
|
727117 |
|
|
|
d80041 |
# Define render-able directories and the way they are
|
|
|
d80041 |
# produced. To describe the way render-able directories are
|
|
|
727117 |
# produced, we take the action value (ACTIONVAL) as reference
|
|
|
727117 |
# and describe the production through an action name
|
|
|
727117 |
# (ACTIONNAM).
|
|
|
741893 |
if [[ $ACTIONVAL =~ "^${TCAR_WORKDIR}/trunk/Identity/Images/Themes" ]];then
|
|
|
878a2b |
ACTIONNAM="render_doThemeActions"
|
|
|
741893 |
elif [[ $ACTIONVAL =~ "^${TCAR_WORKDIR}/trunk/Identity/Images" ]];then
|
|
|
878a2b |
ACTIONNAM="render_doBaseActions"
|
|
|
7700f8 |
elif [[ $ACTIONVAL =~ "^${TCAR_WORKDIR}/trunk/Documentation/Manuals/Docbook/[[:alnum:]-]+" ]];then
|
|
|
878a2b |
ACTIONNAM="render_doBaseActions"
|
|
|
878a2b |
else
|
|
|
878a2b |
cli_printMessage "`gettext "The path provided doesn't support rendition."`" --as-error-line
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
d62ffc |
# Synchronize changes between repository and working copy. At
|
|
|
a02fee |
# this point, changes in the repository are merged in the
|
|
|
a02fee |
# working copy and changes in the working copy committed up to
|
|
|
a02fee |
# repository.
|
|
|
dfe2cc |
cli_synchronizeRepoChanges "${ACTIONVAL}"
|
|
|
a02fee |
|
|
|
878a2b |
# Execute action name.
|
|
|
878a2b |
${ACTIONNAM}
|
|
|
878a2b |
|
|
|
d62ffc |
# Synchronize changes between repository and working copy. At
|
|
|
878a2b |
# this point, changes in the repository are merged in the
|
|
|
878a2b |
# working copy and changes in the working copy committed up to
|
|
|
878a2b |
# repository.
|
|
|
dfe2cc |
cli_synchronizeRepoChanges "${ACTIONVAL}"
|
|
|
878a2b |
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
}
|