|
|
edaa9d |
#!/bin/bash
|
|
|
edaa9d |
#
|
|
|
edaa9d |
# texinfo_copyEntrySection.sh -- This function standardizes section
|
|
|
edaa9d |
# duplication inside 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_copyEntrySection {
|
|
|
edaa9d |
|
|
|
edaa9d |
# Verify source and target locations to be sure they are different
|
|
|
edaa9d |
# one another. We cannot copy a source location to itself.
|
|
|
edaa9d |
if [[ $MANUAL_ENTRY_SRC == $MANUAL_ENTRY_DST ]];then
|
|
|
edaa9d |
cli_printMessage "`gettext "The source and target locations cannot be the same."`" --as-error-line
|
|
|
edaa9d |
fi
|
|
|
edaa9d |
|
|
|
edaa9d |
# Print separator line.
|
|
|
edaa9d |
cli_printMessage '-' --as-separator-line
|
|
|
edaa9d |
|
|
|
edaa9d |
# Redefine chapter name using chapter name passed to
|
|
|
edaa9d |
# `centos-art.sh' script as second non-option argument.
|
|
|
edaa9d |
MANUAL_CHAPTER_NAME=${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]}
|
|
|
edaa9d |
|
|
|
edaa9d |
# Redefine chapter directory to use the chapter provided to
|
|
|
edaa9d |
# `centos-art.sh' script as second non-option argument. This is
|
|
|
edaa9d |
# required in order to update the `chapter-menu.texinfo' file on
|
|
|
edaa9d |
# the target chapter the documentation entry was copied in, not
|
|
|
edaa9d |
# the source chapter where the documentation entry was taken from.
|
|
|
edaa9d |
# This is particulary useful when a documentation entry is copied
|
|
|
edaa9d |
# from one chapter to another different.
|
|
|
edaa9d |
MANUAL_CHAPTER_DIR=$(dirname ${MANUAL_ENTRY_DST})
|
|
|
edaa9d |
|
|
|
edaa9d |
# When we copy sections, the chapter directory where the section
|
|
|
edaa9d |
# copied will be placed in must exist first. In that sake, verify
|
|
|
edaa9d |
# the chapter directory of target documentation entry and if it
|
|
|
edaa9d |
# doesn't exist, create it adding it to version control.
|
|
|
edaa9d |
if [[ ! -d $(dirname ${MANUAL_ENTRY_DST}) ]];then
|
|
|
edaa9d |
svn mkdir $(dirname ${MANUAL_ENTRY_DST}) --quiet
|
|
|
edaa9d |
fi
|
|
|
edaa9d |
|
|
|
edaa9d |
# Copy documentation entry from source to target using subversion.
|
|
|
edaa9d |
if [[ -a ${MANUAL_ENTRY_SRC} ]];then
|
|
|
edaa9d |
if [[ ! -a ${MANUAL_ENTRY_DST} ]];then
|
|
|
edaa9d |
cli_printMessage "${MANUAL_ENTRY_DST}" --as-creating-line
|
|
|
edaa9d |
svn cp "${MANUAL_ENTRY_SRC}" "${MANUAL_ENTRY_DST}" --quiet
|
|
|
edaa9d |
else
|
|
|
edaa9d |
cli_printMessage "`gettext "The target location is not valid."`" --as-error-line
|
|
|
edaa9d |
fi
|
|
|
edaa9d |
else
|
|
|
edaa9d |
cli_printMessage "`gettext "The source location is not valid."`" --as-error-line
|
|
|
edaa9d |
fi
|
|
|
edaa9d |
|
|
|
edaa9d |
# At this point, all copying actions had took place and it is time
|
|
|
edaa9d |
# to update the document structure.
|
|
|
edaa9d |
${FLAG_BACKEND}_updateStructureSection "${MANUAL_ENTRY_DST}"
|
|
|
edaa9d |
|
|
|
edaa9d |
}
|