|
|
522184 |
#!/bin/bash
|
|
|
522184 |
#
|
|
|
edaa9d |
# texinfo.sh -- This function initilializes the Texinfo documentation
|
|
|
edaa9d |
# backend used by centos-art.sh script to produce and maintain Texinfo
|
|
|
edaa9d |
# documentation manuals inside the working copy of The CentOS Artwork
|
|
|
edaa9d |
# Repository.
|
|
|
522184 |
#
|
|
|
522184 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
522184 |
#
|
|
|
522184 |
# This program is free software; you can redistribute it and/or modify
|
|
|
522184 |
# it under the terms of the GNU General Public License as published by
|
|
|
522184 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
522184 |
# (at your option) any later version.
|
|
|
522184 |
#
|
|
|
522184 |
# This program is distributed in the hope that it will be useful, but
|
|
|
522184 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
522184 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
522184 |
# General Public License for more details.
|
|
|
522184 |
#
|
|
|
522184 |
# You should have received a copy of the GNU General Public License
|
|
|
522184 |
# along with this program; if not, write to the Free Software
|
|
|
522184 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
522184 |
#
|
|
|
522184 |
# ----------------------------------------------------------------------
|
|
|
522184 |
# $Id$
|
|
|
522184 |
# ----------------------------------------------------------------------
|
|
|
522184 |
|
|
|
522184 |
function texinfo {
|
|
|
522184 |
|
|
|
edaa9d |
# Define file extension used by source files inside manuals.
|
|
|
522184 |
MANUAL_EXTENSION='texinfo'
|
|
|
522184 |
|
|
|
edaa9d |
# Verify existence of action names. When no action name is
|
|
|
edaa9d |
# provided to centos-art.sh script, read manual's output in info
|
|
|
edaa9d |
# format in order to provide a way for people to get oriented
|
|
|
edaa9d |
# about The CentOS Artwork Repository and its automation tool, the
|
|
|
edaa9d |
# centos-art.sh script. Be sure the manual's output file does
|
|
|
edaa9d |
# exist and terminate the script execution once the reading is
|
|
|
edaa9d |
# done.
|
|
|
7c07fa |
if [[ $ACTIONNAM == '' ]];then
|
|
|
edaa9d |
|
|
|
edaa9d |
# Verify existence of manual's output in info format.
|
|
|
edaa9d |
cli_checkFiles ${MANUAL_BASEFILE}.info.bz2
|
|
|
edaa9d |
|
|
|
edaa9d |
# Read Top node from manual's output in info format.
|
|
|
7c07fa |
/usr/bin/info --node="Top" --file=${MANUAL_BASEFILE}.info.bz2
|
|
|
edaa9d |
|
|
|
edaa9d |
# Terminate script execution right here.
|
|
|
7c07fa |
exit
|
|
|
edaa9d |
|
|
|
7c07fa |
fi
|
|
|
7c07fa |
|
|
|
edaa9d |
# Define absolute path to chapter's directory. This is the place
|
|
|
edaa9d |
# where chapter-specific files are stored in.
|
|
|
5e989a |
MANUAL_CHAPTER_DIR=${MANUAL_BASEDIR_L10N}/$(cli_getRepoName \
|
|
|
edaa9d |
"${MANUAL_CHAPTER_NAME}" -d | tr -d ' ' | sed -r 's!/$!!')
|
|
|
edaa9d |
|
|
|
edaa9d |
# Define absolute path to template directory. This is the place
|
|
|
edaa9d |
# where we store locale directories (e.g., en_US, es_ES, etc.)
|
|
|
edaa9d |
# used to build manuals in texinfo format.
|
|
|
6150a1 |
MANUAL_TEMPLATE=${FUNCDIR}/${FUNCDIRNAM}/$(cli_getRepoName \
|
|
|
edaa9d |
${FLAG_BACKEND} -d)/Templates
|
|
|
6150a1 |
|
|
|
edaa9d |
# Define absolute path to language-specific template directory.
|
|
|
edaa9d |
# This is the place where we store locale-specific files used to
|
|
|
edaa9d |
# build manuals in texinfo format.
|
|
|
6150a1 |
MANUAL_TEMPLATE_L10N=${MANUAL_TEMPLATE}/${MANUAL_L10N}
|
|
|
522184 |
|
|
|
6150a1 |
# Verify absolute path to language-speicific template directory.
|
|
|
6150a1 |
# If it doesn't exist, use English language as default location to
|
|
|
6150a1 |
# retrive template files.
|
|
|
6150a1 |
if [[ ! -d $MANUAL_TEMPLATE_L10N ]];then
|
|
|
6150a1 |
MANUAL_TEMPLATE_L10N=${MANUAL_TEMPLATE}/en_US
|
|
|
522184 |
fi
|
|
|
522184 |
|
|
|
edaa9d |
# Initialize document structure of new manuals.
|
|
|
edaa9d |
${FLAG_BACKEND}_createStructure
|
|
|
522184 |
|
|
|
48d877 |
# Define documentation entry. To build the documentation entry, we
|
|
|
48d877 |
# combine the manual's name, the chapter's name and the section
|
|
|
48d877 |
# name retrived from the command-line.
|
|
|
48d877 |
if [[ $MANUAL_CHAPTER_NAME == '' ]];then
|
|
|
48d877 |
|
|
|
48d877 |
# When chapter option is not provided, discard the section
|
|
|
48d877 |
# name and define documentation entry based on manual's main
|
|
|
48d877 |
# definition file.
|
|
|
48d877 |
MANUAL_ENTRY="${MANUAL_BASEFILE}.${MANUAL_EXTENSION}"
|
|
|
48d877 |
|
|
|
48d877 |
elif [[ $MANUAL_CHAPTER_NAME != '' ]] && [[ $MANUAL_SECTION_NAME == '' ]];then
|
|
|
48d877 |
|
|
|
48d877 |
# When chapter option is provided whith out a section name,
|
|
|
48d877 |
# verify chapter's directory inside the manual,
|
|
|
48d877 |
${FLAG_BACKEND}_createChapter
|
|
|
48d877 |
|
|
|
48d877 |
# and define documentation entry based on chapter's main
|
|
|
48d877 |
# definition file.
|
|
|
48d877 |
MANUAL_ENTRY="${MANUAL_BASEDIR_L10N}/${MANUAL_CHAPTER_NAME}/chapter.${MANUAL_EXTENSION}"
|
|
|
48d877 |
|
|
|
48d877 |
elif [[ $MANUAL_CHAPTER_NAME != '' ]] && [[ $MANUAL_SECTION_NAME != '' ]];then
|
|
|
48d877 |
|
|
|
48d877 |
# When both the chapter option and non-option arguments are
|
|
|
48d877 |
# provided, define documentation entries based on manual,
|
|
|
48d877 |
# chapter and non-option arguments.
|
|
|
48d877 |
MANUAL_ENTRY="$(${FLAG_BACKEND}_getEntry "$MANUAL_SECTION_NAME")"
|
|
|
48d877 |
|
|
|
48d877 |
else
|
|
|
48d877 |
cli_printMessage "`gettext "The parameters you provided are not supported."`" --as-error-line
|
|
|
48d877 |
fi
|
|
|
48d877 |
|
|
|
edaa9d |
# Execute action names. Notice that we've separated action name
|
|
|
edaa9d |
# execution in order to control and save the differences among
|
|
|
edaa9d |
# them. For example, there are action names that need a fixed
|
|
|
edaa9d |
# amount of non-option arguments (e.g., when we rename or copy
|
|
|
edaa9d |
# documentation entries); but there are other action names that
|
|
|
edaa9d |
# have no restriction in the amount of non-option arguments that
|
|
|
edaa9d |
# can be provided to it (e.g., when we edit, read or delete
|
|
|
edaa9d |
# documentation entries).
|
|
|
edaa9d |
if [[ $ACTIONNAM =~ "^(copy|rename)Entry$" ]];then
|
|
|
522184 |
|
|
|
522184 |
# Execute backend action names that may need to use more than
|
|
|
522184 |
# one action value.
|
|
|
edaa9d |
${FLAG_BACKEND}_${ACTIONNAM}
|
|
|
edaa9d |
|
|
|
edaa9d |
# Rebuild output files to propagate recent changes.
|
|
|
edaa9d |
${FLAG_BACKEND}_updateOutputFiles
|
|
|
edaa9d |
|
|
|
edaa9d |
# Commit changes from working copy to central repository only.
|
|
|
edaa9d |
# At this point, changes in the repository are not merged in
|
|
|
edaa9d |
# the working copy, but chages in the working copy do are
|
|
|
edaa9d |
# committed up to repository.
|
|
|
edaa9d |
cli_commitRepoChanges ${MANUAL_BASEDIR}
|
|
|
522184 |
|
|
|
edaa9d |
# Terminate script execution right here.
|
|
|
edaa9d |
exit
|
|
|
edaa9d |
|
|
|
edaa9d |
elif [[ $ACTIONNAM =~ "^(searchIndex|updateOutputFiles)$" ]];then
|
|
|
522184 |
|
|
|
edaa9d |
# Execute backend action names which don't require non-option
|
|
|
edaa9d |
# arguments to be passed at all, in order for them to do their
|
|
|
edaa9d |
# work.
|
|
|
edaa9d |
${FLAG_BACKEND}_${ACTIONNAM}
|
|
|
522184 |
|
|
|
edaa9d |
# Terminate script execution right here.
|
|
|
522184 |
exit
|
|
|
522184 |
|
|
|
522184 |
else
|
|
|
522184 |
|
|
|
edaa9d |
# Execute action name on documentation entry.
|
|
|
edaa9d |
${FLAG_BACKEND}_$ACTIONNAM
|
|
|
edaa9d |
|
|
|
edaa9d |
fi
|
|
|
522184 |
|
|
|
522184 |
}
|