[comp.protocols.appletalk] How to install CAP/UAB

dank@nntp-server.caltech.edu (Daniel R. Kegel) (04/13/91)

I recently installed CAP on my Sun (a 4/470 running SunOS 4.1.1 Rev B)
for the file serving software.  It was not difficult, but I had to
read between the lines to figure out exactly what steps to follow.
Also, the default installation scatters files across several filesystems,
and I wanted to concentrate all the files in one place in /usr.  I have
run through this procedure, and it seems to work; an EtherTalk-equipped
Mac IIx running System 6.0.5 can mount SunOS volumes nicely.
The procedure I used is documented below.
(CAP can be downloaded via FTP from munnari.OZ.AU in mac/cap60.tar.Z if you 
can't find it anywhere in the US.)

To deinstall CAP, just rm -rf /usr/local/cap /etc/cap /etc/cap.rc
and delete the line in /etc/rc.local that invokes cap.rc.

- Dan Kegel (dank@blacks.jpl.nasa.gov, dank@chairie.caltech.edu)

Procedure to install CAP/UAB into /usr/local/cap on a Sun4 running SunOS 4.1.1
such that ALL read-only files live in /usr/local/cap, and all read-write files
live in /etc/cap.  This makes for easy deinstallation and copying to new 
systems.
In the following, #% indicates the shell prompt for super-user, 
% indicates the shell prompt for user cap, and ~ indicates /usr/local/cap.

0) Become superuser, create area for cap to save data in, and add user 
   'cap' to /etc/passwd with home directory /usr/local/cap.  The intention
   is for /usr/local to be mounted read-only after installation.
   $ su
   #% /usr/etc/install/add_user cap 9999 10 "Columbia Appletalk Package" \
     /usr/local/cap /bin/csh

1) Become user cap, and Create subdirectories in ~cap:
   #% su cap
   #% mkdir /etc/cap
   #% chown cap /etc/cap			# for convenience later in setup
   % cd ~
   % mkdir bin include lib
   % ln -s /etc/cap etc

2) Grab and unpack tarfile:
   % cd ~
   % ftp munnari.oz.au
   > binary
   > get mac/cap60.tar.Z
   > quit
   % zcat cap60.tar.Z | tar xvf -		# creates subdirectory cap60.

3) CAP's Makefiles aren't smart enough to deal with include files or libraries
   in nonstandard places yet, so build a wrapper around the C compiler like so:
   Create cc in ~cap/bin, and add ~cap/bin to the path:
    % cat > ~/bin/cc
    #!/bin/csh -f
    /usr/ucb/cc -I/usr/local/cap/include -L/usr/local/cap/lib $*
    ^D
    % chmod +x ~/bin/cc
    % set path = (~/bin $path)

4) Let cap autoconfigure itself.  Answer 'yes' to the question about
   using UAB, and about slowing down output for Kinetics boxes, but
   otherwise just use the default answers:
    % cd ~/cap60
    % ./Configure

5) Edit m4.setup to restict all CAP files to live in /usr/local/cap.
    % cd ~/cap60
    % vi m4.setup

	line	old			new
	90	/usr/include		/usr/local/cap/include
	94	/etc			/usr/local/cap/etc
	97,99	/usr/local/cap		/usr/local/cap/bin
	101	/usr/local/lib/cap	/usr/local/cap/lib
	103	/usr/local/lib		/usr/local/cap/lib
	158	/etc/cap.auth		/usr/local/cap/etc/cap.auth

6) Create all the makefiles according to the new configuration files:
    % cd ~/cap60
    % ./gen.makes

7a) Patch ~/cap60/support/uab/makefile to keep its database in 
   /usr/local/cap/etc instead of /etc by changing the line
	CFLAGS=-DDEBUG  -O
   to read
	CFLAGS=-DDEBUG  -O -DMTAB=\"/usr/local/cap/etc/etalk.local\"
   near the top.

7b) Patch ~/cap60/lib/cap/makefile to keep its database in 
   /usr/local/cap/etc instead of /etc by changing the line
	CFLAGS= -O
   to read
	CFLAGS= -O -DETAB=\"/usr/local/cap/etc/etalk.local\"
   near the top.

8) Patch cap60/man/makefile to install man pages for SunOS by adding following
   lines after the rule for 'all:'.  Be careful to start each line after
   'install' with a tab, and not with spaces, or Make will choke.
   % cd ~/cap60/man
   % vi makefile			# and add following lines:

 # Added 4/91 by Dan Kegel (dank@blacks.jpl.nasa.gov)
 # to install man pages into a private area suitable for
 # use with man, catman, and apropos via the MANPATH environment variable.
 DESTDIR = /usr/local/cap/man
 install:
 	mkdir $(DESTDIR)
 	mkdir $(DESTDIR)/man1 $(DESTDIR)/man3 $(DESTDIR)/man5 $(DESTDIR)/man8 
 	mkdir $(DESTDIR)/cat1 $(DESTDIR)/cat3 $(DESTDIR)/cat5 $(DESTDIR)/cat8
 	cp *.1 $(DESTDIR)/man1
 	cp *.3 $(DESTDIR)/man3
 	cp *.5 $(DESTDIR)/man5
 	cp *.8 $(DESTDIR)/man8
 	ln -s papif.8 $(DESTDIR)/man8/papof.8
 	ln -s atprint.1 $(DESTDIR)/man1/tlw.1
 	ln -s atprint.1 $(DESTDIR)/man1/lwpr.1
 	cp    atprint.1 $(DESTDIR)/man8/isrv.8
 	ln -s atprint.1 $(DESTDIR)/man1/iwpr.1
 	ln -s CAP.3 $(DESTDIR)/man3/libcap.3
 	ln -s CAP.3 $(DESTDIR)/man3/libafpc.3
 	ln -s CAP.3 $(DESTDIR)/man3/libafp.3
 	ln -s cvt2apple.1 $(DESTDIR)/man1/cvt2cap.1
 	ln -s atlook.1 $(DESTDIR)/man1/atpinger.1
 	ln -s atlook.1 $(DESTDIR)/man1/atlooklws.1
 	/usr/etc/catman -M $(DESTDIR)
 	# Now add $(DESTDIR) to your MANPATH environment variable.
