Blame Automation/Modules/centos-art.sh-help/Texinfo/texinfo_copyEntryManual.sh

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