=head1 NAME package - Provides instructions for the package command =head1 DESCRIPTION The package configuration file defines the file system elements that the B command creates or alters on the local disk of an AFS client machine it is configuring. Use the B<-config> or B<-fullconfig> argument to the B command to identify the configuration file to use. =head2 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. =over 4 =item B Defines a block special device, such as a disk, which deals with input in units of multi-byte command blocks. =item C Defines a character special device, such as a terminal or tty, which deals with input in single character units. =item D Creates a directory. =item F Creates or alters a file to match the contents of a specified source file. =item L Creates a symbolic link. =item S Defines a socket, which is a communications device for UDP and TCP/IP connections. =item %define Defines a variable or declares a string as defined. =item %ifdef Specifies an action to perform if a certain string is declared or defined. =item %ifndef Specifies an action to perform if a certain string is not declared or defined. =item %include Includes a library file. =item %undef Declares a string not to be defined, or a variable no longer to have a value. =back =head2 The B and C Instructions for Defining Special Devices The C 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) where =over 4 =item B Indicates the definition of a block special device. It must be a capital letter. =item C Indicates the definition of character special device. It must be a capital letter. =item Names the special device to define. To learn the name format appropriate to the machine's system type, consult the hardware or operating system documentation. =item Specifies the device's major device number in decimal format. To learn the correct value for the machine's system type, consult the hardware or operating system documentation. =item Specifies the device's minor device number in one of hexadecimal, octal, or decimal format. Precede a hexadecimal number with the string C<0x> (zero and the letter C) or an octal number with a C<0> (zero). A number without either prefix is interpreted as a decimal. To learn the correct value for the machine's system type, consult the hardware or operating system documentation. =item Specifies the username or UNIX user ID (UID) of the user to be designated the device's owner in the output from the UNIX C command. =item Specifies the group name or UNIX group ID (GID) of the group to be designated the device's group in the output from the UNIX C command. =item Defines the device's UNIX mode bits. Acceptable values are the standard three- or four-digit numbers corresponding to combinations of permissions. Examples: C<755> corresponds to C, and C<644> to C. =back =head2 The D Instruction for Creating a Directory The C 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[I] where =over 4 =item D Indicates the creation of a directory. It must be a capital letter. =item Modulates the directory creation instruction. It is optional and follows the letter C directly, without an intervening space. Choose one of the two acceptable values: =over 4 =item X Indicates that the directory is a lost+found directory (used by the B program). =item R Removes any subdirectory (along its contents) or file that exists in the existing directory on the local disk but for which an instruction does not appear in the configuration file. =back =item Specifies the full pathname of the directory to create. =item Specifies the username or UNIX user ID (UID) of the user to be designated the directory's owner in the output from the UNIX C command. =item Specifies the name or UNIX group ID (GID) of the group to be designated the directory's group in the output from the UNIX C command. =item Defines the directory's UNIX mode bits. Acceptable values are the standard three- or four-digit numbers corresponding to combinations of permissions. Examples: C<755> corresponds to C, and C<644> to C. =back =head2 The F Instruction for Creating or Updating a File The C 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 B 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 C update code is used to prevent that. To add a C<.old> extension to the current version of the file, include the C update code. To have the machine reboot automatically after the B program completes, include the C 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[] [ ] where =over 4 =item F Indicates the creation or update of a file. It must be a capital letter. =item Modulates the file creation instruction. It is optional and follows the letter C directly, without an intervening space. Choose one or more of the four acceptable values, and list them in any order: =over 4 =item A Indicates that the pathname in the field is the complete pathname of the source file, including the filename. If this argument is omitted, the B command appends the pathname in the field to the pathname in the field to derive the source file's full name. This code allows the source and target filenames to differ. =item I Preserves the existing file called , rather than overwriting it. =item O Saves the existing version of the file by appending a C<.old> extension to it. =item Q Causes the package command to exit with status code C<4> if it overwrites the file. If the standard B-related changes have been made to the machine's AFS initialization file, then status code C<4> causes the machine to reboot automatically. Use this code when the machine must reboot if updates to the file are to have any effect (for example, if the operating system file -- F or equivalent -- has changed). =back =item Specifies the complete pathname on the local disk of the file to create or update, including the filename as the final element. =item Specifies the pathname (local or AFS) of the file to copy to the local disk. If the C update code is included, specify the source file's complete pathname. Otherwise, the B command derives the source file's full name by appending the I pathname to this pathname. For example, if the C update code is not included and the file F is the source file for the F binary, the proper value in this field is F. =item Specifies the username or UNIX user ID (UID) of the user to be designated the file's owner in the output from the UNIX C command. To copy the source file's owner to the target file, leave this field empty. In this case, the and fields must also be empty. =item Specifies the name or UNIX group ID (GID) of the group to be designated the file's group in the output from the UNIX C command. To copy the source file's group to the target file, leave this field empty. In this case, the and fields must also be empty. =item Defines the file's UNIX mode bits. Acceptable values are the standard three- or four-digit numbers corresponding to combinations of permissions. Examples: C<755> corresponds to C, and C<644> to C. To copy the source file's mode bits to the target file, leave this field empty. In this case, the and fields must also be empty. =back =head2 The L Instruction for Creating a Symbolic Link The C 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 C 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 B command replaces it with a symbolic link. The instruction has the following syntax: L[I] [ ] where =over 4 =item L Indicates the creation of a symbolic link. It must be a capital letter. =item Modulates the link creation instruction. It is optional and follows the letter C directly, without an intervening space. Choose one or both of the acceptable values, and list them in any order: =over 4 =item A Indicates that the pathname in the field is the complete pathname of the actual directory or file (including the filename for a file). If this argument is omitted, the B command appends the value in the field to the pathname in the field to derive the actual directory or file's full name. This code allows the name of the symbolic link and actual directory or file to differ. =item I Preserves the existing symbolic link called , rather than overwriting it. =back =item Specifies the complete local disk pathname of the symbolic link to create. =item Specifies the pathname (local or AFS) of the directory or file to which the link refers. If the C update code is included, specify the directory or file's complete pathname. Otherwise, the B command derives the actual directory or file's full name by appending the value in the I field to this pathname. For example, if the C update code is not included and F is a symbolic link to the file F, the proper value in this field is F. The package command interpreter correctly handles pathnames that begin with the C<./> (period, slash) or C<../> (two periods, slash) notation, interpreting them relative to the current working directory from which the B command is invoked. =item Specifies the username or UNIX user ID (UID) of the user to be designated the symbolic link's owner in the output from the UNIX C command. To designate the issuer of the package command (usually, the local superuser C) as the symbolic link's owner, leave this field empty. In this case, the and fields must also be empty. =item Specifies the name or UNIX group ID (GID) of the group to be designated the link's group in the output from the UNIX C command. To have the symbolic link's group match the default group associated with the B command's issuer, leave this field empty. The issuer is usually the local superuser C and the default group is designated in the issuer's entry in the local F file or equivalent. If this field is left empty, the and fields must also be empty. =item Defines the symbolic link's UNIX mode bits. Acceptable values are the standard three- or four-digit numbers corresponding to combinations of permissions. Examples: C<755> corresponds to C, and C<644> to C. Leaving this field empty sets the symbolic link's mode bits to C<777> (C). In this case, the and fields must also be empty. =back =head2 The S Instruction for Creating a Socket The C 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 [ ] where =over 4 =item S Indicates the creation of a socket. It must be a capital letter. =item Names the socket. The proper format depends on the local machine's operating system. =item Specifies the username or UNIX user ID (UID) of the user to be designated the socket's owner in the output from the UNIX C command. To designate the issuer of the package command (usually, the local superuser C) as the socket's owner, leave this field empty. In this case, the and fields must also be empty. =item Specifies the name or UNIX group ID (GID) of the group to be designated the socket's group in the output from the UNIX C command. To have the symbolic link's group match the default group associated with the B command's issuer, leave this field empty. The issuer is usually the local superuser C and the default group is designated in the issuer's entry in the local F file or equivalent. If this field is left empty, the and fields must also be empty. =item Defines the socket's UNIX mode bits. Acceptable values are the standard three- or four-digit numbers corresponding to combinations of permissions. Examples: C<755> corresponds to C, and C<644> to C. Leaving this field empty sets the symbolic link's mode bits to C<777> (C), modulated by the cell's umask. In this case, the and fields must also be empty. =back =head2 The %define or %undef Instructions The C<%define> instruction in a package configuration file declares or defines a variable, depending on its number of arguments: =over 4 =item * If followed by a single argument, it declares that argument to be defined. The argument is then available as a controller when mentioned in C<%ifdef> and C<%ifndef> statements, which evaluate to C and C respectively. =item * If followed by two arguments, it defines the second argument as the value of the first. When the first argument appears later in this prototype or other prototype or library files as a variable -- surrounded by curly braces and preceded by a dollar sign, as in the example C<${variable}> -- the B command interpreter substitutes the second argument for it. =back The C<%undef> statement negates the effect of a previous C<%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 %define %undef %undef where =over 4 =item %define Indicates a definition statement. =item %undef Indicates a statement that negates a definition. =item Names the string being declared by a C<%define> statement, or negated by an C<%undef> statement. =item Specifies the name of the variable that a C<%define> statement is defining, or an C<%undef> statement is negating. =item Specifies the value to substitute for the string in the field when it appears in the appropriate format (surrounded by curly braces and preceded by a dollar sign, as in the example C<${variable}>), in this or other prototype and library files. It can include one or more words. =back =head2 The %ifdef and %ifndef Instructions The C<%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 C<%define> statement, or is a variable for which a value has been defined by a two-argument C<%define> statement. Similarly, the C<%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 C<%define> statement has defined it or an C<%undef> statement has undefined it. In both cases, the optional C<%else> statement specifies one or more alternate actions to perform if the first statement evaluates to C. (For an C<%ifdef> statement, the C<%else> statement is executed if the indicated string has never been declared or is a variable without a value, or if an C<%undef> statement has undefined either one; for an C<%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 C<%ifdef> and C<%ifndef> statements. The two types of statement share a common syntax: (%ifdef | %ifndef) + [%else [] +] %endif where =over 4 =item %ifdef Indicates that the statement evaluates as true if the string in the field is declared or is a variable with a defined value. =item %ifndef Indicates that the statement evaluates as true if the string in the field is not declared or is a variable without a defined value. =item Specifies the string that must be declared or the variable name that must have a defined value for an C<%ifdef> statement to evaluate as C, which results in the specified action being performed. For an C<%ifndef> statement, the string must not be declared or the variable must have no defined value for the statement to evaluate as C. The first and third occurrences of (the latter following the string C<%endif>) are required. The second occurrence (following the string C<%else>) is optional, serving only to clarify to which C<%ifdef> or C<%ifndef> statement the C<%else> statement belongs. =item Specifies each action to perform if the C<%ifdef> or C<%ifndef> statement evaluates as C. Each action must appear on a separate line. Acceptable types of actions are other statements beginning with a percent sign and definition instructions. =item Specifies each action to perform if the C<%ifdef> or C<%ifndef> statement evaluates to C. Each action must appear on a separate line. Acceptable types of actions are other statements beginning with a percent sign and definition instructions. =back =head2 The %include Instruction for Including a Library File The C<%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 C<%include> instruction appears. It has the following syntax: %include where =over 4 =item %include Indicates a library file include statement. =item Specifies the complete pathname of the library file to include. It can be in AFS or on the local disk, and can include one or more variables. =back =head1 CAUTIONS The configuration file must be completely correct. If there are any syntax errors or incorrect values, the B command interpreter exits without executing any instruction. =head1 EXAMPLES The following example C and C instructions define a disk F with major and minor device numbers C<1> and C<0> and mode bits of C<-rw-r--r-->, and a tty F with major and minor device numbers C<6> and C<5> and mode bits of C<-rw-rw-rw>. In both cases, the owner is C and the owning group C. B /dev/hd0a 1 0 root wheel 644 C /dev/ttyp5 6 5 root wheel 666 The following example C instruction creates the local F directory with owner C and group C and mode bits of C. The C update code removes any files and subdirectories that reside in the F directory (if it already exists) but do not appear in the configuration file. DR /usr root wheel 755 The following example C instruction, appropriate for a machine running AIX 4.2 in the ABC Corporation cell, creates or updates the local disk file F, using F as the source. F /bin/grep /afs/abc.com/rs_aix42 root wheel 755 The next example C instruction creates the F file and specifies an absolute pathname for the source file, as indicated by the C update code. The C code makes the B command return status code 4 as it exits, prompting a reboot of the machine if the standard B-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 C instruction, appropriate for a machine running AIX 4.2 in the ABC Corporation cell, creates a symbolic link from F on the local disk to the file F. L /etc/ftpd /afs/abc.com/rs_aix42 root wheel 644 The following example S instruction defines the socket F. S /dev/printer root wheel 777 The following example C<%define> instruction defines the value for the variable C<${diskmode}>. This variable is used elsewhere in the template to fill the , , and fields in a C, C, or C instruction. %define diskmode root wheel 644 The following example C<%undef> instruction declares the string B not to be defined. %undef afsd The following example C<%ifdef> instruction specifies that if the string C 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 C<%define> statements earlier in the prototype file to declare C and to assign a value to the C<${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 C<%ifndef> instruction, appropriate for the State University cell, defines C as the value of the C<${cell}> variable if it does not already have a value. %ifndef cell %define cell stateu.edu %endif cell The following example C<%include> instruction includes the library file C from the F subdirectory of the directory in which B-related files reside. The C<${wsadmin}> variable resolves to an actual pathname (such as F) during compilation. %include ${wsadmin}/lib/base.generic =head1 SEE ALSO L =head1 COPYRIGHT IBM Corporation 2000. All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.