Provides instructions for the package command
Description
The package configuration file defines the file system elements that the package command creates or alters on the local disk of an AFS client machine it is configuring. Use the -config or -fullconfig argument to the package command to identify the configuration file to use.
Summary of Configuration File Instructions
The configuration file can include one or more instances of each of the following instructions, each on its own line. A more detailed description of each instruction's syntax follows this list.
The B and C Instructions for Defining Block and Character Special Devices
The B instruction in a package configuration file defines a block special device, such as a disk, that deals with input in units of multi-byte command blocks. The C instruction defines a character special device, such as a terminal or tty, that deals with input in single character units. They share a common syntax:
{B | C} device_name major_device minor_device owner group mode_bits
where
The D Instruction for Creating a Directory
The D instruction in a package configuration file creates a directory on the local disk. If a symbolic link, file, or other element on the local disk has the same name, it is replaced with a directory. If the directory already exists, its owner, group, and mode bits are changed if necessary to conform with the instruction. The instruction has the following syntax:
D[update_code] directory owner group mode_bits
where
The F Instruction for Creating or Updating a File
The F instruction in a package configuration file creates or updates a file on the local disk by copying in the contents of the indicated source file, which can reside in AFS or on the local disk. If the package command interpreter cannot access the source file, it exits without executing any instruction in the configuration file.
If a file with the same name already exists on disk, the package command overwrites it with the contents of the source file, unless the I update code is used to prevent that. To add a .old extension to the current version of the file, include the O update code. To have the machine reboot automatically after the package program completes, include the Q update code.
If a symbolic link, directory, or other element on the local disk has the same name, it is replaced with the file (a directory's contents are first removed as necessary).
The instruction has the following syntax:
F[update_code] file source_file [owner group mode_bits]
where
If the A update code is included, specify the source file's complete pathname. Otherwise, the package command derives the source file's full name by appending the file pathname to this pathname. For example, if the A update code is not included and the file /afs/abc.com/rs_aix42/bin/grep is the source file for the /bin/grep binary, the proper value in this field is /afs/abc.com/rs_aix42.
To copy the source file's owner to the target file, leave this field empty. In this case, the group and mode_bits fields must also be empty.
To copy the source file's group to the target file, leave this field empty. In this case, the owner and mode_bits fields must also be empty.
To copy the source file's mode bits to the target file, leave this field empty. In this case, the owner and group fields must also be empty.
The L Instruction for Creating a Symbolic Link
The L instruction in a package configuration file creates a symbolic link on the local disk to a directory or file that exists either in AFS or elsewhere on the local disk. As with the standard UNIX ln -s command, the link is created even if the actual file or directory does not exist.
If a file or directory on the local disk already has the same name, the package command replaces it with a symbolic link.
The instruction has the following syntax:
L[update_code] link actual_path [owner group mode_bits]
where
The package command interpreter correctly handles pathnames that begin with the ./ (period, slash) or ../ (two periods, slash) notation, interpreting them relative to the current working directory from which the package command is invoked.
To designate the issuer of the package command (usually, the local superuser root) as the symbolic link's owner, leave this field empty. In this case, the group and mode_bits fields must also be empty.
To have the symbolic link's group match the default group associated with the package command's issuer, leave this field empty. The issuer is usually the local superuser root and the default group is designated in the issuer's entry in the local /etc/passwd file or equivalent. If this field is left empty, the owner and mode_bits fields must also be empty.
Leaving this field empty sets the symbolic link's mode bits to 777 (rwxrwxrwx). In this case, the owner and group fields must also be empty.
The S Instruction for Creating a Socket
The S instruction in a package configuration file creates a socket (a communications device for UDP or TCP/IP connections) on the local disk. The instruction has the following syntax:
S socket [owner group mode_bits]
where
To designate the issuer of the package command (usually, the local superuser root) as the socket's owner, leave this field empty. In this case, the group and mode_bits fields must also be empty.
To have the symbolic link's group match the default group associated with the package command's issuer, leave this field empty. The issuer is usually the local superuser root and the default group is designated in the issuer's entry in the local /etc/passwd file or equivalent. If this field is left empty, the owner and mode_bits fields must also be empty.
Leaving this field empty sets the symbolic link's mode bits to 777 (rwxrwxrwx), modulated by the cell's umask. In this case, the owner and group fields must also be empty.
The %define or %undef Instructions Declaring or Undeclaring a Definition
The %define instruction in a package configuration file declares or defines a variable, depending on its number of arguments:
The %undef statement negates the effect of a previous %define statement, declaring its argument to be defined no longer, or to have a value no longer if it is a variable.
The syntax for the two types of instruction are as follows:
%define declaration %define variable value %undef declaration %undef variable
where
The %ifdef and %ifndef Instructions for Specifying a Conditional Action to Perform
The %ifdef instruction in a package configuration file specifies one or more actions to perform if the indicated string has been declared by a single-argument %define statement, or is a variable for which a value has been defined by a two-argument %define statement.
Similarly, the %ifndef instruction specifies one or more actions to perform if the indicated string has not been declared or is a variable without a value, either because no %define statement has defined it or an %undef statement has undefined it.
In both cases, the optional %else statement specifies one or more alternate actions to perform if the first statement evaluates to false. (For an %ifdef statement, the %else statement is executed if the indicated string has never been declared or is a variable without a value, or if an %undef statement has undefined either one; for an %ifndef statement, it is executed if the string has been declared or is a variable with a value.)
It is possible to nest any number of %ifdef and %ifndef statements.
The two types of statement share a common syntax:
%ifdef | ifndef declaration action+ [%else [declaration] alternate_action+] %endif declaration
where
The %include Instruction for Including a Library File
The %include instruction in a package configuration file includes the contents of the indicated library file in a configuration file that results from the compilation of the prototype file in which the %include instruction appears. It has the following syntax:
%include pathname
where
Cautions
The configuration file must be completely correct. If there are any syntax errors or incorrect values, the package command interpreter exits without executing any instruction.
Examples
The following example B and C instructions define a disk /dev/hd0a with major and minor device numbers 1 and 0 and mode bits of -rw-r--r--, and a tty /dev/ttyp5 with major and minor device numbers 6 and 5 and mode bits of -rw-rw-rw. In both cases, the owner is root and the owning group wheel.
B /dev/hd0a 1 0 root wheel 644 C /dev/ttyp5 6 5 root wheel 666
The following example D instruction creates the local /usr directory with owner root and group wheel and mode bits of drwxr-xr-x. The R update code removes any files and subdirectories that reside in the /usr directory (if it already exists) but do not appear in the configuration file.
DR /usr root wheel 755
The following example F instruction, appropriate for a machine running AIX 4.2 in the ABC Corporation cell, creates or updates the local disk file /bin/grep, using /afs/abc.com/rs_aix42/bin/grep as the source.
F /bin/grep /afs/abc.com/rs_aix42 root wheel 755
The next example F instruction creates the /usr/vice/etc/ThisCell file and specifies an absolute pathname for the source file, as indicated by the A update code. The Q code makes the package command return status code 4 as it exits, prompting a reboot of the machine if the standard package-related changes have been made to the machine's AFS initialization file. No values are provided for the owner, group and mode bits, so the file inherits them from the source file.
FAQ /usr/vice/etc/ThisCell /afs/abc.com/common/etc/ThisCell
The following example L instruction, appropriate for a machine running AIX 4.2 in the ABC Corporation cell, creates a symbolic link from /etc/ftpd on the local disk to the file /afs/abc.com/rs_aix42/etc/ftpd.
L /etc/ftpd /afs/abc.com/rs_aix42 root wheel 644
The following example S instruction defines the socket /dev/printer.
S /dev/printer root wheel 777
The following example %define instruction defines the value for the variable ${diskmode}. This variable is used elsewhere in the template to fill the owner_name, group_name, and mode_bits fields in a D, F, or L instruction.
%define diskmode root wheel 644
The following example %undef instruction declares the string afsd not to be defined.
%undef afsd
The following example %ifdef instruction specifies that if the string rs_aix42 is currently declared, then when the prototype file containing the instruction is compiled the three indicated library files are included. There is no alternate action defined. There must be %define statements earlier in the prototype file to declare rs_aix42 and to assign a value to the ${wsadmin} variable.
%ifdef rs_aix42 %include ${wsadmin}/lib/rs_aix42.readonly %include ${wsadmin}/lib/rs_aix42.generic %include ${wsadmin}/lib/rs_aix42.generic.dev %endif rs_aix42
The following example %ifndef instruction, appropriate for the State University cell, defines stateu.edu as the value of the ${cell} variable if it does not already have a value.
%ifndef cell %define cell stateu.edu %endif cell
The following example %include instruction includes the library file base.generic from the lib subdirectory of the directory in which package-related files reside. The ${wsadmin} variable resolves to an actual pathname (such as /afs/abc.com/wsadmin) during compilation.
%include ${wsadmin}/lib/base.generic
Related Information