Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 252 lines (233 sloc) 6.385 kb
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
1 #!/bin/sh
2 #
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
3 # This shell script is used on UNIX-like systems to install or remove
4 # man-pages. It is run automatically during "make install".
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
5 #
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
6 # usage: sh install.sh [-u] [-bbindir] programs...
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
7 #
8 ################################################################################
9
10 # This is a list of directories where the nroff source for man-pages might
11 # be installed. The order is important -- the man-pages will be installed
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
12 # in the first existing directory in the list. If "-b /usr/local/bin" is
13 # an argument, then /usr/local/man/man1 is added to the front of the list.
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
14 MANDIRS="/usr/man/man.l /usr/man/man.LOCAL /usr/man/man.1 /usr/man/1
15 /usr/catman.C /usr/man/manl /usr/man/man1 /usr/elvis/man"
16
17 # Similarly, this is a list of directories where the plaintext form of the
18 # man-pages might belong. If, after searching, it is decided that both forms
19 # should go in the same directory, then only the plain-text version is
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
20 # installed. If "-b /usr/local/bin" is an argument, then /usr/local/man/cat1
21 # is added to the front of the list.
22 CATDIRS="/usr/man/catmanl /usr/man/catman.l /usr/man/catman.LOCAL
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
23 /usr/man/cat.LOCAL /usr/man/catman.1 /usr/man/cat.C /usr/catman.C
24 /usr/catman/1 /usr/man/1 /usr/man/cat1"
25
26 ################################################################################
27
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
28 # Look for a "-r"
29 if test "$1" = "-r"
30 then
31 shift
32 job="remove"
33 else
34 job="install"
35 fi
36
37 # Look for a "-bbindir" argument
38 case "$1" in
39 -b*/bin)
40 MANDIRS=`echo "X$1" | sed 's/X-b\(.*\)\/bin$/\1\/man\/man1 \1\/man\/man.1 \1\/man\/man.C/'`" clubland $MANDIRS"
41 CATDIRS=`echo "X$1" | sed 's/X-b\(.*\)\/bin$/\1\/man\/cat1 \1\/man\/catman1 \1\/man\/cat.1 \1\/man\/cat.C/'`" clubland $CATDIRS"
42 shift
43 ;;
44 -b)
45 shift
46 MANDIRS=`echo "X$1" | sed 's/X\(.*\)\/bin$/\1\/man\/man1 \1\/man\/man.1 \1\/man\/man.C/'`" clubland $MANDIRS"
47 CATDIRS=`echo "X$1" | sed 's/X\(.*\)\/bin$/\1\/man\/cat1 \1\/man\/catman1 \1\/man\/cat.1 \1\/man\/cat.C/'`" clubland $CATDIRS"
48 shift
49 ;;
50 -b*)
51 shift
52 ;;
53 esac
54
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
55 # Complain if no programs were named on the command line
56 if test $# -lt 1
57 then
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
58 echo "Usage: sh instman.sh [-r] [-b bindir] {program names...}"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
59 echo " where {program names...} is a list of programs whose"
60 echo " manual pages are to be installed. It is assumed that"
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
61 echo " the manual pages are currently located inside the 'lib'"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
62 echo " subdirectory."
63 echo
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
64 echo " -r Remove man-pages (else install them)"
65 echo " -b bindir Take a hint for possible man directory from"
66 echo " the name of the bin directory"
67 echo
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
68 echo " Note: Normally, this script is executed via 'make install'"
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
69 echo " or 'make uninstall'"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
70 exit 1
71 fi
72
73 # The installed manpages should be readable by everybody, but writable only
74 # by us.
75 umask 022
76
77 # Decide where to put the nroff source docs
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
78 manclubland=yes
79 eval `for dir in $MANDIRS
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
80 do
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
81 if test $dir = clubland
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
82 then
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
83 echo manclubland=no
84 elif test -d $dir -a -w $dir
85 then
86 echo mandir=$dir
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
87 exit 0
88 fi
89 done`
90 anydir=$mandir
91
92 # Decide where to put the plaintext docs
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
93 catclubland=yes
94 eval `for dir in $CATDIRS
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
95 do
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
96 if test $dir = clubland
97 then
98 echo catclubland=no
99 elif test -d $dir -a -w $dir
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
100 then
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
101 echo catdir=$dir
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
102 exit 0
103 fi
104 done`
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
105
106 # Both names should be either in the list derived from "-b dir" or on the
107 # default list. If we have a mixture, then ignore the catdir.
108 if test -n "$mandir" -a -n "$catdir" -a $manclubland != $catclubland
109 then
110 catdir=""
111 elif test -n "$catdir"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
112 then
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
113 anydir=$catdir
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
114 fi
115
116 # If we didn't find a directory for either of them, then complain & quit
117 if test -z "$anydir"
118 then
119 echo "::: I CAN'T AUTOMATICALLY INSTALL THE MAN PAGES ON THIS SYSTEM"
120 echo "::: BECAUSE I DON'T KNOW WHERE TO PUT THEM! YOU CAN EITHER"
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
121 echo "::: TRY EDITING THE \"instman.sh\" SCRIPT & RERUNNING IT, OR"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
122 echo "::: SIMPLY INSTALL THEM YOURSELF BY HAND."
123 exit 1
124 fi
125
126 # If they're the same, then we only want to install the plaintext versions
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
127 if test "$mandir" = "$catdir"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
128 then
129 mandir=
130 fi
131
132 # Choose the installed filename extension by looking at the name of the
133 # directory we'll be installing it into.
134 case "$anydir" in
135 *.LOCAL) ext=.LOCAL ;;
136 *.L) ext=.L ;;
137 *l) ext=.l ;;
138 *1) ext=.1 ;;
139 *) ext= ;;
140 esac
141
142 # If we're going to be installing the nroff source, then do it now
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
143 if test -n "$mandir"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
144 then
145 for i
146 do
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
147 case $job in
148 install) cp lib/$i.man $mandir/$i$ext ;;
149 remove) rm $mandir/$i$ext* ;;
150 esac
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
151 done
152 fi
153
154 # Sleep briefly, to ensure that the plaintext versions of the files will
155 # be installed with a newer timestamp than the nroff versions.
156 sleep 1
157
158 # If we're going to be installing the plaintext pages, then do it now
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
159 if test -n "$catdir"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
160 then
161 for i
162 do
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
163 case $job in
164 install)
165 if [ -x /usr/bin/nroff ]
166 then
167 /usr/bin/nroff -man lib/$i.man >$catdir/$i$ext
168 elif [ -x ./elvis ]
169 then
170 ELVISPATH=dummypath; export ELVISPATH
171 EXINIT="se lptype=bs"; export EXINIT
172 ./elvis -gquit -c"se bufdisplay=man|lp! $catdir/$i$ext" lib/$i.man
173 else
174 # give nroff another chance
175 nroff -man lib/$i.man >$catdir/$i$ext
176 fi
177 ;;
178 remove)
179 rm $catdir/$i$ext*
180 ;;
181 esac
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
182 done
183 fi
184
185 # Are man pages sometimes compressed or packed on this system? If so,
186 # then give these new pages the same treatment.
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
187 case $job in
188 install)
189 for dir in $mandir $catdir
190 do
191 if test "`echo $dir/*.Z`" != "$dir/*.Z"
192 then
193 for i
194 do
195 rm -f $dir/$i$ext.Z
196 compress $dir/$i$ext
197 done
198 finalext=$ext.Z
199 elif test "`echo $dir.Z/*`" != "$dir.Z/*"
200 then
201 for i
202 do
203 compress <$dir/$i$ext >$dir.Z/$i$ext && rm -f $dir/$i$ext
204 done
205 finalext=$ext
206 elif test "`echo $dir/*.z`" != "$dir/*.z"
207 then
208 for i
209 do
210 rm -f $dir/$i$ext.z
211 pack $dir/$i$ext
212 done
213 finalext=$ext.z
214 elif test "`echo $dir/*.gz`" != "$dir/*.gz"
215 then
216 for i
217 do
218 rm -f $dir/$i$ext.z
219 gzip -f $dir/$i$ext
220 done
221 finalext=$ext.gz
222 else
223 finalext=$ext
224 fi
225 done
226 ;;
227 esac
228
229 # Say what was done
230 case $job in
231 install)
232 if test -n "$mandir"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
233 then
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
234 echo "nroffable manpages installed as $mandir/progname$finalext"
235 fi
236 if test -n "$catdir"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
237 then
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
238 echo "plaintext manpages installed as $catdir/progname$finalext"
239 fi
240 ;;
241 remove)
242 if test -n "$mandir"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
243 then
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
244 echo "nroffable manpages removed from $mandir"
245 fi
246 if test -n "$catdir"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
247 then
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
248 echo "plaintext manpages removed from $catdir"
6335386 @mbert Import Elvis 1.8 (written by Steve Kirkendall)
authored
249 fi
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
250 ;;
251 esac
Something went wrong with that request. Please try again.