Blame Scripts/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
#
06b97f
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
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
06b97f
    # Define list of chapter templates files used to build the
06b97f
    # documentation manual. Do not include the `Directories' 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' \
06b97f
        | grep -v '/Directories/')
06b97f
06b97f
    # Loop through chapter structures and create them inside the
06b97f
    # manual.
06b97f
    for FILE in $FILES;do
06b97f
06b97f
        # Redefine chapter directory based on template files.
06b97f
        MANUAL_CHAPTER_NAME=$(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.
06b97f
        if [[ ! -d ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} ]];then
06b97f
            svn mkdir ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} --quiet
06b97f
        fi
06b97f
06b97f
        # Copy template files into chapter's directory.
06b97f
        svn cp ${FILE} ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} --quiet
06b97f
06b97f
    done
06b97f
06b97f
}