From 3cc2c7e484072226d0bd6ecdf76812990bb1afd6 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Jul 23 2011 02:15:33 +0000 Subject: Update `texinfo_updateSectionMenu.sh': - Don't use the MANUAL_CHAPTER_DIR variable here. Use `$(dirname ${MANUAL_ENTRY})' instead; it is safer. The MANUAL_CHAPTER_DIR variable, here, is used as base location to reach the `chapter-menu.texinfo' definition file. When no chapter name is provided to `centos-art.sh' script as non-option parameter in the command-line, the value of MANUAL_CHAPTER_DIR will be empty as well and path to `chapter-menu.texinfo' file will be wrong. The `$(dirname ${MANUAL_ENTRY})' construction, on the other hand, will always return the chapter directory where the section entry is stored in. No matter if the chapter information wasn't provided to `centos-art.sh' script in the command-line. - Be sure menu entries won't be duplicated when new menu entries are added/updated. --- diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh index 3c3addc..b932b16 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh @@ -57,7 +57,7 @@ function texinfo_updateSectionMenu { # Retrive list of menu entries from chapter menu and exclude # `@menu', `@end menu' and empty lines from output. - local MENU=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.${MANUAL_EXTENSION} \ + local MENU=$(cat $(dirname ${MANUAL_ENTRY})/chapter-menu.${MANUAL_EXTENSION} \ | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') # Re-defined chapter menu entries based on action provided to this @@ -66,13 +66,13 @@ function texinfo_updateSectionMenu { --delete-entry ) # Remove menu entry from chapter menu. - MENU=$(echo "$MENU" | egrep -v "$MENULINE") + MENU="$(echo "$MENU" | egrep -v "$MENULINE")" ;; --add-entry | * ) # Add menu entry to chapter menu list as last entry. - MENU="$MENU - $MENULINE" + MENU="$(echo "$MENU" | egrep -v "$MENULINE" ) + ${MENULINE}" ;; esac @@ -108,6 +108,6 @@ function texinfo_updateSectionMenu { # Dump chapter menu entries back into chapter's menu definition # file. - echo "$MENU" > $MANUAL_CHAPTER_DIR/chapter-menu.${MANUAL_EXTENSION} + echo "$MENU" > $(dirname ${MANUAL_ENTRY})/chapter-menu.${MANUAL_EXTENSION} }