Blame Automation/Modules/Help/Texinfo/texinfo_updateLicenseLink.sh

Alain Reguera Delgado 8f60cb
#!/bin/bash
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# texinfo_updateLicenseLink.sh -- This function updates the link
Alain Reguera Delgado 8f60cb
# information related to License directory used by Texinfo
Alain Reguera Delgado 8f60cb
# documentation manuals. There isn't a need to duplicate the License 
Alain Reguera Delgado 8f60cb
# information in each documentation manual. In fact it is important
Alain Reguera Delgado 8f60cb
# not to have it duplicated so we can centralize such information for
Alain Reguera Delgado 8f60cb
# all documentation manuals.
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 texinfo_updateLicenseLink {
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Define directory where license templates are stored in.
Alain Reguera Delgado 8f60cb
    local DIR=${TCAR_WORKDIR}/Documentation/Models/Texinfo/Default/${CLI_LANG_LC}
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Define files related to license templates.
Alain Reguera Delgado 8f60cb
    local FILES=$(find ${DIR} -name 'Licenses*')
Alain Reguera Delgado 8f60cb
    
Alain Reguera Delgado 8f60cb
    for FILE in $FILES;do
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Remove path from license templates.
Alain Reguera Delgado 8f60cb
        FILE=$(basename ${FILE})
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Remove license files from manual's specific models. All
Alain Reguera Delgado 8f60cb
        # these files are symbolic links. If they aren't, stop the
Alain Reguera Delgado 8f60cb
        # script execution with an error message. In this case you
Alain Reguera Delgado 8f60cb
        # need to fix your directory structure first (e.g., by
Alain Reguera Delgado 8f60cb
        # fetching a more up-to-date version of it from central
Alain Reguera Delgado 8f60cb
        # repository).
Alain Reguera Delgado 8f60cb
        if [[ -h ${MANUAL_BASEDIR_L10N}/${FILE} ]];then
Alain Reguera Delgado 8f60cb
            rm ${MANUAL_BASEDIR_L10N}/${FILE}
Alain Reguera Delgado 8f60cb
        else
Alain Reguera Delgado 8f60cb
            cli_printMessage "${MANUAL_BASEDIR_L10N} `gettext "has an old directory structure."`" --as-error-line
Alain Reguera Delgado 8f60cb
        fi
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Create link from manual's default models to manual's
Alain Reguera Delgado 8f60cb
        # specific models.
Alain Reguera Delgado 8f60cb
        ln -s ${DIR}/${FILE} ${MANUAL_BASEDIR_L10N}/${FILE}
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    done
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
}