# Caution: above lines start with TAB, not blanks

8) Install cap's man pages (ignore errors from opendir):
    % cd ~/cap60/man
    % make install

9) Install cap's include files:
    % cd ~
    % mkdir include/netat
    % cp cap60/netat/*.h include/netat

10) Compile the programs and install them in ~/bin:
    % cd ~/cap60
    % make install

11) Create script that lets users access CAP if needed:
    % cat > ~/bin/setup_env
    # C-shell users add the line 'source /usr/local/cap/bin/setup_env'
    # to their .cshrc to use CAP programs, manpages, or libraries directly.
    set path = (/usr/local/cap/bin $path)
    setenv MANPATH '${MANPATH}':/usr/local/cap/man
    ^D

12) Create ~/lib/bridge_desc.  For example, if your hostname is blacks,
    the following two lines would connect to whatever's out there on Ethernet, 
    and ignore asynchronous Appletalk:
    % cat > ~/lib/bridge_desc
    blacks  [elap,ie:0]     mkip    [0]
    blacks  [async,as:0]    none    [127.127,fakeZone]
    ^D

13) Create read-write and read-only folders available to all Mac users.
   % mkdir ~/macpub ~/macpub/.finderinfo ~/macpub/.resource
   % chmod -R 755 ~/macpub
   % mkdir /usr/tmp/mactmp /usr/tmp/mactmp/.finderinfo /usr/tmp/mactmp/.resource
   % chmod -R 777 /usr/tmp/mactmp

14) Create a file describing the public folders.  Replace 'blacks' with 
    your hostname:
    % cat > ~/lib/afpvols
	/usr/local/cap/macpub:blacks_public
	/usr/tmp/mactmp:blacks_temporary
	^D

15) Create a shell script to start CAP, and invoke it in /etc/rc.local:

    % su
    #% cat > /etc/cap.rc
	#!/bin/sh
	### sample start servers file; start from '/etc/rc.local'
	LOGd=/usr/tmp
	LOGf=/dev/null
	CAP=/usr/local/cap/bin
	LIB=/usr/local/cap/lib
	LWARGS="-a ${LIB}/procsets -f ${LIB}/LW+Fonts"
	#
	# Start UAB first.
	# Assumes you've created /usr/local/cap/lib/bridge_desc.
	${CAP}/uab -f ${LIB}/bridge_desc
	sleep 10
	#
	# allow atis to startup before other CAP programs
	${CAP}/atis
	sleep 5
	#
	# Start up snitch, fileserver, and print server.
	# Assumes there's a printer called lw.`hostname` in /etc/printcap,
	# and that you've created /usr/local/cap/lib/afpvols.
	${CAP}/snitch -S -f "SUN 4 SunOS 4.1.1 UNIX" -l lwsrv
	${CAP}/aufs -U 20 -V ${LIB}/afpvols -l ${LOGf} -n `hostname`
	${CAP}/lwsrv -n "Laserwriter on "`hostname` -p lw.`hostname` ${LWARGS}
	^D
    #% chmod +x /etc/cap.rc
    #% vi /etc/rc.local		# Add the following lines at the bottom:
	#
	# Start up Appletalk fileserver & print server.
	#
	if [ -f /etc/cap.rc ]; then
	    /etc/cap.rc; echo "Appletalk fileserver"
	fi
    ^D
    
16) Test the installation by seeing if your fileserver is visible, and by
    logging in to it with ash (replace blacks with your hostname):
    % atlook
    % ash "blacks:AFPServer@*"

djh@cs.mu.oz.au (David Hornsby) (04/13/91)

Daniel R. Kegel writes:
> I recently installed CAP on my Sun (a 4/470 running SunOS 4.1.1 Rev B) ...
> Also, the default installation scatters files across several filesystems,
> and I wanted to concentrate all the files in one place in /usr.

This aim can be achieved quite simply by editing m4.setup (after running
Configure, before gen.makes) and uncommenting the following line:

#define([debug],1) # testing things (without disrupting)

If you run gen.makes and follow the remainder of the normal procedure,
the include files are taken from the 'netat' directory (rather than
/usr/include/netat), programs are compiled in situ and then installed
into subdirectory 'bin' (which you have to make). The atalk.local file
is read from the 'etc' subdirectory. Nothing outside the top directory
gets touched ...

 - David.

dank@nntp-server.caltech.edu (Daniel R. Kegel) (04/17/91)

I wrote:
> ... I wanted to concentrate all the files in one place in /usr.

djh@cs.mu.oz.au (David Hornsby) replied:
>This aim can be achieved quite simply by editing m4.setup (after running
>Configure, before gen.makes) and uncommenting the following line:
>
>#define([debug],1) # testing things (without disrupting)
>
>[If you run gen.makes and follow the remainder of the normal procedure,
>cap is installed into ./etc and ./bin, and nothing outside is touched ...]
> - David.

That's not quite true, I think.  Uab might still write to /etc, even with debug
defined in m4.setup, so at least some of my by-hand patches need to be applied.
- Dan Kegel