|
Alain Reguera Delgado |
8f60cb |
#!/bin/bash
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# texinfo.sh -- This function initializes Texinfo documentation format
|
|
Alain Reguera Delgado |
8f60cb |
# used by `centos-art.sh' script to produce and maintain documentation
|
|
Alain Reguera Delgado |
8f60cb |
# manuals written in Texinfo format, inside the working copy of The
|
|
Alain Reguera Delgado |
8f60cb |
# CentOS Artwork Repository.
|
|
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 {
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify documentation entry to be sure it coincides with
|
|
Alain Reguera Delgado |
8f60cb |
# Texinfo's supported structuring (e.g., texinfo-4.8 doesn't
|
|
Alain Reguera Delgado |
8f60cb |
# support structuring through parts, but chapters and sections
|
|
Alain Reguera Delgado |
8f60cb |
# only).
|
|
Alain Reguera Delgado |
8f60cb |
if [[ $MANUAL_PART_NAME != '' ]];then
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`gettext "The documentation entry provided isn't supported."`" --as-error-line
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify documentation format based on file type.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ -f ${MANUAL_BASEFILE}.${MANUAL_EXTENSION} ]];then
|
|
Alain Reguera Delgado |
8f60cb |
cli_checkFiles -i "text/x-texinfo" ${MANUAL_BASEFILE}.${MANUAL_EXTENSION}
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define absolute path to template directory. This is the place
|
|
Alain Reguera Delgado |
8f60cb |
# where we store locale directories (e.g., en_US, es_ES, etc.)
|
|
Alain Reguera Delgado |
8f60cb |
# used to build manuals in texinfo format.
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_TEMPLATE=${MANUAL_TLDIR}/$(cli_getRepoName ${FLAG_FORMAT} -d)/Default
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define absolute path to language-specific template directory.
|
|
Alain Reguera Delgado |
8f60cb |
# This is the place where we store locale-specific files used to
|
|
Alain Reguera Delgado |
8f60cb |
# build manuals in texinfo format.
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_TEMPLATE_L10N=${MANUAL_TEMPLATE}/${MANUAL_L10N}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify absolute path to language-specific template directory.
|
|
Alain Reguera Delgado |
8f60cb |
# If it doesn't exist, use English language as default location to
|
|
Alain Reguera Delgado |
8f60cb |
# retrieve template files.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ ! -d $MANUAL_TEMPLATE_L10N ]];then
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_TEMPLATE_L10N=${MANUAL_TEMPLATE}/en_US
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize document structure for new manuals.
|
|
Alain Reguera Delgado |
8f60cb |
texinfo_createStructure
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define documentation entry default values. To build the
|
|
Alain Reguera Delgado |
8f60cb |
# documentation entry, we combine the manual's name, part, chapter
|
|
Alain Reguera Delgado |
8f60cb |
# and section information retrieved from the command-line.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ $MANUAL_CHAPTER_NAME == '' ]];then
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# When chapter option is not provided, discard the section
|
|
Alain Reguera Delgado |
8f60cb |
# name and define documentation entry based on manual's main
|
|
Alain Reguera Delgado |
8f60cb |
# definition file.
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_ENTRY="${MANUAL_BASEFILE}.${MANUAL_EXTENSION}"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
elif [[ $MANUAL_CHAPTER_NAME != '' ]] && [[ $MANUAL_SECTION_NAME == '' ]];then
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# When chapter option is provided without a section name,
|
|
Alain Reguera Delgado |
8f60cb |
# verify chapter's directory inside the manual,
|
|
Alain Reguera Delgado |
8f60cb |
texinfo_createChapter
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# and define documentation entry based on chapter's main
|
|
Alain Reguera Delgado |
8f60cb |
# definition file.
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_ENTRY="${MANUAL_BASEDIR_L10N}/${MANUAL_CHAPTER_NAME}.${MANUAL_EXTENSION}"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
elif [[ $MANUAL_CHAPTER_NAME != '' ]] && [[ $MANUAL_SECTION_NAME != '' ]];then
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# When both the chapter option and non-option arguments are
|
|
Alain Reguera Delgado |
8f60cb |
# provided, define documentation entries based on manual,
|
|
Alain Reguera Delgado |
8f60cb |
# chapter and non-option arguments.
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_ENTRY="$(texinfo_getEntry "$MANUAL_SECTION_NAME")"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
else
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`gettext "The parameters you provided are not supported."`" --as-error-line
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Execute action names. Notice that we've separated execution of
|
|
Alain Reguera Delgado |
8f60cb |
# action names in order to control and save differences among
|
|
Alain Reguera Delgado |
8f60cb |
# them.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ $ACTIONNAM == "" ]];then
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# When no action name is provided to `centos-art.sh' script,
|
|
Alain Reguera Delgado |
8f60cb |
# read manual's info output in order to provide a way for
|
|
Alain Reguera Delgado |
8f60cb |
# people to get oriented about The CentOS Artwork Repository
|
|
Alain Reguera Delgado |
8f60cb |
# and its automation too. Be sure the manual and its info
|
|
Alain Reguera Delgado |
8f60cb |
# output file do exist. Later, once the reading is done,
|
|
Alain Reguera Delgado |
8f60cb |
# terminate the script execution.
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Update manual's output files.
|
|
Alain Reguera Delgado |
8f60cb |
texinfo_updateOutputFiles
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Read manual's Top node from its info output file.
|
|
Alain Reguera Delgado |
8f60cb |
info --node="Top" --file="${MANUAL_OUTPUT_BASEFILE}.info.bz2"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
elif [[ $ACTIONNAM =~ "^(copy|rename|delete)Entry$" ]];then
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Both `--copy' and `--rename' actions interpret non-option
|
|
Alain Reguera Delgado |
8f60cb |
# arguments passed to `centos-art.sh' script in a special way.
|
|
Alain Reguera Delgado |
8f60cb |
# In this configuration, only two non-option arguments are
|
|
Alain Reguera Delgado |
8f60cb |
# processed in the first loop of their interpretation.
|
|
Alain Reguera Delgado |
8f60cb |
texinfo_${ACTIONNAM}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Rebuild output files to propagate recent changes, if any.
|
|
Alain Reguera Delgado |
8f60cb |
texinfo_updateOutputFiles
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Break interpretation of non-option arguments to prevent the
|
|
Alain Reguera Delgado |
8f60cb |
# second and further non-option arguments from being
|
|
Alain Reguera Delgado |
8f60cb |
# considered as source location.
|
|
Alain Reguera Delgado |
8f60cb |
break
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
else
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Execute action names as part of normal help command's
|
|
Alain Reguera Delgado |
8f60cb |
# execution flow, without any extra modification.
|
|
Alain Reguera Delgado |
8f60cb |
texinfo_${ACTIONNAM}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
}
|