Merge 1.8.0~pre4 packaging into master
[pkg-k5-afs_openafs.git] / doc / man-pages / generate-man
blob726e0cb065fd414cca2e7088f24d1a8cc017ecd7
1 #!/bin/sh
3 # Generate the OpenAFS man pages from POD source. This script is normally
4 # invoked by regen.sh but may be run at any time to rebuild all of the man
5 # pages (with a newer version of pod2man than was used for the release, for
6 # instance).
8 # Exit on any error.
9 set -e
11 if [ ! -d pod1 ] ; then
12 echo 'generate-man must be run from the doc/man-pages directory' >&2
13 exit 1
16 if pod2man pod1/afs.pod > /dev/null ; then
18 else
19 echo 'pod2man not found, skipping man page generation' >&2
20 exit 1
22 if perl -e 'use Pod::Man 2.04' > /dev/null 2>&1 ; then
24 else
25 echo 'Pod::Man is older than the recommended version of 2.04 or later' >&2
26 echo 'Continuing with man page generation anyway' >&2
29 # Create the directories. We generate each section into its own directory
30 # to make installation rules easier.
31 [ -d man1 ] || mkdir man1
32 [ -d man3 ] || mkdir man3
33 [ -d man5 ] || mkdir man5
34 [ -d man8 ] || mkdir man8
36 # Generate each set of man pages. For each, allow for the case of the
37 # directory being empty. In that case, for won't expand the wildcard, and
38 # we want to avoid running pod2man with a wildcard as an argument.
39 pod1=`ls pod1`
40 if [ -n "$pod1" ] ; then
41 cd pod1
42 for f in *.pod ; do
43 pod2man -c 'AFS Command Reference' -r 'OpenAFS' -s 1 "$f" \
44 > ../man1/`echo "$f" | sed 's/\.pod$//'`.1
45 done
46 cd ..
48 pod3=`ls pod3`
49 if [ -n "$pod3" ] ; then
50 cd pod3
51 for f in *.pod ; do
52 pod2man -c 'AFS Library Reference' -r 'OpenAFS' -s 3 "$f" \
53 > ../man3/`echo "$f" | sed -e 's/\.pod$//' -e 's/^AFS\./AFS::/'`.3
54 # Perl module manpages are named AFS.foo instead of AFS::foo, since
55 # we cannot have colons in filenames on Windows. So here, we assume
56 # anything with "AFS." should be "AFS::" instead.
57 done
58 cd ..
60 pod5=`ls pod5`
61 if [ -n "$pod5" ] ; then
62 cd pod5
63 for f in *.pod ; do
64 pod2man -c 'AFS File Reference' -r 'OpenAFS' -s 5 "$f" \
65 > ../man5/`echo "$f" | sed 's/\.pod$//'`.5
66 done
67 cd ..
69 pod8=`ls pod8`
70 if [ -n "$pod8" ] ; then
71 cd pod8
72 for f in *.pod ; do
73 pod2man -c 'AFS Command Reference' -r 'OpenAFS' -s 8 "$f" \
74 > ../man8/`echo "$f" | sed 's/\.pod$//'`.8
75 done
76 cd ..