Blame Scripts/Bash/Functions/Commons/cli_getRepoParallelDirs.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# cli_getRepoParallelDirs.sh -- This function returns the parallel
878a2b
# directories related to the first positional paramenter passed as
878a2b
# parent directory. 
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 cli_getRepoParallelDirs {
878a2b
878a2b
    local BOND=''
878a2b
    local TDIR=''
878a2b
    local -a PDIRS
878a2b
878a2b
    # Define bond string using first positional parameter as
878a2b
    # reference.
878a2b
    if [[ "$1" != '' ]];then
878a2b
        BOND="$1"
878a2b
    elif [[ "$ACTIONVAL" != '' ]];then
878a2b
        BOND="$ACTIONVAL"
878a2b
    else
878a2b
        cli_printMessage "`gettext "The bond string is required."`" --as-error-line
878a2b
    fi
878a2b
878a2b
    # Define repository top level directory.
878a2b
    TDIR=$(cli_getRepoTLDir ${BOND})
878a2b
878a2b
    # Define parallel directory base structures.
878a2b
    PDIRS[0]=Manuals/$(cli_getCurrentLocale)/Texinfo/Repository/$(cli_getRepoTLDir ${BOND} --relative)
878a2b
    PDIRS[1]=Scripts/Bash/Functions/Render/Config
a1a636
    PDIRS[2]=Locales
878a2b
878a2b
    # Redefine bond string without its top level directory structure.
878a2b
    BOND=$(echo $BOND | sed -r "s,^${TDIR}/(.+)$,\1,")
878a2b
878a2b
    # Concatenate repository top level directory, parallel directory
878a2b
    # base structure, and bond information; in order to produce the
878a2b
    # final parallel directory path.
878a2b
    for PDIR in "${PDIRS[@]}";do
878a2b
        echo ${TDIR}/${PDIR}/${BOND}
878a2b
    done
878a2b
878a2b
}