Blame Scripts/CentOS-Art/Functions/Help/Texinfo/texinfo_createStructureChapters.sh

06b97f
#!/bin/bash
06b97f
#
06b97f
# texinfo_createStructureChapters.sh -- This function initiates the
06b97f
# chapter documentation structure of a manual, using the current
06b97f
# language and template files as reference.
06b97f
#
2fe9b7
# Copyright (C) 2009, 2010, 2011 The CentOS Project
06b97f
#
06b97f
# This program is free software; you can redistribute it and/or modify
06b97f
# it under the terms of the GNU General Public License as published by
06b97f
# the Free Software Foundation; either version 2 of the License, or (at
06b97f
# your option) any later version.
06b97f
#
06b97f
# This program is distributed in the hope that it will be useful, but
06b97f
# WITHOUT ANY WARRANTY; without even the implied warranty of
06b97f
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
06b97f
# General Public License for more details.
06b97f
#
06b97f
# You should have received a copy of the GNU General Public License
06b97f
# along with this program; if not, write to the Free Software
06b97f
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
06b97f
#
06b97f
# ----------------------------------------------------------------------
06b97f
# $Id$
06b97f
# ----------------------------------------------------------------------
06b97f
06b97f
function texinfo_createStructureChapters {
06b97f
edaa9d
    local MANUAL_CHAPTER_DIR=''
edaa9d
06b97f
    # Define list of chapter templates files used to build the
edaa9d
    # documentation manual. Do not include the `Chapters' directory
06b97f
    # here. It is used to build chapters based on value passed though
06b97f
    # `--chapter' option passed in the command-line.
06b97f
    local FILE=''
06b97f
    local FILES=$(cli_getFilesList ${MANUAL_TEMPLATE_L10N} \
06b97f
        --pattern='chapter(-menu|-nodes)?\.texinfo' --mindepth='2' \
edaa9d
        | grep -v '/Chapters/')
06b97f
06b97f
    # Loop through chapter structures and create them inside the
06b97f
    # manual.
06b97f
    for FILE in $FILES;do
06b97f
edaa9d
        # Redefine manual's chapter directory based on template files.
5e989a
        MANUAL_CHAPTER_DIR=${MANUAL_BASEDIR_L10N}/$(basename $(dirname ${FILE}))
06b97f
06b97f
        # Verify texinfo templates used as based to build the chapter.
06b97f
        # Be sure they are inside the working copy of CentOS Artwork
06b97f
        # Repository (-w) and under version control (-n), too.
06b97f
        cli_checkFiles ${FILE} -wn
06b97f
06b97f
        # Verify chapter's directory. If it doesn't exist, create it.
edaa9d
        if [[ ! -d ${MANUAL_CHAPTER_DIR} ]];then
edaa9d
            svn mkdir ${MANUAL_CHAPTER_DIR} --quiet
06b97f
        fi
06b97f
06b97f
        # Copy template files into chapter's directory.
edaa9d
        svn cp ${FILE} ${MANUAL_CHAPTER_DIR} --quiet
06b97f
06b97f
    done
06b97f
06b97f
}