|
Alain Reguera Delgado |
8f60cb |
#!/bin/bash
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# texinfo_copyEntrySection.sh -- This function standardizes section
|
|
Alain Reguera Delgado |
8f60cb |
# duplication inside 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_copyEntrySection {
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define absolute path to section source and target locations
|
|
Alain Reguera Delgado |
8f60cb |
# based on non-option arguments passed to `centos-art.sh' script.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ ${MANUAL_SECT[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# When the section name is specified in first and second
|
|
Alain Reguera Delgado |
8f60cb |
# non-option arguments, source and target are set as specified
|
|
Alain Reguera Delgado |
8f60cb |
# in first and second non-option arguments respectively.
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_ENTRY_SRC=$(texinfo_getEntry ${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]})
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_ENTRY_DST=$(texinfo_getEntry ${MANUAL_SECT[((${MANUAL_DOCENTRY_ID} + 1))]})
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
elif [[ ${MANUAL_SECT[((${MANUAL_DOCENTRY_ID} + 1))]} == '' ]] \
|
|
Alain Reguera Delgado |
8f60cb |
&& [[ ${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# When the section name is specified only in the first
|
|
Alain Reguera Delgado |
8f60cb |
# non-option argument and the chapter name has been provided
|
|
Alain Reguera Delgado |
8f60cb |
# in the second non-option argument, use the section name
|
|
Alain Reguera Delgado |
8f60cb |
# passed in first argument to build the section name that will
|
|
Alain Reguera Delgado |
8f60cb |
# be used as target.
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_ENTRY_SRC=$(texinfo_getEntry ${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]})
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_ENTRY_DST=$(echo $MANUAL_ENTRY_SRC \
|
|
Alain Reguera Delgado |
8f60cb |
| sed -r "s!${MANUAL_CHAP[${MANUAL_DOCENTRY_ID}]}!${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]}!")
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
else
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`gettext "The location provided as target isn't valid."`" --as-error-line
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Print separator line along with action message.
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage '-' --as-separator-line
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "${MANUAL_ENTRY_DST}" --as-creating-line
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify entry source and target locations.
|
|
Alain Reguera Delgado |
8f60cb |
texinfo_checkEntrySrcDst "${MANUAL_ENTRY_SRC}" "${MANUAL_ENTRY_DST}"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Copy section entry from source to target using subversion.
|
|
Alain Reguera Delgado |
8f60cb |
cli_runFnEnvironment vcs --quiet --copy "${MANUAL_ENTRY_SRC}" "${MANUAL_ENTRY_DST}"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Redefine chapter name using chapter name passed to
|
|
Alain Reguera Delgado |
8f60cb |
# `centos-art.sh' script as second non-option argument.
|
|
Alain Reguera Delgado |
8f60cb |
local MANUAL_CHAPTER_NAME=${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Redefine chapter directory to use the chapter provided to
|
|
Alain Reguera Delgado |
8f60cb |
# `centos-art.sh' script as second non-option argument. This is
|
|
Alain Reguera Delgado |
8f60cb |
# required in order to update the `chapter-menu.texinfo' file
|
|
Alain Reguera Delgado |
8f60cb |
# inside the target chapter where section entry was copied to, not
|
|
Alain Reguera Delgado |
8f60cb |
# the source chapter where the section entry was taken from. This
|
|
Alain Reguera Delgado |
8f60cb |
# is particularly useful section entries are copied from one
|
|
Alain Reguera Delgado |
8f60cb |
# chapter into another different.
|
|
Alain Reguera Delgado |
8f60cb |
local MANUAL_CHAPTER_DIR=$(dirname ${MANUAL_ENTRY_DST})
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# At this point, all copying actions and chapter related
|
|
Alain Reguera Delgado |
8f60cb |
# redefinitions have took place. It is time, then, to update the
|
|
Alain Reguera Delgado |
8f60cb |
# document structure using the information collected so far.
|
|
Alain Reguera Delgado |
8f60cb |
texinfo_updateStructureSection "${MANUAL_ENTRY_DST}"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
}
|