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
#
03486a
# Copyright (C) 2009, 2010, 2011, 2012 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
878a2b
    # documentation manual. Do not include the `Chapters' directory
878a2b
    # here. It is used to build chapters based on value passed though
878a2b
    # `--chapter' option passed in the command-line.
878a2b
    local FILE=''
878a2b
    local FILES=$(cli_getFilesList ${MANUAL_TEMPLATE_L10N} \
878a2b
        --pattern='chapter(-menu|-nodes)?\.texinfo' --mindepth='2' \
878a2b
        | grep -v '/Chapters/')
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.
1d4867
        ${CLI_NAME} svn --is-versioned ${FILE}
1d4867
        if [[ $? -ne 0 ]];then
1d4867
            cli_printMessage "${FILE} `gettext "isn't under version control."`" --as-error-line
1d4867
        fi
878a2b
878a2b
        # Verify chapter's directory. If it doesn't exist, create it.
878a2b
        if [[ ! -d ${MANUAL_CHAPTER_DIR} ]];then
878a2b
            svn mkdir ${MANUAL_CHAPTER_DIR} --quiet
878a2b
        fi
878a2b
878a2b
        # Copy template files into chapter's directory.
878a2b
        svn cp ${FILE} ${MANUAL_CHAPTER_DIR} --quiet
878a2b
878a2b
    done
878a2b
878a2b
}