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

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