File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / MAKE / cc_usr.net
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, HEAD
Power 6/32 Unix version 1.2b

#!/bin/csh -f -x
#
###############################################################################
#
# Script to generate communication commands and  documentations (cht).
#
# Sypnosis:
#
#	mkcmd REL=rel (SRC=srcdir) (DES=desdir) (MAN=mandir)
#
# where rel:	release level (no default value).
#	srcdir:	directory of source codes (default is /usr/src).
#	desdir: directory of result files.
#	mandir: directory of man pages (default is /usr/man).
#
#
# In the destdir, the following directories and files will be created:
#	
#	usr	all communication commands and documentations to be
#		under /usr
#
#	etc	all the daemons and configuration files to be
#		under /etc
#
#	SETUP	a shell script to be run after installing the commands
#		and daemons. SETUP merely changes the ownership and 
#		turns on the set owner bit for certain commands.
#
# Note, all configuration files are suffixed with the 'rel' value of
# REL argument.
#
###############################################################################

set starttime = `date`
set BASEDIR = `pwd`

# get arguments
set REL = ""
set RELSRC = (source file area)
set SRC = "${RELSRC}/SRC/usr/src"
set MAN = "${RELSRC}/SRC/man"
set DES = "${RELSRC}/netbin"
foreach x ( $* )

	set ARGNAME = ` echo $x | sed -e "s/\(...\).*/\1/"`
	set ARGVAL = ` echo $x | sed -e "s/....\(.*\)/\1/"`

	switch ($ARGNAME)
	case REL:
		set REL = $ARGVAL
		breaksw
	case SRC:
		set SRC = $ARGVAL
		breaksw

	case MAN:
		set MAN = $ARGVAL
		breaksw
	case DES:
		set DES = $ARGVAL
		breaksw
	default:
		echo "mkcmd: bad argument name '$ARGNAME'"
		exit
	endsw
end
if ( ( $REL == "" ) ) then
	echo "Usage: mkcmd REL=rel PAR=makeparam (SRC=srcdir) (MAN=docdir) (DES=desdir)"
	exit
endif

echo $MAKEPARAM
if (!( -e $DES )) then
	mkdir $DES
endif

# we use \/ so that csh does not treat "/" as a division operator
set root = "\/"
foreach x ( $SRC $MAN )
	set prefix = ` echo $x | sed -e "s/\(.\).*/\1/" `
	set prefix = "\"$prefix
	if  ( $prefix != $root ) then
		echo "mkcmd: absolute pathname must be given for SRC or MAN"
		exit
	endif
end
set prefix = ` echo $DES | sed -e "s/\(.\).*/\1/" `
set prefix = "\"$prefix
if  ( $prefix != $root ) then
	set DES = `pwd`/$DES
endif
set INCLDIR = `echo $MAKEPARAM | sed -e "s/.*INCLDIR=\([^ ]*\).*/\1/"`
set CC=`echo $MAKEPARAM | sed -e "s/.*CC=\([^ ]*\).*/\1/"`
set LCC=/bin/cc

echo "--------------------------------------------------"
echo "Making commands, daemons, and libraries from $SRC."
echo "Always starting from SCRATCH ( I am paranoid\!)"
echo "--------------------------------------------------"
echo will we generate libraries\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?\?
echo -------------------------------------------------------------

echo
echo "Remove: $DES"
if ( -e $DES ) then
	rm -rf $DES
endif
mkdir $DES
echo > $DES/CKOUT.LIST
cd $DES
foreach x ( usr etc atp usr/spool usr/ucb usr/lib usr/adm usr/src usr/man \
	    usr/man/man1 usr/man/man2 usr/man/man4 usr/man/man5 usr/man/man8 \
	    usr/spool/mqueue usr/src/etc usr/src/usr.lib usr/src/etc/htable \
	    usr/src/usr.lib/sendmail usr/src/usr.lib/sendmail/cf \
	    usr/src/usr.lib/sendmail/doc usr/src/usr.lib/sendmail/md \
	    usr/src/usr.lib/sendmail/test )
	mkdir $x
end

