|
|
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 |
# Define absolute path to chapter's directory. This is the place
|
|
|
edaa9d |
# where chapter-specific files are stored in.
|
|
|
499af4 |
MANUAL_CHAPTER_DIR="${MANUAL_BASEDIR_L10N}/${MANUAL_CHAPTER_NAME}"
|
|
|
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.
|
|
|
903cf1 |
MANUAL_TEMPLATE=${CLI_FUNCDIR}/${CLI_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 |
|
|
|
848ff6 |
# Define absolute path to manual's configuration file. This is the
|
|
|
848ff6 |
# file that controls the way texinfo template files are applied to
|
|
|
848ff6 |
# documentation entries once they have been created as well as the
|
|
|
848ff6 |
# style and order used for printing sections. There is one default
|
|
|
848ff6 |
# configuration file inside templates and, optionally, a
|
|
|
848ff6 |
# manual-specific configuration file. When manual-specific
|
|
|
848ff6 |
# configuration file isn't found, the default configuration file
|
|
|
848ff6 |
# is used instead.
|
|
|
848ff6 |
if [[ -f ${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}.conf ]];then
|
|
|
848ff6 |
MANUAL_CONFIG_FILE="${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}.conf"
|
|
|
848ff6 |
else
|
|
|
848ff6 |
MANUAL_CONFIG_FILE="${MANUAL_TEMPLATE}/manual.conf"
|
|
|
848ff6 |
fi
|
|
|
848ff6 |
|
|
|
848ff6 |
# Initialize document structure for new manuals.
|
|
|
edaa9d |
${FLAG_BACKEND}_createStructure
|
|
|
522184 |
|
|
|
e7414c |
# Define documentation entry default values. To build the
|
|
|
e7414c |
# documentation entry, we combine the manual's name, the chapter's
|
|
|
e7414c |
# name and the section 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 |
|
|
|
e7414c |
# Execute action names. Notice that we've separated execution of
|
|
|
e7414c |
# action names in order to control and save differences among
|
|
|
e7414c |
# them.
|
|
|
e7414c |
if [[ $ACTIONNAM == "" ]];then
|
|
|
edaa9d |
|
|
|
e7414c |
# When no action name is provided to `centos-art.sh' script,
|
|
|
e7414c |
# read manual's output in info format in order to provide a
|
|
|
e7414c |
# way for people to get oriented about The CentOS Artwork
|
|
|
e7414c |
# Repository and its automation tool, the centos-art.sh
|
|
|
e7414c |
# script. Be sure the manual's output file does exist and
|
|
|
e7414c |
# terminate the script execution once the reading is done.
|
|
|
edaa9d |
|
|
|
499af4 |
# Update manual's output files.
|
|
|
e7414c |
${FLAG_BACKEND}_updateOutputFiles
|
|
|
e7414c |
|
|
|
499af4 |
# Read manual's Top node from info output file.
|
|
|
e7414c |
info --node="Top" --file=${MANUAL_BASEFILE}.info.bz2
|
|
|
522184 |
|
|
|
edaa9d |
# Terminate script execution right here.
|
|
|
edaa9d |
exit
|
|
|
edaa9d |
|
|
|
e7414c |
elif [[ $ACTIONNAM =~ "^(copy|rename)Entry$" ]];then
|
|
|
522184 |
|
|
|
e7414c |
# Both `--copy' and `--rename' actions interpret non-option
|
|
|
e7414c |
# arguments passed to `centos-art.sh' script in a special way.
|
|
|
e7414c |
# In this configuration, only two non-option arguments are
|
|
|
499af4 |
# processed in the first loop of their interpretation.
|
|
|
edaa9d |
${FLAG_BACKEND}_${ACTIONNAM}
|
|
|
522184 |
|
|
|
e7414c |
# Break interpretation of non-option arguments, to prevent the
|
|
|
499af4 |
# second and further non-option arguments from being
|
|
|
499af4 |
# considered a source location.
|
|
|
e7414c |
break
|
|
|
e7414c |
|
|
|
e7414c |
elif [[ $ACTIONNAM =~ "^(search(Node|Index)|updateOutputFiles)$" ]];then
|
|
|
e7414c |
|
|
|
e7414c |
# The two final actions of help functionality are precisely to
|
|
|
e7414c |
# update manual output files and commit all changes from
|
|
|
e7414c |
# working copy to central repository. In this situation, when
|
|
|
e7414c |
# the `--update' action name is provided to `centos-art.sh',
|
|
|
e7414c |
# don't duplicate the rendition of manual output files (e.g.,
|
|
|
e7414c |
# one as action name and another as help's normal execution
|
|
|
e7414c |
# flow) nor commit any change form working copy to central
|
|
|
e7414c |
# repository (e.g., output files are not under version
|
|
|
e7414c |
# control).
|
|
|
e7414c |
${FLAG_BACKEND}_${ACTIONNAM}
|
|
|
e7414c |
|
|
|
e7414c |
# Terminate script execution right here. Actions realized in
|
|
|
e7414c |
# this configuration doesn't need to update manual output
|
|
|
e7414c |
# files, nor commit changes from working copy up to central
|
|
|
e7414c |
# repository.
|
|
|
522184 |
exit
|
|
|
522184 |
|
|
|
522184 |
else
|
|
|
522184 |
|
|
|
e7414c |
# Execute action names that follow help's execution flow as it
|
|
|
e7414c |
# is, without any modification.
|
|
|
e7414c |
${FLAG_BACKEND}_${ACTIONNAM}
|
|
|
edaa9d |
|
|
|
edaa9d |
fi
|
|
|
522184 |
|
|
|
522184 |
}
|