1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Id: mkinfodir,v 1.3 2005-01-06 23:28:28 niro Exp $ |
# $Id: mkinfodir,v 1.7 2005-06-01 15:48:42 niro Exp $ |
3 |
# Generate the top-level Info node, given a directory of Info files |
# Generate the top-level Info node, given a directory of Info files |
4 |
# and (optionally) a skeleton file. The output will be suitable for a |
# and (optionally) a skeleton file. The output will be suitable for a |
5 |
# top-level dir file. The skeleton file contains info topic names in the |
# top-level dir file. The skeleton file contains info topic names in the |
21 |
# modified 7 April 1995 by Joe Harrington <jh@tecate.gsfc.nasa.gov> to |
# modified 7 April 1995 by Joe Harrington <jh@tecate.gsfc.nasa.gov> to |
22 |
# take special flags |
# take special flags |
23 |
|
|
24 |
# version: 0.3.6-r10 |
# $Id$ |
25 |
|
|
26 |
INFODIR=$1 |
INFODIR=$1 |
27 |
if [ $# = 2 ] ; then |
if [ $# = 2 ] ; then |
46 |
exit 1 |
exit 1 |
47 |
fi |
fi |
48 |
|
|
49 |
|
# sanity checks |
50 |
|
if [[ -x $(type -P date) ]] |
51 |
|
then |
52 |
|
_DATE="$(date)" |
53 |
|
else |
54 |
|
_DATE="unknown date" |
55 |
|
fi |
56 |
|
if [[ -x $(type -P whoami) ]] |
57 |
|
then |
58 |
|
_WHOAMI="$(whoami)" |
59 |
|
else |
60 |
|
if [[ -n ${USER} ]] |
61 |
|
then |
62 |
|
_WHOAMI="${USER}" |
63 |
|
else |
64 |
|
_WHOAMI="unknown user" |
65 |
|
fi |
66 |
|
fi |
67 |
|
if [[ -x $(type -P hostname) ]] |
68 |
|
then |
69 |
|
_HOSTNAME="$(hostname)" |
70 |
|
else |
71 |
|
if [[ -n ${HOSTNAME} ]] |
72 |
|
then |
73 |
|
_HOSTNAME="${HOSTNAME}" |
74 |
|
else |
75 |
|
_HOSTNAME="unknown hostname" |
76 |
|
fi |
77 |
|
fi |
78 |
|
if [[ -x $(type -P pwd) ]] |
79 |
|
then |
80 |
|
_PWD="$(cd ${INFODIR}; pwd)" |
81 |
|
else |
82 |
|
if [[ -n ${PWD} ]] |
83 |
|
then |
84 |
|
_PWD="$(cd ${INFODIR}; echo $PWD)" |
85 |
|
else |
86 |
|
_PWD="unknown directory" |
87 |
|
fi |
88 |
|
fi |
89 |
|
|
90 |
### output the dir header |
### output the dir header |
91 |
echo "-*- Text -*-" |
echo "-*- Text -*-" |
92 |
echo "This file was generated automatically by $0." |
echo "This file was generated automatically by $0." |
93 |
echo "This version was generated on `date`" |
echo "This version was generated on ${_DATE}" |
94 |
echo "by `whoami`@`hostname` for `(cd ${INFODIR}; pwd)`" |
echo "by ${_WHOAMI}@${_HOSTNAME} for ${_PWD}" |
95 |
|
|
96 |
cat << moobler |
cat << moobler |
97 |
\$Id: mkinfodir,v 1.3 2005-01-06 23:28:28 niro Exp $ |
\$Id: mkinfodir,v 1.7 2005-06-01 15:48:42 niro Exp $ |
98 |
This is the file .../info/dir, which contains the topmost node of the |
This is the file .../info/dir, which contains the topmost node of the |
99 |
Info hierarchy. The first time you invoke Info you start off |
Info hierarchy. The first time you invoke Info you start off |
100 |
looking at that node, which is (dir)Top. |
looking at that node, which is (dir)Top. |