|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
07c2fe |
# render_doIdentityImages.sh -- This function renders image-based
|
|
|
07c2fe |
# identity contents.
|
|
|
4c79b5 |
#
|
|
|
9f5f2e |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
4c79b5 |
#
|
|
|
7cd8e9 |
# This program is free software; you can redistribute it and/or
|
|
|
7cd8e9 |
# modify it under the terms of the GNU General Public License as
|
|
|
7cd8e9 |
# published by the Free Software Foundation; either version 2 of the
|
|
|
7cd8e9 |
# License, or (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is distributed in the hope that it will be useful, but
|
|
|
4c79b5 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c79b5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# You should have received a copy of the GNU General Public License
|
|
|
4c79b5 |
# along with this program; if not, write to the Free Software
|
|
|
4c79b5 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
4c79b5 |
# USA.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function render_doIdentityImages {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
local EXPORTID=''
|
|
|
4c79b5 |
local EXTERNALFILES=''
|
|
|
e4d34a |
local EXTERNALFILE=''
|
|
|
d659a9 |
local COMMONDIRCOUNT=0
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Export id used inside design templates. This value defines the
|
|
|
4c79b5 |
# design area we want to export.
|
|
|
4c79b5 |
EXPORTID='CENTOSARTWORK'
|
|
|
4c79b5 |
|
|
|
15b1d2 |
# Start processing the base rendition list of FILES. Fun part
|
|
|
4c79b5 |
# approching :-).
|
|
|
4c79b5 |
for FILE in $FILES; do
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Call shared variable re-definitions.
|
|
|
4c79b5 |
render_getIdentityDefs
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Check export id inside design templates.
|
|
|
4c79b5 |
grep "id=\"$EXPORTID\"" $INSTANCE > /dev/null
|
|
|
4c79b5 |
if [[ $? -gt 0 ]];then
|
|
|
2d50e8 |
cli_printMessage "`eval_gettext "Can't found the export id (\\\$EXPORTID) inside \\\$TEMPLATE."`" "AsErrorLine"
|
|
|
15b1d2 |
cli_printMessage '-' 'AsSeparatorLine'
|
|
|
4c79b5 |
continue
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define final image width. If FILE name is a number, asume it
|
|
|
4c79b5 |
# as the width value of the image being rendered. Otherwise
|
|
|
4c79b5 |
# use design template default width value.
|
|
|
4c79b5 |
WIDTH=$(basename $FILE)
|
|
|
4c79b5 |
if [[ $WIDTH =~ '^[0-9]+$' ]];then
|
|
|
4c79b5 |
WIDTH="--export-width=$WIDTH"
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
WIDTH=''
|
|
|
4c79b5 |
fi
|
|
|
e287e0 |
|
|
|
34fcce |
# Check existence of external files. In order for design
|
|
|
34fcce |
# templates to point different artistic motifs, design
|
|
|
34fcce |
# templates make use of external files that point to specific
|
|
|
34fcce |
# artistic motif background images. If such external files
|
|
|
34fcce |
# doesn't exist, print a message and stop script execution.
|
|
|
34fcce |
# We cannot continue wihtout the background information.
|
|
|
34fcce |
EXTERNALFILES="(xlink:href|sodipodi:absref)=\"$(cli_getRepoTLDir $TEMPLATE)"
|
|
|
34fcce |
EXTERNALFILES=$(egrep "${EXTERNALFILES}" "${INSTANCE}" \
|
|
|
4c79b5 |
| sed -r 's!^[[:space:]]+!!' \
|
|
|
4c79b5 |
| sed -r 's!^(xlink:href|sodipodi:absref)="!!' \
|
|
|
b76c02 |
| sed -r 's!".*$!!' | sort | uniq)
|
|
|
e4d34a |
for EXTERNALFILE in $EXTERNALFILES;do
|
|
|
e4d34a |
cli_checkFiles $EXTERNALFILE
|
|
|
e4d34a |
done
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Render template instance and modify the inkscape output to
|
|
|
4c79b5 |
# reduce the amount of characters used in description column
|
|
|
4c79b5 |
# at final output.
|
|
|
2d50e8 |
cli_printMessage "$(inkscape $INSTANCE \
|
|
|
2d50e8 |
--export-id=$EXPORTID $WIDTH --export-png=$FILE.png | sed -r \
|
|
|
2d50e8 |
-e "s!Area !`gettext "Area"`: !" \
|
|
|
2d50e8 |
-e "s!Background RRGGBBAA:!`gettext "Background"`: RRGGBBAA!" \
|
|
|
2d50e8 |
-e "s!Bitmap saved as:!`gettext "Saved as"`:!")" \
|
|
|
2d50e8 |
'AsRegularLine'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Remove template instance.
|
|
|
4c79b5 |
if [[ -a $INSTANCE ]];then
|
|
|
4c79b5 |
rm $INSTANCE
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
15b1d2 |
# Execute post-rendition actions.
|
|
|
f3bce7 |
for ACTION in "${POSTACTIONS[@]}"; do
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case "$ACTION" in
|
|
|
4c79b5 |
|
|
|
46f314 |
renderSyslinux* )
|
|
|
2d50e8 |
render_doIdentityImageSyslinux "$FILE" "$ACTION"
|
|
|
4c79b5 |
;;
|
|
|
4c79b5 |
|
|
|
46f314 |
renderGrub* )
|
|
|
2d50e8 |
render_doIdentityImageGrub "$FILE" "$ACTION"
|
|
|
4c79b5 |
;;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
renderFormats:* )
|
|
|
2d50e8 |
render_doIdentityImageFormats "$FILE" "$ACTION"
|
|
|
4c79b5 |
;;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
renderBrands:* )
|
|
|
4c79b5 |
render_doIdentityImageBrands "$FILE" "$ACTION"
|
|
|
4c79b5 |
;;
|
|
|
4c79b5 |
|
|
|
ff3ea9 |
groupByType:* )
|
|
|
ff3ea9 |
render_doIdentityGroupByType "$FILE" "$ACTION"
|
|
|
4c79b5 |
;;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
esac
|
|
|
4c79b5 |
|
|
|
4c79b5 |
done
|
|
|
4c79b5 |
|
|
|
15b1d2 |
# Output separator line.
|
|
|
15b1d2 |
cli_printMessage '-' 'AsSeparatorLine'
|
|
|
4c79b5 |
|
|
|
d659a9 |
# Apply last-rendition actions. As convenction, last-rendition
|
|
|
d659a9 |
# actions are applied after all images inside the same
|
|
|
d659a9 |
# directory structure have been produced. Notice that, in
|
|
|
d659a9 |
# order to apply last-rendition actions correctly,
|
|
|
d659a9 |
# centos-art.sh needs to "predict" what the last file in the
|
|
|
d659a9 |
# same directory structure would be. There is no magic here,
|
|
|
d659a9 |
# so we need to previously define which are the common
|
|
|
d659a9 |
# directory structures centos-art.sh could produce content
|
|
|
d659a9 |
# for inside an array variable. Later, using the index of that
|
|
|
d659a9 |
# array variable we could check the next item in the array
|
|
|
d659a9 |
# against the file being currently produced. If they match, we
|
|
|
d659a9 |
# haven't reached the end of the same directory structure, but
|
|
|
d659a9 |
# if they don't match, we do have reach the end of the same
|
|
|
d659a9 |
# directory structure and it is time for last-rendition
|
|
|
d659a9 |
# actions to be evaluated before go producing the next
|
|
|
d659a9 |
# directory structure in the list of files to process.
|
|
|
d659a9 |
if [[ ${COMMONDIRS[$((COMMONDIRCOUNT + 1))]} != $(dirname $TRANSLATION) ]];then
|
|
|
d659a9 |
# At this point centos-art.sh is producing the last file
|
|
|
d659a9 |
# from the same unique directory structure, so, before
|
|
|
d659a9 |
# producing images for the next directory structure lets
|
|
|
d659a9 |
# evaluate last-rendition actions for the current
|
|
|
d659a9 |
# directory structure.
|
|
|
d659a9 |
for ACTION in "${LASTACTIONS[@]}"; do
|
|
|
d659a9 |
|
|
|
d659a9 |
case "$ACTION" in
|
|
|
d659a9 |
|
|
|
d659a9 |
renderKSplash )
|
|
|
d659a9 |
render_doIdentityImageKsplash
|
|
|
d659a9 |
;;
|
|
|
d659a9 |
|
|
|
d659a9 |
renderDm:* )
|
|
|
d659a9 |
render_doIdentityImageDm "$ACTION"
|
|
|
d659a9 |
;;
|
|
|
d659a9 |
|
|
|
d659a9 |
groupByType:* )
|
|
|
d659a9 |
render_doIdentityGroupByType "$ACTION"
|
|
|
d659a9 |
;;
|
|
|
d659a9 |
|
|
|
d659a9 |
esac
|
|
|
d659a9 |
done
|
|
|
d659a9 |
fi
|
|
|
ff3ea9 |
|
|
|
d659a9 |
# Increment common directory counter.
|
|
|
d659a9 |
COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1))
|
|
|
f3bce7 |
|
|
|
f3bce7 |
done
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|