|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
1afa3c |
# texinfo_deleteEntry.sh -- This function removes a documentation entry
|
|
|
5285d6 |
# from documentation directory structure.
|
|
|
4c79b5 |
#
|
|
|
2d3646 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
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
|
|
|
4c79b5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# You should have received a copy of the GNU General Public License
|
|
|
4c79b5 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
1afa3c |
function texinfo_deleteEntry {
|
|
|
4c79b5 |
|
|
|
635e5d |
# Print separator line.
|
|
|
18be6e |
cli_printMessage '-' --as-separator-line
|
|
|
635e5d |
|
|
|
3385aa |
local ENTRY_SRC=${ENTRY}
|
|
|
4c79b5 |
local ENTRIES=''
|
|
|
3385aa |
local ENTRY=''
|
|
|
3385aa |
local ENTRY_DEP=''
|
|
|
4c79b5 |
|
|
|
449927 |
# Initiate list of entries to remove using the entry specified in
|
|
|
449927 |
# the command line.
|
|
|
3385aa |
ENTRIES=${ENTRY_SRC}
|
|
|
449927 |
|
|
|
449927 |
# Verify existence of dependent entries. Dependent entries are
|
|
|
449927 |
# stored inside a directory with the same name of the entry you
|
|
|
449927 |
# are trying to remove.
|
|
|
449927 |
if [[ -d ${ENTRY_DIR}/${ENTRY_FILE} ]];then
|
|
|
449927 |
|
|
|
3385aa |
# Add dependent files to list of entries.
|
|
|
66b6ae |
ENTRIES="${ENTRIES} $(cli_getFilesList ${ENTRY_DIR}/${ENTRY_FILE} --pattern=".*\.${FLAG_BACKEND}")"
|
|
|
449927 |
|
|
|
3385aa |
# Add dependent directories to list of entries. Be aware of
|
|
|
3385aa |
# nested directories.
|
|
|
3385aa |
for ENTRY in ${ENTRIES};do
|
|
|
66b6ae |
ENTRY_DEP=$(echo $ENTRY | sed -r "s/\.${FLAG_BACKEND}$//")
|
|
|
3385aa |
if [[ -d $ENTRY_DEP ]];then
|
|
|
3385aa |
ENTRIES="${ENTRIES} ${ENTRY_DEP}"
|
|
|
3385aa |
fi
|
|
|
3385aa |
done
|
|
|
4c79b5 |
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
449927 |
# Prepare list of entries for action preamble.
|
|
|
3385aa |
ENTRIES=$(echo ${ENTRIES} | tr ' ' "\n" | sort -r | uniq)
|
|
|
5285d6 |
|
|
|
638bf8 |
# Print action preamble.
|
|
|
a0117c |
cli_printActionPreamble $ENTRIES --to-delete
|
|
|
638bf8 |
|
|
|
635e5d |
# Remove documentation entry using Subversion's `delete' command
|
|
|
635e5d |
# to know when the action took place. Do not use regular `rm'
|
|
|
635e5d |
# command here.
|
|
|
3385aa |
svn del ${ENTRIES} --quiet
|
|
|
635e5d |
|
|
|
635e5d |
# Verify exit status from subversion command to be sure everything
|
|
|
635e5d |
# went well. Otherwhise stop script execution.
|
|
|
136786 |
if [[ $? -ne 0 ]];then
|
|
|
18be6e |
cli_printMessage "${FUNCDIRNAM}" --as-toknowmore-line
|
|
|
136786 |
fi
|
|
|
4456e8 |
|
|
|
449927 |
# Print separator line.
|
|
|
18be6e |
cli_printMessage '-' --as-separator-line
|
|
|
449927 |
|
|
|
449927 |
# Print action message.
|
|
|
18be6e |
cli_printMessage "Updating menus, nodes and cross-references." '--as-response-line'
|
|
|
449927 |
|
|
|
449927 |
# Process list of entries in order to update menus, nodes and
|
|
|
449927 |
# cross references. Since we are verifying entry status before
|
|
|
449927 |
# remove the we cannot update the information in the same loop we
|
|
|
449927 |
# remove files. This would modify some file before be removed and
|
|
|
449927 |
# that would stop script execution. Similary, if we do update
|
|
|
449927 |
# menus, nodes and cross references before removing files it would
|
|
|
449927 |
# be needed to remove farther status verification in order for the
|
|
|
449927 |
# script to continue its execution. Thereby, I can't see a
|
|
|
449927 |
# different way but removing files first using status verification
|
|
|
635e5d |
# and later go through entries list again to update menus, nodes
|
|
|
635e5d |
# and cross references in remaining files.
|
|
|
3385aa |
for ENTRY in ${ENTRIES};do
|
|
|
3385aa |
|
|
|
449927 |
# Update menu and node definitions from manual sections to
|
|
|
449927 |
# reflect the changes.
|
|
|
1afa3c |
texinfo_updateMenu "remove-entry"
|
|
|
1afa3c |
texinfo_updateNodes
|
|
|
4456e8 |
|
|
|
449927 |
# Update cross reference definitions from manual to reflect
|
|
|
449927 |
# the changes.
|
|
|
1afa3c |
texinfo_deleteCrossReferences
|
|
|
f8fb31 |
|
|
|
4456e8 |
done
|
|
|
4456e8 |
|
|
|
635e5d |
# Rebuild output files to propagate recent changes.
|
|
|
1afa3c |
texinfo_updateOutputFiles
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|