|
|
2bd980 |
#!/bin/bash
|
|
|
2bd980 |
#
|
|
|
edaa9d |
# texinfo_copyEntry.sh -- This function standardizes the duplication
|
|
|
edaa9d |
# actions related to manuals written in texinfo format. This function
|
|
|
edaa9d |
# duplicates manuals, chapters inside manuals, and sections inside
|
|
|
edaa9d |
# chapters.
|
|
|
2bd980 |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
# it under the terms of the GNU General Public License as published by
|
|
|
dcd347 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
dcd347 |
# your option) any later version.
|
|
|
fa95b1 |
#
|
|
|
74a058 |
# This program is distributed in the hope that it will be useful, but
|
|
|
74a058 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
2bd980 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
2bd980 |
# General Public License for more details.
|
|
|
2bd980 |
#
|
|
|
2bd980 |
# You should have received a copy of the GNU General Public License
|
|
|
2bd980 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
2bd980 |
# ----------------------------------------------------------------------
|
|
|
2bd980 |
# $Id$
|
|
|
2bd980 |
# ----------------------------------------------------------------------
|
|
|
2bd980 |
|
|
|
993f6a |
function texinfo_copyEntry {
|
|
|
56f126 |
|
|
|
edaa9d |
local MANUAL_ENTRY_SRC=''
|
|
|
edaa9d |
local MANUAL_ENTRY_DST=''
|
|
|
edaa9d |
local MANUAL_ENTRY=''
|
|
|
edaa9d |
local MANUAL_ENTRIES=''
|
|
|
b45dde |
|
|
|
edaa9d |
# Define both source and target documentation entries. To build
|
|
|
edaa9d |
# the source and target documentation entries we take into
|
|
|
edaa9d |
# consideration the manual's main definition file, the chapter's
|
|
|
edaa9d |
# main definition file and non-option arguments passed to
|
|
|
edaa9d |
# centos-art.sh script through the command-line.
|
|
|
edaa9d |
if [[ ${MANUAL_SECN[${MANUAL_DOCENTRY_ID}]} != '' ]];then
|
|
|
a484de |
|
|
|
edaa9d |
if [[ ${MANUAL_SECN[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then
|
|
|
608fb4 |
|
|
|
edaa9d |
# When the section name is specified both in first and
|
|
|
edaa9d |
# second non-option arguments, source and target are set
|
|
|
edaa9d |
# as specified in first and second non-option arguments
|
|
|
edaa9d |
# respectively.
|
|
|
56f126 |
|
|
|
edaa9d |
# Define documentation entry source's location.
|
|
|
edaa9d |
MANUAL_ENTRY_SRC=$(${FLAG_BACKEND}_getEntry ${MANUAL_SECN[${MANUAL_DOCENTRY_ID}]})
|
|
|
7dc6cc |
|
|
|
edaa9d |
# Define documentation entry target's location.
|
|
|
edaa9d |
MANUAL_ENTRY_DST=$(${FLAG_BACKEND}_getEntry ${MANUAL_SECN[((${MANUAL_DOCENTRY_ID} + 1))]})
|
|
|
45e570 |
|
|
|
edaa9d |
elif [[ ${MANUAL_SECN[((${MANUAL_DOCENTRY_ID} + 1))]} == '' ]] \
|
|
|
edaa9d |
&& [[ ${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then
|
|
|
56f126 |
|
|
|
edaa9d |
# When the section name is specified only in the first
|
|
|
edaa9d |
# non-option argument and the chapter name has been
|
|
|
edaa9d |
# provided in the second non-option argument, use the
|
|
|
edaa9d |
# section name passed in first argument to build the
|
|
|
edaa9d |
# section name that will be used as target.
|
|
|
a484de |
|
|
|
edaa9d |
# Define documentation entry source's location.
|
|
|
edaa9d |
MANUAL_ENTRY_SRC=$(${FLAG_BACKEND}_getEntry ${MANUAL_SECN[${MANUAL_DOCENTRY_ID}]})
|
|
|
a484de |
|
|
|
edaa9d |
# Define documentation entry target's location.
|
|
|
edaa9d |
MANUAL_ENTRY_DST=$(echo $MANUAL_ENTRY_SRC \
|
|
|
edaa9d |
| sed -r "s!${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]}!${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]}!")
|
|
|
2bd980 |
|
|
|
edaa9d |
else
|
|
|
edaa9d |
cli_printMessage "`gettext "The location provided as target isn't valid."`" --as-error-line
|
|
|
edaa9d |
fi
|
|
|
2bd980 |
|
|
|
edaa9d |
# Copy documentation entry using source and target locations.
|
|
|
edaa9d |
${FLAG_BACKEND}_copyEntrySection
|
|
|
edaa9d |
|
|
|
edaa9d |
elif [[ ${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]} != '' ]] \
|
|
|
edaa9d |
&& [[ ${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then
|
|
|
edaa9d |
|
|
|
edaa9d |
# In this configuration, the section name wasn't specified
|
|
|
edaa9d |
# neither in first or second non-option argument. So, we
|
|
|
edaa9d |
# perform a copying action for the chapter directory itself.
|
|
|
edaa9d |
# In this configuration, the whole chapter directory and all
|
|
|
edaa9d |
# the content inside it is duplicated from source to target.
|
|
|
edaa9d |
${FLAG_BACKEND}_copyEntryChapter
|
|
|
edaa9d |
|
|
|
edaa9d |
elif [[ ${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]} != '' ]] \
|
|
|
edaa9d |
&& [[ ${MANUAL_DIRN[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then
|
|
|
edaa9d |
|
|
|
edaa9d |
# In this configuration, the chapter name wasn't specified
|
|
|
edaa9d |
# neither in first or second non-option argument. So, we
|
|
|
edaa9d |
# perform copying actions on manual directory itself. Notice
|
|
|
edaa9d |
# that, in this configuration, the whole manual is duplicated.
|
|
|
edaa9d |
${FLAG_BACKEND}_copyEntryManual
|
|
|
edaa9d |
|
|
|
edaa9d |
# In this configuration, there is no need to update section
|
|
|
edaa9d |
# menus, nodes and cross refereces. The section definition
|
|
|
edaa9d |
# files were copied from the source manual with any change so
|
|
|
edaa9d |
# the manual should build without any problem. Be sure such
|
|
|
edaa9d |
# verification will never happen.
|
|
|
2bd980 |
|
|
|
edaa9d |
else
|
|
|
edaa9d |
cli_printMessage "`gettext "The parameters you provided are not supported."`" --as-error-line
|
|
|
edaa9d |
fi
|
|
|
2bd980 |
|
|
|
2bd980 |
}
|