Installation Notes for Amd.

NOTE: Please read all of this before starting.
      It is not very long and may save you time in the long term.

1.  ``Getting started...''

If you got this release in a shar file then run the shell script Configure in
the top directory.  If you got this release in a tar file then you are all
set (though if you feel left out you can type run Configure anyway).

2.  ``Find out what version of UN*X you are running...''

To install Amd you need a port for your version of UN*X.  In this directory
are several files called os-*.h.  One of these should correspond to your
version of UN*X.  Look at the comments at the top of each file to determine
which one applies to you.  If none of them do, then either no-one has yet
done a port, or your version of UN*X is so braindead that a port is not
possible (e.g. System V without reliable signals).  Run the program "os-type"
in the current directory to see whether you and Amd are in agreement about
your operating system type.  The current known operating systems (grouped by
architecture) are:

	acis43			ACIS 4.3BSD on an IBM RT/PC
	bsd44			4.4 BSD on a Tahoe (or Vax)
	concentrix		Concentrix on an Alliant
	hlh42			4.2 BSD on HLH Orion 1/05
	hpux			HP-UX 6.* on a HP9000/300
	riscix			4.3 BSD on an Acorn Archimedes
	sos3, sos4		SunOS 3.x and 4.* on a Sun-3 and Sun-4
	u2_2			Ultrix 2.2 (or 2.*?) on a VAX
	u3_0			Ultrix 3.0 (or 3.*?) on a VAX
	umax43			4.3 BSD on an Encore Multimax
	utx32			UTX/32 Rel2.1a on a Gould (not yet complete)
	xinu43			More/BSD (4.3 BSD) on a VAX or HP9000/300

If you do define a new operating system type foo, you may care to create a
file called Makefile.foo which defines the special Makefile parameters.

3.  ``Hacking the Makefile...''

Some UN*X programs come with a Makefile which has to be manually configured
for your particular operating system and hardware.  However, Amd tries very
hard to determine what type of machine you are using and how best to compile
itself.  If this does not work then you will have to find some heuristic
which can differentiate your configuration.  You may need to edit "arch" and
"os-type".  If you do make sure your changes can cope if /etc/motd is missing
and please send it to the address below.

You may care to tailor some site specific preferences in "Makefile.com".  The
variables most likely to be changes are at the top.  Any changes are best put
in the file Makefile.local (if they are applicable to all operating systems
at your site) or Makefile.local.foo (where foo is the OS type as determined
in part 1).

Additionally, some configuration options may be altered in "Makefile.config".
This means that you should not need to edit any distributed files apart from
"Makefile.config".  As a minimum, you should check:

* You are using the correct C compiler.  Amd, as shipped, does not use GCC.
  Note that using GCC version 1.34 or later (e.g. 1.36) gives structure
  passing problems with some parts of Sun's RPC library at least on Sun-4's.
  The current workaround is to use the system CC to compile the part of the
  automounter that gets hit by this problem.  [[This is not the same problem
  that is fixed by -fpcc-struct-return.]]  Amd contains no "register"
  declarations, so using old PCC based code generators is probably bad news.

* The installation directory (ETC) is set up correctly.

* If you are running tests then it may be worth switching on the DEBUG flag
  which will cause a running commentary to be printed to the log file.

4.  ``Build the executable...''

Now you need to compile the automounter.  To do this you type:

	make

If you are porting to a new machine you may want to do:

	make OS=foo

where foo is the name of your version of UN*X as determined in part 1, until
you have made the changes to os-type and/or arch.  When the compilation is
complete you will end up with a program called "arch.foo/Amd".

Try running:

	arch.foo/Amd -v

and check the output.  It should look something like:

  amd 5.1.1.6 of 90/01/10 17:30:40 Rel5.1c #0: Wed Jan 10 17:38:34 GMT 1990
  Built by jsp@elsinore.doc.ic.ac.uk for an ibm032 running acis43 (big-endian)
  Map support for: root, hesiod, error.

Make sure the O/S and architecture types were correctly derived during the
build.

NOTE: If you are building for Ultrix 2.2 then you *may* need to use the
system V make (s5make) or GNU make instead of /bin/make.  To do that run:

	make MAKE=s5make
or
	make MAKE=gmake

5.  ``Installation...''

If you are not just testing Amd, then you can install it by typing:

	make install

to install "arch.foo/Amd" in "/usr/local/etc/Amd" (or as otherwise
modified in part 2).

6.  ``Update /etc/rpc''

Amq uses Sun RPC to talk to Amd using program number 300019 which has
been registered with Sun.  Add the following lines to /etc/rpc or your
YP or Hesiod master:

# Automount control protocol
amd	300019	amq

7.  ``Hanging your machine...''

WARNING:  THIS MAY HANG YOUR MACHINE IF YOU GET IT WRONG.

Running Amd with a carelessly thought out mount map can cause your Amd to
enter a deadlock inside the kernel.  For example, attempting to automount a
directory which is automounted can cause the automounter to issue a mount
request which will cause the kernel to send an NFS request back to the same
automounter, which is currently stuck in a system call and unable to respond
- even kill -KILL won't get you out of this one.

There is nothing you can do to fix it without rebooting your machine, so...

Find a diskless workstation and play with that first before trying this on
your main 200 user service machine (unless you hate your users).  Something
like a diskless Sun-4 is best for development testing - you can compile on a
Sun-4 server and run the binary on the diskless node.  They reboot very fast
as well between tests.

Now you can try running Amd.  Please read the documentation in doc/Amd.tex
for more details.  The configuration file "a_master" provides a sample for
you to play with.  Something like:

	./Amd -c 40 -D test,nodaemon /tmp/amnt a_master &

is good for testing.  Note that Amd will clean up correctly if you send it a
SIGINT or SIGTERM.  Other signals are either ignored or will blow it away,
leaving your machine in a potentially dangerous state - usually a reboot is
all that is required to fix it though ;-)

Remember that Amd needs to run as root in order to do mounts/unmounts though
it does check this condition somewhere near line one of main().  It will also
need write permission in the working directory if you have built it with
DEBUG defined.  Watch out for NFS stepping in and mapping root to nobody.

8.  ``Report what happened...''

If anything interesting happened, eg it didn't work, please report it to me
-- Jan-Simon Pendry <jsp@doc.ic.ac.uk> -- as detailed in the README file.

KNOWN PROBLEMS - Contact me for more details

* Amd does not work correctly on a DecStation 3100 system running Ultrix 3.1.
  This is a bug in Ultrix.  Quite how the Ultrix mount command works is a
  total mystery, but in any case the mount system call does not behave as
  documented.

* It is reported that amd deadlocks the kernel on a Sequent Symmetry.
  Obviously this is a kernel bug.

* Amd cannot do hierarchical mounts, ie mount two or more filesystems at
  once. To do this requires resolving some non-trivial issues.  If you think
  you know what the semantics should be I would like to hear from you.
  Remember to consider the general case.  The tree of mounts can be composed
  of any combination of filesystem types, and/or possibly come from several
  NFS servers any of which may be down at the time of the mount.

  Once the tree is mounted, how does it get unmounted?  Again, what happens
  if a fileserver is down, or goes down after one of the other filesystems is
  unmounted?

$Id: INSTALL,v 5.1.1.2 90/01/11 16:45:44 jsp Exp Locker: jsp $
