Blame Automation/centos-art.sh-mods/Render/Svg/svg_doLastActions.sh

Alain Reguera Delgado 8f60cb
#!/bin/bash
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# svg_doLastActions.sh -- This function performs last-rendition
Alain Reguera Delgado 8f60cb
# actions for SVG files.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# Copyright (C) 2009-2013 The CentOS Project
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado 8f60cb
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado 8f60cb
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado 8f60cb
# your option) any later version.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado 8f60cb
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 8f60cb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado 8f60cb
# General Public License for more details.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado 8f60cb
# along with this program; if not, write to the Free Software
Alain Reguera Delgado 8f60cb
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
# $Id$
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
function svg_doLastActions {
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Verify position of file being produced in the list of files been
Alain Reguera Delgado 8f60cb
    # currently processed.
Alain Reguera Delgado 8f60cb
    if [[ $THIS_FILE_DIR == $NEXT_FILE_DIR ]];then
Alain Reguera Delgado 8f60cb
        return
Alain Reguera Delgado 8f60cb
    fi
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    local ACTION=''
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Redefine SVG last-rendition actions as local to avoid undesired
Alain Reguera Delgado 8f60cb
    # concatenation when massive rendition is performed.
Alain Reguera Delgado 8f60cb
    local -a LASTACTIONS
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Define SVG directory-specific actions. This is required in order
Alain Reguera Delgado 8f60cb
    # to provide a predictable way of producing content inside the
Alain Reguera Delgado 8f60cb
    # repository and save you the time of writing long several
Alain Reguera Delgado 8f60cb
    # commands each time you need to produce images inside the
Alain Reguera Delgado 8f60cb
    # repository.
Alain Reguera Delgado 8f60cb
    if [[ $FLAG_DONT_DIRSPECIFIC == 'false' ]];then
Alain Reguera Delgado 8f60cb
        if [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Gdm/.+\.svg$" ]];then
Alain Reguera Delgado 8f60cb
            LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToDm:Gdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240'
Alain Reguera Delgado 8f60cb
        elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Kdm/.+\.svg$" ]];then
Alain Reguera Delgado 8f60cb
            LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToDm:Kdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240'
Alain Reguera Delgado 8f60cb
        elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Ksplash/.+\.svg$" ]];then
Alain Reguera Delgado 8f60cb
            LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToKsplash:'
Alain Reguera Delgado 8f60cb
        fi
Alain Reguera Delgado 8f60cb
    fi
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Define SVG last-rendition actions. Since last-rendition makes
Alain Reguera Delgado 8f60cb
    # use of all files in the output directory structure and
Alain Reguera Delgado 8f60cb
    # directory-specific rendition modifies all the files in the
Alain Reguera Delgado 8f60cb
    # output directory structure as well, these actions must be
Alain Reguera Delgado 8f60cb
    # defined after the directory-specific definition. Otherwise,
Alain Reguera Delgado 8f60cb
    # modifications impossed by these actions may interfier the whole
Alain Reguera Delgado 8f60cb
    # purpose of having a directory-specific rendition.
Alain Reguera Delgado 8f60cb
    [[ $FLAG_LASTRENDITION != '' ]] && LASTACTIONS[((++${#LASTACTIONS[*]}))]="doLastActions:(png|jpg):${FLAG_LASTRENDITION}"
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # At this point centos-art.sh should be producing the last file
Alain Reguera Delgado 8f60cb
    # from the same unique directory structure, so, before producing
Alain Reguera Delgado 8f60cb
    # images for the next directory structure lets execute the list of
Alain Reguera Delgado 8f60cb
    # last-rendition actions for the current directory structure. 
Alain Reguera Delgado 8f60cb
    for ACTION in "${LASTACTIONS[@]}"; do
Alain Reguera Delgado 8f60cb
        svg_$(echo "$ACTION" | cut -d: -f1)
Alain Reguera Delgado 8f60cb
    done
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
}