Be Selective

In these examples we'll look at (just) selecting machines. This is easy stuff, but this'll give you a chance to see it really work without having to worry about all the other things going on.

A Sample Configuration File

Here's a distrib.cf file we can use to try machine selection:

#We never used SHORTHOST and need to know where the NFS server(s) are
%HOST                           HOSTTYPE        HOSTOS  HASSRC  NFSSERVER
# The computers in the Ichthyology Department at East Podunk University
cod.ich.epodunk.edu             SOLARIS         509     .       .
flounder.ich.epodunk.edu        AIX             500     YES     .
goby.ich.epodunk.edu            NEXT            303     YES     .
grouper.ich.epodunk.edu         NEXT            401     .       .
mackerel.ich.epodunk.edu        SOLARIS         509     .       .
lamprey.ich.epodunk.edu         AIX             302     YES     .
marlin.ich.epodunk.edu          SOLARIS         509     .       .
perch.ich.epodunk.edu           LINUX           20575   .       .
roughy.ich.epodunk.edu          LINUX           20575   .       .
whaleshark.ich.epodunk.edu      SOLARIS         509     YES     YES
trout.ich.epodunk.edu           LINUX           20575   .       .

If you've got a recent version of distrib installed, you can save that in a directory as "distrib.cf", change "whaleshark.ich.epodunk.edu" to the hostname of the machine you're on, and try these examples (I'm still going to call it whaleshark because I don't know the name of your machine). Otherwise, you'll just have to use your imagination.

The Default Set

If we run distrib on whaleshark, the default set of machines should be the ones with HOSTTYPE set to SOLARIS, except for whaleshark itself. We can see this if we run distrib -H:

cod.ich.epodunk.edu
mackerel.ich.epodunk.edu
marlin.ich.epodunk.edu

The -H option doesn't affect machine selection. It makes distrib use a Distfile containing just the word "HOST" (and print the processed Distfile as if -E were given too). Since that is defined by one of our macros (the first column), the item in the first column is printed for each selected machine. We can play with selection easily by using the -H option with whatever other options we like. We'll use it for the rest of this section. If distrib complains "distfile: No such file or directory", you forgot to type it.

The default set of machines is intended to be the other machines a program compiled here would run on. The default action is to rdist files to these machines, so this could easily be used for software distribution (hence the name "distrib"). Because of this, machine lines with equivalent HOSTTYPE macros should correspond to actual computers that are binary compatible. We can check HOSTOS (or other macros) as well, but it's more idiot-proof that way. The idea is to make distrib do all the heavy lifting.

If we included the -I option (distrib -HI) too, whaleshark (or your machine's HOST if you're playing along) would be included also. This is commonly used for configuration files and other system information that is processed (by distrib) as it is installed. It could be used for programs that aren't already installed where you want them as well.

Compile Machines

The default set is useful, but the whole point of having other columns is to be able to select different sets.

One common set is the list of "compile machines". These are the machines where compilation occurs. In a master source setup based on distrib we only perform compilations and processing on a minimal set of machines and then distribute the results to other machines that can use them.

That's why one of the default macros is HASSRC, which is used to denote than a machine has (and should be given more) source code to programs and can compile them. We'll explain this more when we get to master source, but for now think of it as a tree. The master source machine gives source to the compile machines (using distrib -S), which compile the program, install it, and distribute the installed program to their peers using distrib (to the default set). The compile machines may have different configuration files from each other and from the master source machine.

There should be at least one machine that HASSRC for each HOSTTYPE. You may have others because of significant differences among machines or for efficiency concerns.

In our example, you can list all the compile machines with distrib -HS:

flounder.ich.epodunk.edu
goby.ich.epodunk.edu
lamprey.ich.epodunk.edu
whaleshark.ich.epodunk.edu
You'll notice the current machine ("whaleshark") is listed as well as all the other machines that have HASSRC defined (not just a '.').
Go back to this theory section or charge ahead to the next one or its examples.