Blame Automation/Modules/centos-art.sh-help/Texinfo/texinfo_createStructureChapters.sh

Alain Reguera Delgado 8f60cb
#!/bin/bash
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# texinfo_createStructureChapters.sh -- This function initiates the
Alain Reguera Delgado 8f60cb
# chapter documentation structure of a manual, using the current
Alain Reguera Delgado 8f60cb
# language and template files as reference.
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_createStructureChapters {
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    local MANUAL_CHAPTER_DIR=''
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Define list of chapter templates files used to build the
Alain Reguera Delgado 8f60cb
    # documentation manual. Do not include the `Chapters' and
Alain Reguera Delgado 8f60cb
    # `Licenses' directory here. The Chapters directory is used to
Alain Reguera Delgado 8f60cb
    # build chapters based on value of `--chapter' option passed
Alain Reguera Delgado 8f60cb
    # through the command-line. The `Licenses' directory is linked
Alain Reguera Delgado 8f60cb
    # from its default template directory.
Alain Reguera Delgado 8f60cb
    local FILE=''
Alain Reguera Delgado 8f60cb
    local FILES=$(cli_getFilesList ${MANUAL_TEMPLATE_L10N} \
Alain Reguera Delgado 8f60cb
        --pattern="^.+/Chapters(-menu|-nodes)?\.${MANUAL_EXTENSION}$" --mindepth='1' \
Alain Reguera Delgado 8f60cb
        | egrep -v '/(Chapters|Licenses)/')
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Loop through chapter structures and create them inside the
Alain Reguera Delgado 8f60cb
    # manual.
Alain Reguera Delgado 8f60cb
    for FILE in $FILES;do
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Redefine manual's chapter directory based on template files.
Alain Reguera Delgado 8f60cb
        MANUAL_CHAPTER_DIR=${MANUAL_BASEDIR_L10N}/$(basename $(dirname ${FILE}))
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Verify texinfo templates used as based to build the chapter.
Alain Reguera Delgado 8f60cb
        # Be sure they are inside the working copy of CentOS Artwork
Alain Reguera Delgado 8f60cb
        # Repository and under version control, too.
Alain Reguera Delgado 8f60cb
        cli_checkFiles ${FILE} --is-versioned
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Print action name.
Alain Reguera Delgado 8f60cb
        cli_printMessage "${MANUAL_CHAPTER_DIR}/$(basename ${FILE})" --as-creating-line
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Verify chapter's directory. If it doesn't exist, create it.
Alain Reguera Delgado 8f60cb
        if [[ ! -d ${MANUAL_CHAPTER_DIR} ]];then
Alain Reguera Delgado 8f60cb
            cli_runFnEnvironment vcs --quiet --mkdir ${MANUAL_CHAPTER_DIR}
Alain Reguera Delgado 8f60cb
        fi
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Copy template files into chapter's directory.
Alain Reguera Delgado 8f60cb
        cli_runFnEnvironment vcs --quiet --copy ${FILE} ${MANUAL_CHAPTER_DIR}
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    done
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Create link to `Licenses' default template directory. There
Alain Reguera Delgado 8f60cb
    # isn't a need to duplicate this information. In fact it is
Alain Reguera Delgado 8f60cb
    # important not to have it duplicated so we can centralize such
Alain Reguera Delgado 8f60cb
    # information for all documentation manuals.
Alain Reguera Delgado 8f60cb
    texinfo_updateLicenseLink
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
}