Blame Scripts/tcar_checkWorkplace.sh

Alain Reguera Delgado b8db2f
#!/bin/bash
Alain Reguera Delgado b8db2f
######################################################################
Alain Reguera Delgado b8db2f
#
Alain Reguera Delgado b8db2f
#   tcar - The CentOS Artwork Repository automation tool.
Alain Reguera Delgado b8db2f
#   Copyright © 2014 The CentOS Artwork SIG
Alain Reguera Delgado b8db2f
#
Alain Reguera Delgado b8db2f
#   This program is free software; you can redistribute it and/or
Alain Reguera Delgado b8db2f
#   modify it under the terms of the GNU General Public License as
Alain Reguera Delgado b8db2f
#   published by the Free Software Foundation; either version 2 of the
Alain Reguera Delgado b8db2f
#   License, or (at your option) any later version.
Alain Reguera Delgado b8db2f
#
Alain Reguera Delgado b8db2f
#   This program is distributed in the hope that it will be useful,
Alain Reguera Delgado b8db2f
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado b8db2f
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado b8db2f
#   General Public License for more details.
Alain Reguera Delgado b8db2f
#
Alain Reguera Delgado b8db2f
#   You should have received a copy of the GNU General Public License
Alain Reguera Delgado b8db2f
#   along with this program; if not, write to the Free Software
Alain Reguera Delgado b8db2f
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado b8db2f
#
Alain Reguera Delgado b8db2f
#   Alain Reguera Delgado <al@centos.org.cu>
Alain Reguera Delgado b8db2f
#   39 Street No. 4426 Cienfuegos, Cuba.
Alain Reguera Delgado b8db2f
#
Alain Reguera Delgado b8db2f
######################################################################
Alain Reguera Delgado b8db2f
Alain Reguera Delgado b8db2f
# Verify the repository workplace. This verification must be executed
Alain Reguera Delgado b8db2f
# on modules that read configuration files for producing final content
Alain Reguera Delgado b8db2f
# (e.g., render and locale). This verification forces automation
Alain Reguera Delgado b8db2f
# scripts to use the configuration file inside the working directory.
Alain Reguera Delgado b8db2f
# Such configuration file is created automatically by tcar-prepare(1)
Alain Reguera Delgado b8db2f
# command and contains the path information related to the working
Alain Reguera Delgado b8db2f
# directory where rendition actions will take place.
Alain Reguera Delgado b8db2f
function tcar_checkWorkplace {
Alain Reguera Delgado b8db2f
Alain Reguera Delgado b8db2f
    if [[ ! ${PWD} =~ "^${TCAR_WORKDIR}" \
Alain Reguera Delgado b8db2f
        || ! -f ${TCAR_WORKDIR}/${TCAR_SCRIPT_CONFIG_FILE} ]];then
Alain Reguera Delgado b8db2f
        tcar_printMessage "`gettext "Not a tcar working directory:"` ${PWD}" --as-error-line
Alain Reguera Delgado b8db2f
    fi
Alain Reguera Delgado b8db2f
Alain Reguera Delgado b8db2f
}