Example Prototype and Library Files

A prototype file is a template that defines the configuration of a client's local disk. Prototype files are usually function-specific (for example, a backup machine, print server, etc.) but system-independent. Prototype files support the use of ifdef statements and variables, so you can include system-specific definitions. The actual system-specific configuration file is generated when the prototype file is compiled.

The components defined in a prototype file can include the directories, files, symbolic links, block special devices, character special devices and sockets that need to reside on a client's local disk in order for it to perform a specific role, such as a print server or backup machine. Thus, we recommend that you construct a unique prototype file for each different client function.

To make the package program more effective and easy to maintain, create prototype files that are modular and generic, instead of specific, by using library files and variables:

  • By creating general-purpose library files, you can include the same library file in many prototype files. Thus, you can make global configuration changes by modifying a single library file; you do not need to modify each prototype file.

  • Variables enable you to change definitions simply by changing the variable's value.

An Example Prototype File

The following is part of an example prototype file that contains the minimum definitions necessary to run AFS. A similar file called minimal.proto can reside in your src subdirectory. As recommended, this prototype file references library files and does not include actual definitions.

            .
            .
   # Package prototype for a minimal configuration.
   # Base components
   %include ${wsadmin}/lib/base.generic
   # Machine-specific components
   %ifdef rs_aix42
   %include ${wsadmin}/lib/rs_aix42.readonly
   %include ${wsadmin}/lib/rs_aix42.AFS
   %endif rs_aix42
   %ifdef alpha_dux40
   %include ${wsadmin}/lib/alpha_dux40.readonly
   %include ${wsadmin}/lib/alpha_dux40.AFS
   %endif alpha_dux40
   %ifdef sun4x_56
   %include ${wsadmin}/lib/sun4x_56.readonly
   %include ${wsadmin}/lib/sun4x_56.AFS
   %endif sun4x_56
            .
            .

In the previous example, the first uncommented line includes the /lib/base.generic library file. This library file can contain definitions appropriate for many prototype files; the base.generic library file can also be included in other prototype files, like a staff.proto or backup.proto file. An example library file appears in the following section.

Note that system-specific definitions are permitted through the use of ifdef statements and variables (for example, ${wsadmin} is used to specify pathnames). Thus, the same prototype file can be used to configure a machine running AIX 4.2 or Solaris 2.6, even though they require different files, directories, symbolic links and devices.

In the next uncommented lines of this example, the administrator has constructed different library files for different system types. Each of these is compiled into unique configuration files. For instance, the following lines in this prototype file tell the package program to use the library files lib/rs_aix42.readonly and lib/rs_aix42.AFS for the configuration file when the value rs_aix42 has been declared. (The system-type definition is declared in the Makefile; see The Package Makefile File.)

   %ifdef rs_aix42
   %include ${wsadmin}/lib/rs_aix42.readonly
   %include ${wsadmin}/lib/rs_aix42.AFS
   %endif rs_aix42

Similarly, the following lines tell the package program to use the library files lib/sun4x_56.readonly and lib/sun4x_56.AFS when the value sun4x_56 has been declared.

   %ifdef sun4x_56
   %include ${wsadmin}/lib/sun4x_56.readonly
   %include ${wsadmin}/lib/sun4x_56.AFS
   %endif sun4x_56

Example Library File

The following is part of an example library file for basic configuration definitions. A similar file, called base.generic, can reside in your lib subdirectory. Note that configurations are defined using standard ifdef statements.

            .
            .
   #
   # Base package definitions.
   #
   %ifndef      cell
   %define      cell    example.com
   %endif       cell
   %ifndef      sys
   %include /etc/package.sys
   %endif       sys
   %define      ${name}         ${name}
   %define      ${cpu}          ${cpu}
   %define      ${sys}          ${sys}
   %define      ${dept}         ${dept}
   %define      ${hostname}     ${hostname}
   %ifdef       rs_aix42
   %    define  AIX
   %    define  rootlinks
   %ifndef      noafsd 
   %    define  afsd
   %endif       noafsd
   %endif       rs_aix42
            .
            .
   #
   # Some definitions to handle common combinations of owner, group,
   # and protection fields.
   #
   %define      rzmode          root wheel 600
   %define      usermode        root wheel 666
   %define      systemmode      root wheel 644
   %define      diskmode        root wheel 644
   %define      ptymode         root wheel 666
   %define      ttymode         root wheel 666
            .
            .
   %define aix_rootbin     root bin
   %define aix_rootprintq  root printq
   %define aix_rootstaff   root staff
   %define aix_rootsys     root system
   %define aix_binbin      bin bin
   %define aix_binmail     bin mail
   %define aix_binsys      bin system
   %define aix_addsys      adduser system
   %define aix_romode      444
   %define aix_loginmode   544
   %define aix_usermode    666
   %define aix_systemmode  644
   %define aix_textmode    644
   %define aix_rwmode1     660
   %define aix_allrugw     664

The following example library file uses package-specific syntax to define files, directories, sockets, etc. Each line, called a configuration file instruction, defines a specific component of disk configuration. The proper syntax for these instructions is briefly described in Package Configuration File Instruction Syntax; see the reference page for the package configuration file in the OpenAFS Administration Reference for detailed descriptions.

In this example, the library file contains instructions specific to the configuration of an rs_aix42 machine. You can have similar library files in your lib subdirectory.

            .
            .
   #
   # Generic configuration for an AFS rs_aix42 machine.
   #
   D    /                                       ${treemode}
   D    /afs
   FAQ  /unix          ${machine}/unix.std      ${binmode}
   LA   /unix.std       /unix
   D    /bin                                    ${treemode}
   F    /bin/as         ${machine}              ${binmode}
   F    /bin/ld         ${machine}              ${binmode}
   F    /bin/nm         ${machine}              ${binmode}
   FO   /bin/login      ${afstest}              ${suidmode}
            .
            .
   FAQ  /usr/vice/etc/ThisCell  ${common}/etc/ThisCell ${textmode}
   FQ   /usr/vice/etc/afsd      ${afstest}/root.client ${binmode}
   FA   /usr/vice/etc/bos       ${afstest}/bin/bos     ${binmode}
   FA   /usr/vice/etc/fs        ${afstest}/bin/fs      ${binmode}