Blame Scripts/Bash/Functions/Render/Svg/svg_doLastActions.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# svg_doLastActions.sh -- This function performs last-rendition
878a2b
# actions for SVG files.
878a2b
#
878a2b
# Copyright (C) 2009, 2010, 2011 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 svg_doLastActions {
878a2b
878a2b
    # Verify position of file being produced in the list of files been
878a2b
    # currently processed.
878a2b
    if [[ $THIS_FILE_DIR == $NEXT_FILE_DIR ]];then
878a2b
        return
878a2b
    fi
878a2b
878a2b
    local ACTION=''
878a2b
878a2b
    # Redefine SVG last-rendition actions as local to avoid undesired
878a2b
    # concatenation when massive rendition is performed.
878a2b
    local -a LASTACTIONS
878a2b
878a2b
    # Define SVG directory-specific actions. This is required in order
878a2b
    # to provide a predictable way of producing content inside the
878a2b
    # repository and save you the time of writing long several
878a2b
    # commands each time you need to produce images inside the
878a2b
    # repository.
878a2b
    if [[ $FLAG_DONT_DIRSPECIFIC == 'false' ]];then
878a2b
        if [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Gdm/.+\.svg$" ]];then
878a2b
            LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToDm:Gdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240'
878a2b
        elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Kdm/.+\.svg$" ]];then
878a2b
            LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToDm:Kdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240'
878a2b
        elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Ksplash/.+\.svg$" ]];then
878a2b
            LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToKsplash:'
878a2b
        fi
878a2b
    fi
878a2b
878a2b
    # Define SVG last-rendition actions. Since last-rendition makes
878a2b
    # use of all files in the output directory structure and
878a2b
    # directory-specific rendition modifies all the files in the
878a2b
    # output directory structure as well, these actions must be
878a2b
    # defined after the directory-specific definition. Otherwise,
878a2b
    # modifications impossed by these actions may interfier the whole
878a2b
    # purpose of having a directory-specific rendition.
878a2b
    [[ $FLAG_LASTRENDITION != '' ]] && LASTACTIONS[((++${#LASTACTIONS[*]}))]="doLastActions:(png|jpg):${FLAG_LASTRENDITION}"
878a2b
878a2b
    # At this point centos-art.sh should be producing the last file
878a2b
    # from the same unique directory structure, so, before producing
878a2b
    # images for the next directory structure lets execute the list of
878a2b
    # last-rendition actions for the current directory structure. 
878a2b
    for ACTION in "${LASTACTIONS[@]}"; do
878a2b
        svg_$(echo "$ACTION" | cut -d: -f1)
878a2b
    done
878a2b
878a2b
}