Blame Scripts/Functions/Help/Texinfo/texinfo_copyEntryManual.sh

edaa9d
#!/bin/bash
edaa9d
#
edaa9d
# texinfo_copyEntryChapter.sh -- This function standardizes
edaa9d
# duplication of manuals written in texinfo format.
edaa9d
#
edaa9d
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
edaa9d
#
edaa9d
# This program is free software; you can redistribute it and/or modify
edaa9d
# it under the terms of the GNU General Public License as published by
edaa9d
# the Free Software Foundation; either version 2 of the License, or (at
edaa9d
# your option) any later version.
edaa9d
#
edaa9d
# This program is distributed in the hope that it will be useful, but
edaa9d
# WITHOUT ANY WARRANTY; without even the implied warranty of
edaa9d
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
edaa9d
# General Public License for more details.
edaa9d
#
edaa9d
# You should have received a copy of the GNU General Public License
edaa9d
# along with this program; if not, write to the Free Software
edaa9d
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
edaa9d
#
edaa9d
# ----------------------------------------------------------------------
edaa9d
# $Id$
edaa9d
# ----------------------------------------------------------------------
edaa9d
edaa9d
function texinfo_copyEntryManual {
edaa9d
edaa9d
    # Define list of chapters inside source manual excluding those
edaa9d
    # created from template, rendition output and subversion.
edaa9d
    local MANUAL_CHAPTER=''
edaa9d
    local MANUAL_CHAPTERS=$(cli_getFilesList ${MANUAL_BASEDIR} \
edaa9d
        --maxdepth=1 --mindepth=1 --type="d" --pattern='.+' \
edaa9d
        | egrep -v "(Licenses|\.svn|${MANUAL_NAME}-xhtml)$")
edaa9d
edaa9d
    # Redefine manual name using manual name passed to `centos-art.sh'
edaa9d
    # script as second non-option argument.
edaa9d
    MANUAL_NAME=${MANUAL_SLFN[((${MANUAL_DOCENTRY_ID} + 1))]}
edaa9d
edaa9d
    # Redefine absolute path to manual directory using manual name
edaa9d
    # passed to `centos-art.sh' script as second non-option argument.
5e989a
    MANUAL_BASEDIR="$(echo $MANUAL_BASEDIR \
edaa9d
        | sed -r "s!${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]}!${MANUAL_DIRN[((${MANUAL_DOCENTRY_ID} + 1))]}!")"
edaa9d
edaa9d
    # Redefine absolute path to manual directory using manual name
edaa9d
    # passed to `centos-art.sh' script as second non-option argument.
5e989a
    MANUAL_BASEDIR_L10N="${MANUAL_BASEDIR}/${MANUAL_L10N}"
edaa9d
edaa9d
    # Redefine absolute path to base file using manual name passed to
edaa9d
    # `centos-art.sh' script as second non-option argument.
5e989a
    MANUAL_BASEFILE="${MANUAL_BASEDIR_L10}/${MANUAL_NAME}"
edaa9d
edaa9d
    # Create manual structure
edaa9d
    ${FLAG_BACKEND}_createStructure
edaa9d
edaa9d
    # Print action maessage.
edaa9d
    cli_printMessage "`gettext "Updating chapter menus and nodes inside manual structure."`" --as-response-line
edaa9d
edaa9d
    # Loop through list of chapters.
edaa9d
    for MANUAL_CHAPTER in ${MANUAL_CHAPTERS};do
edaa9d
edaa9d
        # Copy chapter directory from source to target using
edaa9d
        # subversion.
5e989a
        svn cp ${MANUAL_CHAPTER} ${MANUAL_BASEDIR_L10N} --quiet
edaa9d
edaa9d
        # Define manual chapter name.
edaa9d
        local MANUAL_CHAPTER_NAME=$(basename ${MANUAL_CHAPTER})
edaa9d
edaa9d
        # Update chapter information inside the manual's texinfo
edaa9d
        # structure.
c5c74e
        ${FLAG_BACKEND}_updateChapterMenu
9328e8
        ${FLAG_BACKEND}_updateChapterNode
edaa9d
edaa9d
    done
edaa9d
edaa9d
}