summaryrefslogtreecommitdiff
path: root/doc/mkinstall
blob: f6b6ccf7806df4230a7f9ea3e50ebc62858e43b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /bin/sh
#
# mkinstall - make the INSTALL file from the `Installing Bash' node of the
#	      texinfo manual
#

NODE="Installing Bash"
SUBNODE="Basic Installation"
TEXI=bashref.texi
TMPINFO=temp.info
TMPOUT=INSTALL.tmp

OUT=${1:-INSTALL}

trap 'rm -f $TMPOUT $TMPINFO $OUT; trap '' 0; exit 1' 1 2 3 6 15
trap 'rm -f $TMPOUT $TMPINFO' 0

# create an info file without paragraph indentation
makeinfo --no-split --no-number-sections -I../lib/readline/doc --paragraph-indent 0 -o $TMPINFO $TEXI

# write out the text from the `Installing Bash' node to INSTALL.tmp
info --file $TMPINFO --node "$NODE" --subnodes --output $TMPOUT

# remove the info traversal information and the initial menu, and squeeze
# out multiple consecutive blank lines like `cat -s'
awk 'BEGIN { printline = 0; newlines = 0; }

/^File: '$TMPINFO'/	{ next; }

/^'"$SUBNODE"'/	{ printline = 1; }

/^$/			{ if (printline) newlines = 1; next; }

/$/			{ if (printline) {
				if (newlines) {
					printf "\n";
					newlines = 0;
				}
				print $0;
			  }
			}' < $TMPOUT > $OUT

exit 0