Blame Scripts/Bash/Functions/Help/Texinfo/texinfo_updateLicenseLink.sh

123ee8
#!/bin/bash
123ee8
#
123ee8
# texinfo_updateLicenseLink.sh -- This function updates the link
123ee8
# information related to License directory used by Texinfo
123ee8
# documentation manuals. There isn't a need to duplicate the License 
123ee8
# information in each documentation manual. In fact it is important
123ee8
# not to have it duplicated so we can centralize such information for
123ee8
# all documentation manuals.
123ee8
#
e6bbbf
# Copyright (C) 2009-2013 The CentOS Project
123ee8
#
123ee8
# This program is free software; you can redistribute it and/or modify
123ee8
# it under the terms of the GNU General Public License as published by
123ee8
# the Free Software Foundation; either version 2 of the License, or (at
123ee8
# your option) any later version.
123ee8
#
123ee8
# This program is distributed in the hope that it will be useful, but
123ee8
# WITHOUT ANY WARRANTY; without even the implied warranty of
123ee8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
123ee8
# General Public License for more details.
123ee8
#
123ee8
# You should have received a copy of the GNU General Public License
123ee8
# along with this program; if not, write to the Free Software
123ee8
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
123ee8
#
123ee8
# ----------------------------------------------------------------------
123ee8
# $Id$
123ee8
# ----------------------------------------------------------------------
123ee8
123ee8
function texinfo_updateLicenseLink {
123ee8
123ee8
    # Define directory where license templates are stored in.
123ee8
    local DIR=${TCAR_WORKDIR}/Documentation/Models/Texinfo/Default/${CLI_LANG_LC}
123ee8
123ee8
    # Define files related to license templates.
123ee8
    local FILES=$(find ${DIR} -name 'Licenses*')
123ee8
    
123ee8
    for FILE in $FILES;do
123ee8
123ee8
        # Remove path from license templates.
123ee8
        FILE=$(basename ${FILE})
123ee8
84cc95
        # Remove license files from manual's specific models. All
84cc95
        # these files are symbolic links. If they aren't, stop the
84cc95
        # script execution with an error message. In this case you
84cc95
        # need to fix your directory structure first (e.g., by
84cc95
        # fetching a more up-to-date version of it from central
84cc95
        # repository).
84cc95
        if [[ -h ${MANUAL_BASEDIR_L10N}/${FILE} ]];then
84cc95
            rm ${MANUAL_BASEDIR_L10N}/${FILE}
84cc95
        else
84cc95
            cli_printMessage "${MANUAL_BASEDIR_L10N} `gettext "has an old directory structure."`" --as-error-line
123ee8
        fi
123ee8
123ee8
        # Create link from manual's default models to manual's
123ee8
        # specific models.
123ee8
        ln -s ${DIR}/${FILE} ${MANUAL_BASEDIR_L10N}/${FILE}
123ee8
123ee8
    done
123ee8
123ee8
}