Blame tcar-scripts-prepare/prepare_setWorkplace.sh

Alain Reguera Delgado c554f1
#!/bin/bash
Alain Reguera Delgado c554f1
######################################################################
Alain Reguera Delgado c554f1
#
Alain Reguera Delgado a44aed
#   prepare_setWorkplace.sh -- This function rebuilds the workplace
Alain Reguera Delgado a44aed
#   directory structure based on The CentOS Artwork Repository
Alain Reguera Delgado a44aed
#   directory structure. This is required because The CentOS Artwork
Alain Reguera Delgado a44aed
#   Repository directory structure might change from one release to
Alain Reguera Delgado a44aed
#   another.
Alain Reguera Delgado c554f1
#
Alain Reguera Delgado c554f1
#   Written by:
Alain Reguera Delgado c554f1
#   * Alain Reguera Delgado <al@centos.org.cu>, 2009-2013
Alain Reguera Delgado c554f1
#
Alain Reguera Delgado c554f1
# Copyright (C) 2009-2013 The CentOS Artwork SIG
Alain Reguera Delgado c554f1
#
Alain Reguera Delgado c554f1
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado c554f1
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado c554f1
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado c554f1
# your option) any later version.
Alain Reguera Delgado c554f1
#
Alain Reguera Delgado c554f1
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado c554f1
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado c554f1
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado c554f1
# General Public License for more details.
Alain Reguera Delgado c554f1
#
Alain Reguera Delgado c554f1
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado c554f1
# along with this program; if not, write to the Free Software
Alain Reguera Delgado c554f1
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado c554f1
#
Alain Reguera Delgado c554f1
######################################################################
Alain Reguera Delgado c554f1
Alain Reguera Delgado a44aed
function prepare_setWorkplace {
Alain Reguera Delgado c554f1
Alain Reguera Delgado a44aed
    local CONF=''
Alain Reguera Delgado c554f1
Alain Reguera Delgado 70f7e0
    if [[ -d ${TCAR_WORKDIR} ]];then
Alain Reguera Delgado a44aed
        tcar_printMessage "`gettext "The workplace you provided already exist and will be removed."`" --as-stdout-line
Alain Reguera Delgado a44aed
        tcar_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line
Alain Reguera Delgado 70f7e0
        tcar_printMessage "${TCAR_WORKDIR}" --as-removing-line
Alain Reguera Delgado 70f7e0
        rm -r ${TCAR_WORKDIR}
Alain Reguera Delgado a44aed
    fi
Alain Reguera Delgado c554f1
Alain Reguera Delgado 70f7e0
    tcar_printMessage "${TCAR_WORKDIR}" --as-creating-line
Alain Reguera Delgado c554f1
Alain Reguera Delgado a44aed
    for CONF in $(prepare_getWorkplaceConf);do
Alain Reguera Delgado 70f7e0
        local TCAR_WORKDIR_DIR=$(prepare_getWorkplaceDir ${CONF})
Alain Reguera Delgado 70f7e0
        local TCAR_WORKDIR_LNK=${TCAR_WORKDIR_DIR}/render.conf
Alain Reguera Delgado 70f7e0
        mkdir -p ${TCAR_WORKDIR_DIR} && ln -s ${CONF} ${TCAR_WORKDIR_LNK}
Alain Reguera Delgado 70f7e0
        tcar_checkFiles -s ${TCAR_WORKDIR_LNK}
Alain Reguera Delgado a44aed
    done
Alain Reguera Delgado c554f1
Alain Reguera Delgado 70f7e0
    if [[ -d ${TCAR_WORKDIR}/Brands ]];then
Alain Reguera Delgado a44aed
        tcar_printMessage "`gettext "The workplace doesn't include images for branding other images."`"
Alain Reguera Delgado a44aed
        tcar_printMessage "`gettext "Do you want to render them now?"`" --as-yesornorequest-line
Alain Reguera Delgado 70f7e0
        prepare_setRenderEnvironment -o "render-type" -v "svg" ${TCAR_WORKDIR}/Brands
Alain Reguera Delgado a44aed
    fi
Alain Reguera Delgado c554f1
Alain Reguera Delgado a44aed
}