#
# set shell scripts to checkout
# co1 to check out a single file
# co2 to check out an entire subdirectory
#
rm -f $DES/co1 $DES/co2
echo > $DES/co1
ed - $DES/co1 << ENDCO1
a
#\!/bin/csh -f
echo --- \`pwd\`/\$2 : |& tee -a \$1/CKOUT.LIST
if ( -w \$2 ) then
	echo \$2 is writeable and is NOT checked out. | tee -a \$1/CKOUT.LIST
else
	co \$2 |& tee -a  \$1/CKOUT.LIST
endif
.
w
q
ENDCO1

echo > $DES/co2
ed - $DES/co2 << ENDCO2
a
#\!/bin/csh -f
echo --- \`pwd\` : |& tee -a \$1/CKOUT.LIST
foreach y (RCS/*)
	set z = \`basename \$y ,v\`
	set z = \`echo \$z | sed -e "s/RCS/./"\`
	if ( -w \$z ) then
		echo \$z is writeable and is NOT checked out. | tee -a \$1/CKOUT.LIST
	else
		co \$y  |& tee -a  \$1/CKOUT.LIST
	endif
end
.
w
q
ENDCO2
chmod 777 $DES/co1 $DES/co2

echo
echo "-------------------------------------------------------"
echo "Making commands from $SRC/ucb."
echo "Result binaries are in $DES/usr/ucb."
echo "Commands :"
# we collect names of commands to be generated into lists, then
# verify if these commands are really generated.
echo > $DES/usr.ucb.list
cd $SRC/ucb
foreach x (rcp rlogin rsh ruptime rwho telnet)
	echo -n " `/bin/pwd`/$x "
	echo $x >> $DES/usr.ucb.list
#	$DES/co1 $DES $x.c
	switch ( $x )
	case ruptime:
	case rwho:
		$CC -O -I{$INCLDIR} -o $DES/usr/ucb/$x {$x}.c
		breaksw
	default:
		$CC -O -I{$INCLDIR} -o $DES/usr/ucb/$x {$x}.c
		breaksw
	endsw
end

foreach x (ftp netstat talk tftp)
	echo -n " `/bin/pwd`/$x "
	echo $x >> $DES/usr.ucb.list
	cd $SRC/ucb/$x
#	$DES/co2 $DES
	make clean
	make -f Makefile $MAKEPARAM
	mv $x $DES/usr/ucb/$x
	if ( $x == "talk") then
		make -f Makefile talkd $MAKEPARAM
		mv talkd $DES/etc/talkd
	endif
#	make clean
end
echo " "


echo
echo "-------------------------------------------------------"
echo "Making daemons or administration commands from $SRC/etc."
echo "Result binaries are in $DES/etc"
echo "Daemons and Commands: "
cd $SRC/etc
echo talkd > $DES/etc.list
foreach x ( comsat gettable ifconfig rexecd rlogind route rshd slconfig \
	   tftpd telnetd trpt rmt )
	echo -n "`/bin/pwd`/$x "
	echo $x >> $DES/etc.list
#	$DES/co1 $DES $x.c
	$CC -o $DES/etc/$x -O -I{$INCLDIR} {$x}.c
end

foreach x ( dump ftpd htable implog nstat restore routed rwhod )
	echo -n " `/bin/pwd`/$x "
	echo $x >> $DES/etc.list
	cd $SRC/etc/$x
#	$DES/co2 $DES
	make clean
# 	some extra cleanup or preparation
	switch ($x)
	case htable:
		rm -f scan.c parse.c
		breaksw
	case routed:
		cd tools
#		$DES/co2 $DES
		make clean
		make -f Makefile $MAKEPARAM
#		make clean
		cd ..
		breaksw
	case ftpd:
		rm -f vers.c
		breaksw
	endsw

	make -f Makefile ${MAKEPARAM}
	switch ($x)
	case dump:
	case restore:
		mv $x $DES/etc/$x
		mv r$x $DES/etc/r$x
		echo r$x >> $DES/etc.list
		breaksw
	default:
		mv $x $DES/etc/$x
		breaksw
	endsw

#	make clean
end
echo " "

# copy database files
cd $SRC/etc/htable
echo > $DES/htable.list
foreach x ( hosts.txt localhosts localnetworks )
	if ( -e $x ) then
		cp $x	$DES/usr/src/etc/htable
	endif
	echo $x >> $DES/htable.list
end

cd $SRC/etc
foreach x ( protocols services )
	if ( -e $SRC/etc/$x ) then
		cp $x	$DES/etc/$x.{$REL}
	endif
	echo $x.{$REL} >> $DES/etc.list
end

# copy atp scripts
cd $RELSRC/SRC/d/network.atp
echo > $DES/network.atp.list
foreach x ( ether ether_burn )
	if ( -e $x) then
		cp $x $DES/atp
	endif
	echo $x >> $DES/network.atp.list
end

echo "------------------------------------------------------------"
echo "Making sendmail"
cd $SRC/usr.lib/sendmail
#$DES/co2 $DES
make clean
foreach x ( * )
	if ( ( -d $x ) &&  ( $x != "RCS" )) then 
		cd $x
#		$DES/co2 $DES
		switch ($x)
		case src:
			make clean
			rm -f Makefile
			breaksw
		case aux:
			rm -f Makefile
			breaksw
		case cf:
			make clean
			breaksw
			make $MAKEPARAM
		endsw
		
		cd ..
	endif
end

make install DESTDIR=$DES
make clean

# rename so that we don't overwrite existing configuration files
cd $DES/usr/lib
mv sendmail.hf sendmail.hf.{$REL}
mv sendmail.st sendmail.st.{$REL}
mv sendmail.fc sendmail.fc.{$REL}
mv sendmail.cf sendmail.cf.{$REL}

cd $DES/etc
mv syslog.conf syslog.conf.{$REL}
mv syslog.pid syslog.pid.{$REL}

# copy configuration files, docs, ... over for release
cd $SRC/usr.lib/sendmail/cf
echo > $DES/sendmail.cf.list
foreach x ( KEY Makefile Power6.cf Power6.mc amber.mc arpa.mc arpaproto.mc \
	    base.m4 berkhosts.m4 berkm.m4 brahms.mc cad.mc calder.mc ccbase.m4 \
	    cchosts.m4 compat.m4 coral.mc cory.mc csbase.m4 csether.mc dali.mc \
	    dbvax.mc ernie.mc ether.m4 etherm.m4 fncpm.m4 fudge.m4 ibmm.m4 \
	    ic.mc icw.mc ingres.mc ivory.mc jade.mc kim.mc lapis.mc localm.m4 \
	    matisse.mc medea.mc miro.mc mmdfm.m4 monet.mc ncphosts.m4 ncpm.m4 \
	    oz.mc ruby.mc statvax.mc suucpm.m4 tcphosts.m4 tcpm.m4 topaz.mc \
	    turner.mc ucbvax.mc uucpm.m4 uucpproto.mc version.m4 \
	    zerobase.m4 )
	if ( -e $x ) then
		cp $x $DES/usr/src/usr.lib/sendmail/cf
	endif
	echo $x >> $DES/sendmail.cf.list
end

cd $SRC/usr.lib/sendmail/doc
echo > $DES/sendmail.doc.list
foreach x ( Makefile abstract diagram intro.me mailaddr.7 op.me \
	    refs rfc819.lpr rfc821.lpr rfc822.lpr sendmail.8 spell.good \
	    syslog.3 syslog.8 usenix.me )
	if ( -e $x ) then
		cp $x $DES/usr/src/usr.lib/sendmail/doc
	endif
	echo $x >> $DES/sendmail.doc.list
end

cd $SRC/usr.lib/sendmail/md
echo > sendmail.md.list
foreach x ( c.nvmunix.m4 c.vmunix.m4 config.m4 )
	if ( -e $x ) then
		cp $x $DES/usr/src/usr.lib/sendmail/md
	endif
	echo $x >> $DES/sendmail.md.list
end

cd $SRC/usr.lib/sendmail/test
echo > sendmail.test.list
foreach x ( fail1 fail2 tempfail )
	if ( -e $x ) then
		cp $x $DES/usr/src/usr.lib/sendmail/test
	endif
	echo $x >> $DES/sendmail.test.list
end

# create lists of files needed
cd $DES

echo syslog >> $DES/etc.list
echo syslog.conf.{$REL} >> $DES/etc.list
echo syslog.pid.{$REL} >> $DES/etc.list

echo syslog > $DES/usr.spool.list
foreach x (0 1 2 3 4 5 6 7)
	echo syslog.$x >> $DES/usr.spool.list
end


echo newsyslog > $DES/usr.adm.list

echo sendmail > $DES/usr.lib.list
echo sendmail.hf.{$REL} >> $DES/usr.lib.list
echo sendmail.st.{$REL} >> $DES/usr.lib.list
echo sendmail.fc.{$REL} >> $DES/usr.lib.list
echo sendmail.cf.{$REL} >> $DES/usr.lib.list

echo newaliases >> $DES/usr.ucb.list
echo mailq >> $DES/usr.ucb.list


echo -------------------------------------------------------------
echo copying man pages
cd $MAN/man1
echo > $DES/usr.man1.list
foreach x (rcp.1c rlogin.1c rsh.1c ruptime.1c rwho.1c telnet.1c \
	   ftp.1c netstat.1 talk.1 tftp.1c )
	echo -n " $x "
	echo $x >> $DES/usr.man1.list
#	$DES/co1 $DES $x
	if ( -e $x ) then
		cp $MAN/man1/$x $DES/usr/man/man1/$x
	endif
end

cd $MAN/man2
echo > $DES/usr.man2.list
foreach x ( accept.2 bind.2 connect.2 gethostid.2 gethostname.2 \
	    getpeername.2 getsockname.2 getsockopt.2 listen.2 \
	    recv.2 recvfrom.2 recvmsg.2 send.2 sendmsg.2 sendto.2 \
	    sethostid.2 sethostname.2 setsockopt.2 shutdown.2 \
	    socket.2 socketpair.2 )
	echo -n " $x "
	echo $x >> $DES/usr.man2.list
#	$DES/co1 $DES $x
	if ( -e $x ) then
		cp $MAN/man2/$x $DES/usr/man/man2/$x
	endif
end
	
cd $MAN/man4
echo > $DES/usr.man4.list
foreach x ( arp.4p imp.4 imp.4p inet.4f intro.4n ip.4p lo.4 \
	    pty.4 pup.4f pup.4p tcp.4p udp.4p )
	echo -n " $x "
	echo $x >> $DES/usr.man4.list
#	$DES/co1 $DES $x
	if ( -e $x ) then
		cp $MAN/man4/$x $DES/usr/man/man4/$x
	endif
end

cd $MAN/man5
echo > $DES/usr.man5.list
foreach x ( ftpusers.5 hosts.5 hosts.eq.5 keeprlogin.5 \
	    networks.5 protocols.5 services.5 )
	echo -n " $x "
	echo $x >> $DES/usr.man5.list
#	$DES/co1 $DES $x
	if ( -e $x ) then
		cp $MAN/man5/$x $DES/usr/man/man5/$x
	endif
end

cd $MAN/man8
echo > $DES/usr.man8.list
foreach x ( comsat.8c dump.8 ftpd.8c gettable.8c \
	    htable.8 ifconfig.8c implog.8c implogd.8c nstat.8c \
	    rdump.8c restore.8 rexecd.8c rlogind.8c rmt.8c route.8c \
	    routed.8c rrestore.8c rshd.8c rwhod.8c sendmail.8 \
	    slconfig.8c syslog.8 telnetd.8c tftpd.8c trpt.8c )
	echo -n " $x "
	echo $x >> $DES/usr.man8.list
#	$DES/co1 $DES $x
	if ( -e $x ) then
		cp $MAN/man8/$x $DES/usr/man/man8/$x
	endif
end
echo " "


echo "-----------------------------------------------------"
echo "verify that the commands are successfully generated"
repeat 4 echo "commands having names displayed are not successfully generated"
echo "-----------------------------------------------------"
cd $DES
#
# sort the lists first
foreach x ( *.list )
	sort $x > $$
	mv $$ $x
end

echo > MISSING
echo "------ verifying $DES/usr/ucb:" |& tee -a MISSING
/bin/ls -1 usr/ucb | diff - usr.ucb.list |& tee -a MISSING

echo "------ verifying $DES/usr/spool/mqueue:" |& tee -a MISSING
/bin/ls -1 usr/spool/mqueue | diff - $DES/usr.spool.list |& tee -a MISSING

echo "------ verifying $DES/usr/src/usr.lib/sendmail/cf:" |& tee -a MISSING
/bin/ls -1 usr/src/usr.lib/sendmail/cf | diff - $DES/sendmail.cf.list |& tee -a MISSING

echo "------ verifying $DES/usr/src/usr.lib/sendmail/doc:" |& tee -a MISSING
/bin/ls -1 usr/src/usr.lib/sendmail/doc | diff - $DES/sendmail.doc.list |& tee -a MISSING

echo "------ verifying $DES/usr/src/usr.lib/sendmail/md:" |& tee -a MISSING
/bin/ls -1 usr/src/usr.lib/sendmail/md | diff - $DES/sendmail.md.list |& tee -a MISSING

echo "------ verifying $DES/usr/src/usr.lib/sendmail/test:" |& tee -a MISSING
/bin/ls -1 usr/src/usr.lib/sendmail/test | diff - $DES/sendmail.test.list |& tee -a MISSING

echo "------ verifying $DES/usr/src/etc/htable:" |& tee -a MISSING
/bin/ls -1 usr/src/etc/htable | diff - $DES/htable.list |& tee -a MISSING

echo "------ verifying $DES/usr/adm:" |& tee -a MISSING
/bin/ls -1 usr/adm | diff - $DES/usr.adm.list |& tee -a MISSING

echo "------ verifying $DES/usr/lib:" |& tee -a MISSING
/bin/ls -1 usr/lib | diff - $DES/usr.lib.list |& tee -a MISSING

echo "------ verifying $DES/etc:" |& tee -a MISSING
/bin/ls -1 etc | diff - $DES/etc.list |& tee -a MISSING

echo "------ verifying $DES/usr/man/man1:" |& tee -a MISSING
/bin/ls -1 usr/man/man1 | diff - usr.man1.list |& tee -a MISSING

echo "------ verifying $DES/usr/man/man2:" |& tee -a MISSING
/bin/ls -1 usr/man/man2 | diff - usr.man2.list |& tee -a MISSING

echo "------ verifying $DES/usr/man/man4:" |& tee -a MISSING
/bin/ls -1 usr/man/man4 | diff - usr.man4.list |& tee -a MISSING

echo "------ verifying $DES/usr/man/man5:" |& tee -a MISSING
/bin/ls -1 usr/man/man5 | diff - usr.man5.list |& tee -a MISSING

echo "------ verifying $DES/usr/man/man8:" |& tee -a MISSING
/bin/ls -1 usr/man/man8 | diff - usr.man8.list |& tee -a MISSING

#clean up time
rm -f $DES/co1 $DES/co2  $DES/*.list

echo > SETUP
ed - SETUP << SETUPEND
a
set me = \`whoami\`
if ( \$me != "root" ) then
	echo "SETUP: must be a superuser to run this script"
	exit
endif

cd /usr/ucb
/etc/chown root rcp rlogin rsh
chmod 4755 rcp rlogin rsh

rm -f /usr/ucb/newaliases /usr/ucb/mailq
ln -s /usr/lib/sendmail /usr/ucb/newaliases
ln -s /usr/lib/sendmail /usr/ucb/mailq

.
w
q
SETUPEND

echo "--------------------------------------------------------"
echo Script started at $starttime and ends at `date`
echo 
echo RCS release levels of checked out sources are in 'CKOUT.LIST'
echo Inspect 'MISSING' for commands and documentations possibly not generated
echo
echo To make the release tape, tar the following file and directories
echo 
echo      SETUP usr etc
echo
echo "--------------------------------------------------------"


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.