3 # generate an Info directory, given a directory of Info files and a
4 # list of entries. The output will be suitable for a dir.info file,
5 # in the order given in the skeleton file
16 if [ $# -gt 2 ] ; then
17 echo usage
: $0 info-directory
[ skeleton-file
] 1>&2
23 if [ ! -d ${INFODIR} ] ; then
24 echo "$0: first argument must specify a directory"
28 infofiles
=`(cd ${INFODIR}; ls *.info | sort | sed "s/dir\.info//")`
29 template
=`cat ${SKELETON}`
31 ### output the dir.info header
33 echo "This file was generated automatically by the gen-info-dir script."
34 echo "This version was generated on `date`"
35 echo "by `whoami`@`hostname` for `(cd ${INFODIR}; pwd)`"
39 This is the file .../info/dir, which contains the topmost node of the
40 Info hierarchy. The first time you invoke Info you start off
41 looking at that node, which is (dir)Top.
43 File: dir Node: Top This is the top of the INFO tree
44 This (the Directory node) gives a menu of major topics.
45 Typing "d" returns here, "q" exits, "?" lists all INFO commands, "h"
46 gives a primer for first-timers, "mTexinfo<Return>" visits Texinfo topic,
48 --- PLEASE ADD DOCUMENTATION TO THIS TREE. (See INFO topic first.) ---
50 * Menu: The list of major topics begins on the next line.
55 ### go through the list of files in the template. If an info file
56 ### exists, grab the ENTRY information from it. If there is no entry
57 ### info, then create a minimal dir entry, otherwise use the given info.
59 ### Then remove that file from the list of existing files. If any
60 ### additional files remain (ones that don't have a template entry),
61 ### then generate entries for those in the same way, putting the info for
62 ### those at the very end....
64 for file in ${template} ; do
65 if [ "${file}" = "--" ] ; then
68 if [ -f ${INFODIR}/${file}.info
] ; then
69 entry
=`sed -e '1,/START-INFO-DIR-ENTRY/d' -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/${file}.info`
70 if [ ! -z "${skip}" ] ; then
75 if [ ! -z "${entry}" ] ; then
78 echo "* ${file}: (${file})."
81 infofiles
=`echo ${infofiles} | sed -e "s/${file}\.info//"`
86 if [ -z "${infofiles}" ] ; then
92 for file in ${infofiles}; do
93 entry
=`sed -e '1,/START-INFO-DIR-ENTRY/d' -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/${file}`
95 if [ ! -z "${entry}" ] ; then
98 echo "* ${file}: (${file})."