|
|
1.1 root 1: #!/bin/csh -f -x
2: #
3: ###############################################################################
4: #
5: # Script to generate communication commands and documentations (cht).
6: #
7: # Sypnosis:
8: #
9: # mkcmd REL=rel (SRC=srcdir) (DES=desdir) (MAN=mandir)
10: #
11: # where rel: release level (no default value).
12: # srcdir: directory of source codes (default is /usr/src).
13: # desdir: directory of result files.
14: # mandir: directory of man pages (default is /usr/man).
15: #
16: #
17: # In the destdir, the following directories and files will be created:
18: #
19: # usr all communication commands and documentations to be
20: # under /usr
21: #
22: # etc all the daemons and configuration files to be
23: # under /etc
24: #
25: # SETUP a shell script to be run after installing the commands
26: # and daemons. SETUP merely changes the ownership and
27: # turns on the set owner bit for certain commands.
28: #
29: # Note, all configuration files are suffixed with the 'rel' value of
30: # REL argument.
31: #
32: ###############################################################################
33:
34: set starttime = `date`
35: set BASEDIR = `pwd`
36:
37: # get arguments
38: set REL = ""
39: set RELSRC = (source file area)
40: set SRC = "${RELSRC}/SRC/usr/src"
41: set MAN = "${RELSRC}/SRC/man"
42: set DES = "${RELSRC}/netbin"
43: foreach x ( $* )
44:
45: set ARGNAME = ` echo $x | sed -e "s/\(...\).*/\1/"`
46: set ARGVAL = ` echo $x | sed -e "s/....\(.*\)/\1/"`
47:
48: switch ($ARGNAME)
49: case REL:
50: set REL = $ARGVAL
51: breaksw
52: case SRC:
53: set SRC = $ARGVAL
54: breaksw
55:
56: case MAN:
57: set MAN = $ARGVAL
58: breaksw
59: case DES:
60: set DES = $ARGVAL
61: breaksw
62: default:
63: echo "mkcmd: bad argument name '$ARGNAME'"
64: exit
65: endsw
66: end
67: if ( ( $REL == "" ) ) then
68: echo "Usage: mkcmd REL=rel PAR=makeparam (SRC=srcdir) (MAN=docdir) (DES=desdir)"
69: exit
70: endif
71:
72: echo $MAKEPARAM
73: if (!( -e $DES )) then
74: mkdir $DES
75: endif
76:
77: # we use \/ so that csh does not treat "/" as a division operator
78: set root = "\/"
79: foreach x ( $SRC $MAN )
80: set prefix = ` echo $x | sed -e "s/\(.\).*/\1/" `
81: set prefix = "\"$prefix
82: if ( $prefix != $root ) then
83: echo "mkcmd: absolute pathname must be given for SRC or MAN"
84: exit
85: endif
86: end
87: set prefix = ` echo $DES | sed -e "s/\(.\).*/\1/" `
88: set prefix = "\"$prefix
89: if ( $prefix != $root ) then
90: set DES = `pwd`/$DES
91: endif
92: set INCLDIR = `echo $MAKEPARAM | sed -e "s/.*INCLDIR=\([^ ]*\).*/\1/"`
93: set CC=`echo $MAKEPARAM | sed -e "s/.*CC=\([^ ]*\).*/\1/"`
94: set LCC=/bin/cc
95:
96: echo "--------------------------------------------------"
97: echo "Making commands, daemons, and libraries from $SRC."
98: echo "Always starting from SCRATCH ( I am paranoid\!)"
99: echo "--------------------------------------------------"
100: echo will we generate libraries\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?
101: echo -------------------------------------------------------------
102:
103: echo
104: echo "Remove: $DES"
105: if ( -e $DES ) then
106: rm -rf $DES
107: endif
108: mkdir $DES
109: echo > $DES/CKOUT.LIST
110: cd $DES
111: foreach x ( usr etc atp usr/spool usr/ucb usr/lib usr/adm usr/src usr/man \
112: usr/man/man1 usr/man/man2 usr/man/man4 usr/man/man5 usr/man/man8 \
113: usr/spool/mqueue usr/src/etc usr/src/usr.lib usr/src/etc/htable \
114: usr/src/usr.lib/sendmail usr/src/usr.lib/sendmail/cf \
115: usr/src/usr.lib/sendmail/doc usr/src/usr.lib/sendmail/md \
116: usr/src/usr.lib/sendmail/test )
117: mkdir $x
118: end
119:
120: #
121: # set shell scripts to checkout
122: # co1 to check out a single file
123: # co2 to check out an entire subdirectory
124: #
125: rm -f $DES/co1 $DES/co2
126: echo > $DES/co1
127: ed - $DES/co1 << ENDCO1
128: a
129: #\!/bin/csh -f
130: echo --- \`pwd\`/\$2 : |& tee -a \$1/CKOUT.LIST
131: if ( -w \$2 ) then
132: echo \$2 is writeable and is NOT checked out. | tee -a \$1/CKOUT.LIST
133: else
134: co \$2 |& tee -a \$1/CKOUT.LIST
135: endif
136: .
137: w
138: q
139: ENDCO1
140:
141: echo > $DES/co2
142: ed - $DES/co2 << ENDCO2
143: a
144: #\!/bin/csh -f
145: echo --- \`pwd\` : |& tee -a \$1/CKOUT.LIST
146: foreach y (RCS/*)
147: set z = \`basename \$y ,v\`
148: set z = \`echo \$z | sed -e "s/RCS/./"\`
149: if ( -w \$z ) then
150: echo \$z is writeable and is NOT checked out. | tee -a \$1/CKOUT.LIST
151: else
152: co \$y |& tee -a \$1/CKOUT.LIST
153: endif
154: end
155: .
156: w
157: q
158: ENDCO2
159: chmod 777 $DES/co1 $DES/co2
160:
161: echo
162: echo "-------------------------------------------------------"
163: echo "Making commands from $SRC/ucb."
164: echo "Result binaries are in $DES/usr/ucb."
165: echo "Commands :"
166: # we collect names of commands to be generated into lists, then
167: # verify if these commands are really generated.
168: echo > $DES/usr.ucb.list
169: cd $SRC/ucb
170: foreach x (rcp rlogin rsh ruptime rwho telnet)
171: echo -n " `/bin/pwd`/$x "
172: echo $x >> $DES/usr.ucb.list
173: # $DES/co1 $DES $x.c
174: switch ( $x )
175: case ruptime:
176: case rwho:
177: $CC -O -I{$INCLDIR} -o $DES/usr/ucb/$x {$x}.c
178: breaksw
179: default:
180: $CC -O -I{$INCLDIR} -o $DES/usr/ucb/$x {$x}.c
181: breaksw
182: endsw
183: end
184:
185: foreach x (ftp netstat talk tftp)
186: echo -n " `/bin/pwd`/$x "
187: echo $x >> $DES/usr.ucb.list
188: cd $SRC/ucb/$x
189: # $DES/co2 $DES
190: make clean
191: make -f Makefile $MAKEPARAM
192: mv $x $DES/usr/ucb/$x
193: if ( $x == "talk") then
194: make -f Makefile talkd $MAKEPARAM
195: mv talkd $DES/etc/talkd
196: endif
197: # make clean
198: end
199: echo " "
200:
201:
202: echo
203: echo "-------------------------------------------------------"
204: echo "Making daemons or administration commands from $SRC/etc."
205: echo "Result binaries are in $DES/etc"
206: echo "Daemons and Commands: "
207: cd $SRC/etc
208: echo talkd > $DES/etc.list
209: foreach x ( comsat gettable ifconfig rexecd rlogind route rshd slconfig \
210: tftpd telnetd trpt rmt )
211: echo -n "`/bin/pwd`/$x "
212: echo $x >> $DES/etc.list
213: # $DES/co1 $DES $x.c
214: $CC -o $DES/etc/$x -O -I{$INCLDIR} {$x}.c
215: end
216:
217: foreach x ( dump ftpd htable implog nstat restore routed rwhod )
218: echo -n " `/bin/pwd`/$x "
219: echo $x >> $DES/etc.list
220: cd $SRC/etc/$x
221: # $DES/co2 $DES
222: make clean
223: # some extra cleanup or preparation
224: switch ($x)
225: case htable:
226: rm -f scan.c parse.c
227: breaksw
228: case routed:
229: cd tools
230: # $DES/co2 $DES
231: make clean
232: make -f Makefile $MAKEPARAM
233: # make clean
234: cd ..
235: breaksw
236: case ftpd:
237: rm -f vers.c
238: breaksw
239: endsw
240:
241: make -f Makefile ${MAKEPARAM}
242: switch ($x)
243: case dump:
244: case restore:
245: mv $x $DES/etc/$x
246: mv r$x $DES/etc/r$x
247: echo r$x >> $DES/etc.list
248: breaksw
249: default:
250: mv $x $DES/etc/$x
251: breaksw
252: endsw
253:
254: # make clean
255: end
256: echo " "
257:
258: # copy database files
259: cd $SRC/etc/htable
260: echo > $DES/htable.list
261: foreach x ( hosts.txt localhosts localnetworks )
262: if ( -e $x ) then
263: cp $x $DES/usr/src/etc/htable
264: endif
265: echo $x >> $DES/htable.list
266: end
267:
268: cd $SRC/etc
269: foreach x ( protocols services )
270: if ( -e $SRC/etc/$x ) then
271: cp $x $DES/etc/$x.{$REL}
272: endif
273: echo $x.{$REL} >> $DES/etc.list
274: end
275:
276: # copy atp scripts
277: cd $RELSRC/SRC/d/network.atp
278: echo > $DES/network.atp.list
279: foreach x ( ether ether_burn )
280: if ( -e $x) then
281: cp $x $DES/atp
282: endif
283: echo $x >> $DES/network.atp.list
284: end
285:
286: echo "------------------------------------------------------------"
287: echo "Making sendmail"
288: cd $SRC/usr.lib/sendmail
289: #$DES/co2 $DES
290: make clean
291: foreach x ( * )
292: if ( ( -d $x ) && ( $x != "RCS" )) then
293: cd $x
294: # $DES/co2 $DES
295: switch ($x)
296: case src:
297: make clean
298: rm -f Makefile
299: breaksw
300: case aux:
301: rm -f Makefile
302: breaksw
303: case cf:
304: make clean
305: breaksw
306: make $MAKEPARAM
307: endsw
308:
309: cd ..
310: endif
311: end
312:
313: make install DESTDIR=$DES
314: make clean
315:
316: # rename so that we don't overwrite existing configuration files
317: cd $DES/usr/lib
318: mv sendmail.hf sendmail.hf.{$REL}
319: mv sendmail.st sendmail.st.{$REL}
320: mv sendmail.fc sendmail.fc.{$REL}
321: mv sendmail.cf sendmail.cf.{$REL}
322:
323: cd $DES/etc
324: mv syslog.conf syslog.conf.{$REL}
325: mv syslog.pid syslog.pid.{$REL}
326:
327: # copy configuration files, docs, ... over for release
328: cd $SRC/usr.lib/sendmail/cf
329: echo > $DES/sendmail.cf.list
330: foreach x ( KEY Makefile Power6.cf Power6.mc amber.mc arpa.mc arpaproto.mc \
331: base.m4 berkhosts.m4 berkm.m4 brahms.mc cad.mc calder.mc ccbase.m4 \
332: cchosts.m4 compat.m4 coral.mc cory.mc csbase.m4 csether.mc dali.mc \
333: dbvax.mc ernie.mc ether.m4 etherm.m4 fncpm.m4 fudge.m4 ibmm.m4 \
334: ic.mc icw.mc ingres.mc ivory.mc jade.mc kim.mc lapis.mc localm.m4 \
335: matisse.mc medea.mc miro.mc mmdfm.m4 monet.mc ncphosts.m4 ncpm.m4 \
336: oz.mc ruby.mc statvax.mc suucpm.m4 tcphosts.m4 tcpm.m4 topaz.mc \
337: turner.mc ucbvax.mc uucpm.m4 uucpproto.mc version.m4 \
338: zerobase.m4 )
339: if ( -e $x ) then
340: cp $x $DES/usr/src/usr.lib/sendmail/cf
341: endif
342: echo $x >> $DES/sendmail.cf.list
343: end
344:
345: cd $SRC/usr.lib/sendmail/doc
346: echo > $DES/sendmail.doc.list
347: foreach x ( Makefile abstract diagram intro.me mailaddr.7 op.me \
348: refs rfc819.lpr rfc821.lpr rfc822.lpr sendmail.8 spell.good \
349: syslog.3 syslog.8 usenix.me )
350: if ( -e $x ) then
351: cp $x $DES/usr/src/usr.lib/sendmail/doc
352: endif
353: echo $x >> $DES/sendmail.doc.list
354: end
355:
356: cd $SRC/usr.lib/sendmail/md
357: echo > sendmail.md.list
358: foreach x ( c.nvmunix.m4 c.vmunix.m4 config.m4 )
359: if ( -e $x ) then
360: cp $x $DES/usr/src/usr.lib/sendmail/md
361: endif
362: echo $x >> $DES/sendmail.md.list
363: end
364:
365: cd $SRC/usr.lib/sendmail/test
366: echo > sendmail.test.list
367: foreach x ( fail1 fail2 tempfail )
368: if ( -e $x ) then
369: cp $x $DES/usr/src/usr.lib/sendmail/test
370: endif
371: echo $x >> $DES/sendmail.test.list
372: end
373:
374: # create lists of files needed
375: cd $DES
376:
377: echo syslog >> $DES/etc.list
378: echo syslog.conf.{$REL} >> $DES/etc.list
379: echo syslog.pid.{$REL} >> $DES/etc.list
380:
381: echo syslog > $DES/usr.spool.list
382: foreach x (0 1 2 3 4 5 6 7)
383: echo syslog.$x >> $DES/usr.spool.list
384: end
385:
386:
387: echo newsyslog > $DES/usr.adm.list
388:
389: echo sendmail > $DES/usr.lib.list
390: echo sendmail.hf.{$REL} >> $DES/usr.lib.list
391: echo sendmail.st.{$REL} >> $DES/usr.lib.list
392: echo sendmail.fc.{$REL} >> $DES/usr.lib.list
393: echo sendmail.cf.{$REL} >> $DES/usr.lib.list
394:
395: echo newaliases >> $DES/usr.ucb.list
396: echo mailq >> $DES/usr.ucb.list
397:
398:
399: echo -------------------------------------------------------------
400: echo copying man pages
401: cd $MAN/man1
402: echo > $DES/usr.man1.list
403: foreach x (rcp.1c rlogin.1c rsh.1c ruptime.1c rwho.1c telnet.1c \
404: ftp.1c netstat.1 talk.1 tftp.1c )
405: echo -n " $x "
406: echo $x >> $DES/usr.man1.list
407: # $DES/co1 $DES $x
408: if ( -e $x ) then
409: cp $MAN/man1/$x $DES/usr/man/man1/$x
410: endif
411: end
412:
413: cd $MAN/man2
414: echo > $DES/usr.man2.list
415: foreach x ( accept.2 bind.2 connect.2 gethostid.2 gethostname.2 \
416: getpeername.2 getsockname.2 getsockopt.2 listen.2 \
417: recv.2 recvfrom.2 recvmsg.2 send.2 sendmsg.2 sendto.2 \
418: sethostid.2 sethostname.2 setsockopt.2 shutdown.2 \
419: socket.2 socketpair.2 )
420: echo -n " $x "
421: echo $x >> $DES/usr.man2.list
422: # $DES/co1 $DES $x
423: if ( -e $x ) then
424: cp $MAN/man2/$x $DES/usr/man/man2/$x
425: endif
426: end
427:
428: cd $MAN/man4
429: echo > $DES/usr.man4.list
430: foreach x ( arp.4p imp.4 imp.4p inet.4f intro.4n ip.4p lo.4 \
431: pty.4 pup.4f pup.4p tcp.4p udp.4p )
432: echo -n " $x "
433: echo $x >> $DES/usr.man4.list
434: # $DES/co1 $DES $x
435: if ( -e $x ) then
436: cp $MAN/man4/$x $DES/usr/man/man4/$x
437: endif
438: end
439:
440: cd $MAN/man5
441: echo > $DES/usr.man5.list
442: foreach x ( ftpusers.5 hosts.5 hosts.eq.5 keeprlogin.5 \
443: networks.5 protocols.5 services.5 )
444: echo -n " $x "
445: echo $x >> $DES/usr.man5.list
446: # $DES/co1 $DES $x
447: if ( -e $x ) then
448: cp $MAN/man5/$x $DES/usr/man/man5/$x
449: endif
450: end
451:
452: cd $MAN/man8
453: echo > $DES/usr.man8.list
454: foreach x ( comsat.8c dump.8 ftpd.8c gettable.8c \
455: htable.8 ifconfig.8c implog.8c implogd.8c nstat.8c \
456: rdump.8c restore.8 rexecd.8c rlogind.8c rmt.8c route.8c \
457: routed.8c rrestore.8c rshd.8c rwhod.8c sendmail.8 \
458: slconfig.8c syslog.8 telnetd.8c tftpd.8c trpt.8c )
459: echo -n " $x "
460: echo $x >> $DES/usr.man8.list
461: # $DES/co1 $DES $x
462: if ( -e $x ) then
463: cp $MAN/man8/$x $DES/usr/man/man8/$x
464: endif
465: end
466: echo " "
467:
468:
469: echo "-----------------------------------------------------"
470: echo "verify that the commands are successfully generated"
471: repeat 4 echo "commands having names displayed are not successfully generated"
472: echo "-----------------------------------------------------"
473: cd $DES
474: #
475: # sort the lists first
476: foreach x ( *.list )
477: sort $x > $$
478: mv $$ $x
479: end
480:
481: echo > MISSING
482: echo "------ verifying $DES/usr/ucb:" |& tee -a MISSING
483: /bin/ls -1 usr/ucb | diff - usr.ucb.list |& tee -a MISSING
484:
485: echo "------ verifying $DES/usr/spool/mqueue:" |& tee -a MISSING
486: /bin/ls -1 usr/spool/mqueue | diff - $DES/usr.spool.list |& tee -a MISSING
487:
488: echo "------ verifying $DES/usr/src/usr.lib/sendmail/cf:" |& tee -a MISSING
489: /bin/ls -1 usr/src/usr.lib/sendmail/cf | diff - $DES/sendmail.cf.list |& tee -a MISSING
490:
491: echo "------ verifying $DES/usr/src/usr.lib/sendmail/doc:" |& tee -a MISSING
492: /bin/ls -1 usr/src/usr.lib/sendmail/doc | diff - $DES/sendmail.doc.list |& tee -a MISSING
493:
494: echo "------ verifying $DES/usr/src/usr.lib/sendmail/md:" |& tee -a MISSING
495: /bin/ls -1 usr/src/usr.lib/sendmail/md | diff - $DES/sendmail.md.list |& tee -a MISSING
496:
497: echo "------ verifying $DES/usr/src/usr.lib/sendmail/test:" |& tee -a MISSING
498: /bin/ls -1 usr/src/usr.lib/sendmail/test | diff - $DES/sendmail.test.list |& tee -a MISSING
499:
500: echo "------ verifying $DES/usr/src/etc/htable:" |& tee -a MISSING
501: /bin/ls -1 usr/src/etc/htable | diff - $DES/htable.list |& tee -a MISSING
502:
503: echo "------ verifying $DES/usr/adm:" |& tee -a MISSING
504: /bin/ls -1 usr/adm | diff - $DES/usr.adm.list |& tee -a MISSING
505:
506: echo "------ verifying $DES/usr/lib:" |& tee -a MISSING
507: /bin/ls -1 usr/lib | diff - $DES/usr.lib.list |& tee -a MISSING
508:
509: echo "------ verifying $DES/etc:" |& tee -a MISSING
510: /bin/ls -1 etc | diff - $DES/etc.list |& tee -a MISSING
511:
512: echo "------ verifying $DES/usr/man/man1:" |& tee -a MISSING
513: /bin/ls -1 usr/man/man1 | diff - usr.man1.list |& tee -a MISSING
514:
515: echo "------ verifying $DES/usr/man/man2:" |& tee -a MISSING
516: /bin/ls -1 usr/man/man2 | diff - usr.man2.list |& tee -a MISSING
517:
518: echo "------ verifying $DES/usr/man/man4:" |& tee -a MISSING
519: /bin/ls -1 usr/man/man4 | diff - usr.man4.list |& tee -a MISSING
520:
521: echo "------ verifying $DES/usr/man/man5:" |& tee -a MISSING
522: /bin/ls -1 usr/man/man5 | diff - usr.man5.list |& tee -a MISSING
523:
524: echo "------ verifying $DES/usr/man/man8:" |& tee -a MISSING
525: /bin/ls -1 usr/man/man8 | diff - usr.man8.list |& tee -a MISSING
526:
527: #clean up time
528: rm -f $DES/co1 $DES/co2 $DES/*.list
529:
530: echo > SETUP
531: ed - SETUP << SETUPEND
532: a
533: set me = \`whoami\`
534: if ( \$me != "root" ) then
535: echo "SETUP: must be a superuser to run this script"
536: exit
537: endif
538:
539: cd /usr/ucb
540: /etc/chown root rcp rlogin rsh
541: chmod 4755 rcp rlogin rsh
542:
543: rm -f /usr/ucb/newaliases /usr/ucb/mailq
544: ln -s /usr/lib/sendmail /usr/ucb/newaliases
545: ln -s /usr/lib/sendmail /usr/ucb/mailq
546:
547: .
548: w
549: q
550: SETUPEND
551:
552: echo "--------------------------------------------------------"
553: echo Script started at $starttime and ends at `date`
554: echo
555: echo RCS release levels of checked out sources are in 'CKOUT.LIST'
556: echo Inspect 'MISSING' for commands and documentations possibly not generated
557: echo
558: echo To make the release tape, tar the following file and directories
559: echo
560: echo SETUP usr etc
561: echo
562: echo "--------------------------------------------------------"
563:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.