Blame Scripts/Functions/Help/Backends/Texinfo/texinfo_createChapters.sh

4c79b5
#!/bin/bash
4c79b5
#
63835d
# texinfo_createChapters.sh -- This function creates the chapters'
63835d
# base directory structure using templates as reference.
4c79b5
#
2d3646
# Copyright (C) 2009, 2010, 2011 The CentOS Project
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
4c79b5
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
63835d
function texinfo_createChapters {
4c79b5
34f2ab
    local MANUAL_CHAPTER_DIR=''
4c79b5
34f2ab
    # Define list of chapter templates files used as base to create
34f2ab
    # the chapters' documentation manual.
34f2ab
    local FILE=''
34f2ab
    local FILES=$(cli_getFilesList ${MANUAL_TEMPLATE} \
34f2ab
        --pattern='\.texinfo' --mindepth='2')
4c79b5
34f2ab
    # Loop through chapter structures and create them.
34f2ab
    for FILE in $FILES;do
4c79b5
34f2ab
        # Redefine chapter directory based on template files.
34f2ab
        MANUAL_CHAPTER_DIR=$(basename $(dirname ${FILE}))
4c79b5
34f2ab
        # Verify texinfo templates used as based to build the chapter.
34f2ab
        # Be sure they are inside the working copy of CentOS Artwork
34f2ab
        # Repository (-w) and under version control (-n), too.
34f2ab
        cli_checkFiles ${FILE} -wn
34f2ab
34f2ab
        # Verify chapter's directory. If it doesn't exist, create it.
34f2ab
        if [[ ! -d ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_DIR} ]];then
34f2ab
            svn mkdir ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_DIR} --quiet
34f2ab
        fi
34f2ab
34f2ab
        # Copy template files into chapter's directory.
34f2ab
        svn cp ${FILE} ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_DIR} --quiet
34f2ab
34f2ab
    done
5285d6
4c79b5
}
34f2ab