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

878a2b
#!/bin/bash
878a2b
#
878a2b
# texinfo_copyEntryChapter.sh -- This function standardizes
878a2b
# duplication of manuals written in texinfo format.
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_copyEntryManual {
878a2b
878a2b
    # Define list of chapters inside source manual excluding those
878a2b
    # created from template, rendition output and subversion.
878a2b
    local MANUAL_CHAPTER=''
878a2b
    local MANUAL_CHAPTERS=$(cli_getFilesList ${MANUAL_BASEDIR_L10N} \
878a2b
        --maxdepth=1 --mindepth=1 --type="d" --pattern='.+' \
878a2b
        | egrep -v "(Licenses|\.svn|${MANUAL_NAME}-xhtml)$")
878a2b
878a2b
    # Redefine manual name using manual name passed to `centos-art.sh'
878a2b
    # script as second non-option argument.
878a2b
    local MANUAL_NAME=${MANUAL_SLFN[((${MANUAL_DOCENTRY_ID} + 1))]}
878a2b
878a2b
    # Redefine absolute path to manual directory using manual name
878a2b
    # passed to `centos-art.sh' script as second non-option argument.
878a2b
    local MANUAL_BASEDIR="$(echo $MANUAL_BASEDIR \
878a2b
        | sed -r "s!${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]}!${MANUAL_DIRN[((${MANUAL_DOCENTRY_ID} + 1))]}!")"
878a2b
878a2b
    # Redefine absolute path to manual directory using manual name
878a2b
    # passed to `centos-art.sh' script as second non-option argument.
878a2b
    local MANUAL_BASEDIR_L10N="${MANUAL_BASEDIR}/${MANUAL_L10N}"
878a2b
878a2b
    # Redefine absolute path to base file using manual name passed to
878a2b
    # `centos-art.sh' script as second non-option argument.
878a2b
    local MANUAL_BASEFILE="${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}"
878a2b
878a2b
    # Create manual structure
878a2b
    texinfo_createStructure
878a2b
878a2b
    # Print action maessage.
878a2b
    cli_printMessage "`gettext "Updating chapter menus and nodes inside manual structure."`" --as-response-line
878a2b
878a2b
    # Loop through list of chapters.
878a2b
    for MANUAL_CHAPTER in ${MANUAL_CHAPTERS};do
878a2b
878a2b
        # Copy chapter directory from source to target using
878a2b
        # subversion.
252c46
        ${CLI_NAME} svn --copy ${MANUAL_CHAPTER} ${MANUAL_BASEDIR_L10N}
878a2b
878a2b
        # Define manual chapter name.
878a2b
        local MANUAL_CHAPTER_NAME=$(basename ${MANUAL_CHAPTER})
878a2b
878a2b
        # Update chapter information inside the manual's texinfo
878a2b
        # structure.
878a2b
        texinfo_updateChapterMenu
878a2b
        texinfo_updateChapterNodes
878a2b
878a2b
    done
878a2b
878a2b
}