DEVEL15-man-page-net-info-fixes-20070619
[openafs.git] / doc / man-pages / pod5 / package.pod
1 =head1 NAME
2
3 package - Provides instructions for the package command
4
5 =head1 DESCRIPTION
6
7 The package configuration file defines the file system elements that the
8 B<package> command creates or alters on the local disk of an AFS client
9 machine it is configuring. Use the B<-config> or B<-fullconfig> argument
10 to the B<package> command to identify the configuration file to use.
11
12 =head2 Summary of Configuration File Instructions
13
14 The configuration file can include one or more instances of each of the
15 following instructions, each on its own line. A more detailed description
16 of each instruction's syntax follows this list.
17
18 =over 4
19
20 =item B
21
22 Defines a block special device, such as a disk, which deals with input in
23 units of multi-byte command blocks.
24
25 =item C
26
27 Defines a character special device, such as a terminal or tty, which deals
28 with input in single character units.
29
30 =item D
31
32 Creates a directory.
33
34 =item F
35
36 Creates or alters a file to match the contents of a specified source file.
37
38 =item L
39
40 Creates a symbolic link.
41
42 =item S
43
44 Defines a socket, which is a communications device for UDP and TCP/IP
45 connections.
46
47 =item %define
48
49 Defines a variable or declares a string as defined.
50
51 =item %ifdef
52
53 Specifies an action to perform if a certain string is declared or defined.
54
55 =item %ifndef
56
57 Specifies an action to perform if a certain string is not declared or
58 defined.
59
60 =item %include
61
62 Includes a library file.
63
64 =item %undef
65
66 Declares a string not to be defined, or a variable no longer to have a
67 value.
68
69 =back
70
71 =head2 The B and C Instructions for Defining Special Devices
72
73 The C<B> instruction in a package configuration file defines a block
74 special device, such as a disk, that deals with input in units of
75 multi-byte command blocks. The C<C> instruction defines a character
76 special device, such as a terminal or tty, that deals with input in single
77 character units. They share a common syntax:
78
79    (B | C) <device> <major> <minor> <owner> <group> <mode>
80
81 where
82
83 =over 4
84
85 =item B
86
87 Indicates the definition of a block special device. It must be a capital
88 letter.
89
90 =item C
91
92 Indicates the definition of character special device. It must be a capital
93 letter.
94
95 =item <device>
96
97 Names the special device to define. To learn the name format appropriate
98 to the machine's system type, consult the hardware or operating system
99 documentation.
100
101 =item <major>
102
103 Specifies the device's major device number in decimal format.  To learn
104 the correct value for the machine's system type, consult the hardware or
105 operating system documentation.
106
107 =item <minor>
108
109 Specifies the device's minor device number in one of hexadecimal, octal,
110 or decimal format. Precede a hexadecimal number with the string C<0x>
111 (zero and the letter C<x>) or an octal number with a C<0> (zero). A number
112 without either prefix is interpreted as a decimal. To learn the correct
113 value for the machine's system type, consult the hardware or operating
114 system documentation.
115
116 =item <owner>
117
118 Specifies the username or UNIX user ID (UID) of the user to be designated
119 the device's owner in the output from the UNIX C<ls -l> command.
120
121 =item <group>
122
123 Specifies the group name or UNIX group ID (GID) of the group to be
124 designated the device's group in the output from the UNIX C<ls -lg>
125 command.
126
127 =item <mode>
128
129 Defines the device's UNIX mode bits. Acceptable values are the standard
130 three- or four-digit numbers corresponding to combinations of
131 permissions. Examples: C<755> corresponds to C<rwxr-xr-x>, and C<644> to
132 C<rw-r--r-->.
133
134 =back
135
136 =head2 The D Instruction for Creating a Directory
137
138 The C<D> instruction in a package configuration file creates a directory
139 on the local disk. If a symbolic link, file, or other element on the local
140 disk has the same name, it is replaced with a directory. If the directory
141 already exists, its owner, group, and mode bits are changed if necessary
142 to conform with the instruction. The instruction has the following syntax:
143
144    D[I<update_code>] <directory> <owner> <group> <mode>
145
146 where
147
148 =over 4
149
150 =item D
151
152 Indicates the creation of a directory. It must be a capital letter.
153
154 =item <update_code>
155
156 Modulates the directory creation instruction. It is optional and follows
157 the letter C<D> directly, without an intervening space.  Choose one of the
158 two acceptable values:
159
160 =over 4
161
162 =item X
163
164 Indicates that the directory is a lost+found directory (used by the
165 B<fsck> program).
166
167 =item R
168
169 Removes any subdirectory (along its contents) or file that exists in the
170 existing directory on the local disk but for which an instruction does not
171 appear in the configuration file.
172
173 =back
174
175 =item <directory>
176
177 Specifies the full pathname of the directory to create.
178
179 =item <owner>
180
181 Specifies the username or UNIX user ID (UID) of the user to be designated
182 the directory's owner in the output from the UNIX C<ls -ld> command.
183
184 =item <group>
185
186 Specifies the name or UNIX group ID (GID) of the group to be designated
187 the directory's group in the output from the UNIX C<ls -lgd> command.
188
189 =item <mode>
190
191 Defines the directory's UNIX mode bits. Acceptable values are the standard
192 three- or four-digit numbers corresponding to combinations of
193 permissions. Examples: C<755> corresponds to C<drwxr-xr-x>, and C<644> to
194 C<drw-r--r-->.
195
196 =back
197
198 =head2 The F Instruction for Creating or Updating a File
199
200 The C<F> instruction in a package configuration file creates or updates a
201 file on the local disk by copying in the contents of the indicated source
202 file, which can reside in AFS or on the local disk. If the B<package>
203 command interpreter cannot access the source file, it exits without
204 executing any instruction in the configuration file.
205
206 If a file with the same name already exists on disk, the package command
207 overwrites it with the contents of the source file, unless the C<I> update
208 code is used to prevent that. To add a C<.old> extension to the current
209 version of the file, include the C<O> update code. To have the machine
210 reboot automatically after the B<package> program completes, include the
211 C<Q> update code.
212
213 If a symbolic link, directory, or other element on the local disk has the
214 same name, it is replaced with the file (a directory's contents are first
215 removed as necessary).
216
217 The instruction has the following syntax:
218
219    F[<update_code>] <file> <source> [<owner> <group> <mode>]
220
221 where
222
223 =over 4
224
225 =item F
226
227 Indicates the creation or update of a file. It must be a capital letter.
228
229 =item <update_code>
230
231 Modulates the file creation instruction. It is optional and follows the
232 letter C<F> directly, without an intervening space. Choose one or more of
233 the four acceptable values, and list them in any order:
234
235 =over 4
236
237 =item A
238
239 Indicates that the pathname in the <source> field is the complete pathname
240 of the source file, including the filename. If this argument is omitted,
241 the B<package> command appends the pathname in the <file> field to the
242 pathname in the <source> field to derive the source file's full name. This
243 code allows the source and target filenames to differ.
244
245 =item I
246
247 Preserves the existing file called <file>, rather than overwriting it.
248
249 =item O
250
251 Saves the existing version of the file by appending a C<.old> extension to
252 it.
253
254 =item Q
255
256 Causes the package command to exit with status code C<4> if it overwrites
257 the file. If the standard B<package>-related changes have been made to the
258 machine's AFS initialization file, then status code C<4> causes the
259 machine to reboot automatically. Use this code when the machine must
260 reboot if updates to the file are to have any effect (for example, if the
261 operating system file -- F</vmunix> or equivalent -- has changed).
262
263 =back
264
265 =item <file>
266
267 Specifies the complete pathname on the local disk of the file to create or
268 update, including the filename as the final element.
269
270 =item <source>
271
272 Specifies the pathname (local or AFS) of the file to copy to the local
273 disk.
274
275 If the C<A> update code is included, specify the source file's complete
276 pathname. Otherwise, the B<package> command derives the source file's full
277 name by appending the I<file> pathname to this pathname. For example, if
278 the C<A> update code is not included and the file
279 F</afs/abc.com/rs_aix42/bin/grep> is the source file for the F</bin/grep>
280 binary, the proper value in this field is F</afs/abc.com/rs_aix42>.
281
282 =item <owner>
283
284 Specifies the username or UNIX user ID (UID) of the user to be designated
285 the file's owner in the output from the UNIX C<ls -l> command.
286
287 To copy the source file's owner to the target file, leave this field
288 empty. In this case, the <group> and <mode> fields must also be empty.
289
290 =item <group>
291
292 Specifies the name or UNIX group ID (GID) of the group to be designated
293 the file's group in the output from the UNIX C<ls -lg> command.
294
295 To copy the source file's group to the target file, leave this field
296 empty. In this case, the <owner> and <mode> fields must also be empty.
297
298 =item <mode>
299
300 Defines the file's UNIX mode bits. Acceptable values are the standard
301 three- or four-digit numbers corresponding to combinations of
302 permissions. Examples: C<755> corresponds to C<rwxr-xr-x>, and C<644> to
303 C<rw-r--r-->.
304
305 To copy the source file's mode bits to the target file, leave this field
306 empty. In this case, the <owner> and <group> fields must also be empty.
307
308 =back
309
310 =head2 The L Instruction for Creating a Symbolic Link
311
312 The C<L> instruction in a package configuration file creates a symbolic
313 link on the local disk to a directory or file that exists either in AFS or
314 elsewhere on the local disk. As with the standard UNIX C<ln -s> command,
315 the link is created even if the actual file or directory does not exist.
316
317 If a file or directory on the local disk already has the same name, the
318 B<package> command replaces it with a symbolic link.
319
320 The instruction has the following syntax:
321
322    L[I<update_code>] <link> <path> [<owner> <group> <mode>]
323
324 where
325
326 =over 4
327
328 =item L
329
330 Indicates the creation of a symbolic link. It must be a capital letter.
331
332 =item <update_code>
333
334 Modulates the link creation instruction. It is optional and follows the
335 letter C<L> directly, without an intervening space. Choose one or both of
336 the acceptable values, and list them in any order:
337
338 =over 4
339
340 =item A
341
342 Indicates that the pathname in the <path> field is the complete pathname
343 of the actual directory or file (including the filename for a file). If
344 this argument is omitted, the B<package> command appends the value in the
345 <link> field to the pathname in the <path> field to derive the actual
346 directory or file's full name. This code allows the name of the symbolic
347 link and actual directory or file to differ.
348
349 =item I
350
351 Preserves the existing symbolic link called <link>, rather than
352 overwriting it.
353
354 =back
355
356 =item <link>
357
358 Specifies the complete local disk pathname of the symbolic link to create.
359
360 =item <path>
361
362 Specifies the pathname (local or AFS) of the directory or file to which
363 the link refers. If the C<A> update code is included, specify the
364 directory or file's complete pathname. Otherwise, the B<package> command
365 derives the actual directory or file's full name by appending the value in
366 the I<link> field to this pathname. For example, if the C<A> update code
367 is not included and F</etc/ftpd> is a symbolic link to the file
368 F</afs/abc.com/sun4x_56/etc/ftpd>, the proper value in this field is
369 F</afs/abc.com/sun4x_56>.
370
371 The package command interpreter correctly handles pathnames that begin
372 with the C<./> (period, slash) or C<../> (two periods, slash) notation,
373 interpreting them relative to the current working directory from which the
374 B<package> command is invoked.
375
376 =item <owner>
377
378 Specifies the username or UNIX user ID (UID) of the user to be designated
379 the symbolic link's owner in the output from the UNIX C<ls -l> command.
380
381 To designate the issuer of the package command (usually, the local
382 superuser C<root>) as the symbolic link's owner, leave this field
383 empty. In this case, the <group> and <mode> fields must also be empty.
384
385 =item <group>
386
387 Specifies the name or UNIX group ID (GID) of the group to be designated
388 the link's group in the output from the UNIX C<ls -lg> command.
389
390 To have the symbolic link's group match the default group associated with
391 the B<package> command's issuer, leave this field empty. The issuer is
392 usually the local superuser C<root> and the default group is designated in
393 the issuer's entry in the local F</etc/passwd> file or equivalent. If this
394 field is left empty, the <owner> and <mode> fields must also be empty.
395
396 =item <mode>
397
398 Defines the symbolic link's UNIX mode bits. Acceptable values are the
399 standard three- or four-digit numbers corresponding to combinations of
400 permissions. Examples: C<755> corresponds to C<rwxr-xr-x>, and C<644> to
401 C<rw-r--r-->.
402
403 Leaving this field empty sets the symbolic link's mode bits to C<777>
404 (C<rwxrwxrwx>). In this case, the <owner> and <group> fields must also be
405 empty.
406
407 =back
408
409 =head2 The S Instruction for Creating a Socket
410
411 The C<S> instruction in a package configuration file creates a socket (a
412 communications device for UDP or TCP/IP connections) on the local
413 disk. The instruction has the following syntax:
414
415    S <socket> [<owner> <group> <mode>]
416
417 where
418
419 =over 4
420
421 =item S
422
423 Indicates the creation of a socket. It must be a capital letter.
424
425 =item <socket>
426
427 Names the socket. The proper format depends on the local machine's
428 operating system.
429
430 =item <owner>
431
432 Specifies the username or UNIX user ID (UID) of the user to be designated
433 the socket's owner in the output from the UNIX C<ls -l> command.
434
435 To designate the issuer of the package command (usually, the local
436 superuser C<root>) as the socket's owner, leave this field empty. In this
437 case, the <group> and <mode> fields must also be empty.
438
439 =item <group>
440
441 Specifies the name or UNIX group ID (GID) of the group to be designated
442 the socket's group in the output from the UNIX C<ls -lg> command.
443
444 To have the symbolic link's group match the default group associated with
445 the B<package> command's issuer, leave this field empty. The issuer is
446 usually the local superuser C<root> and the default group is designated in
447 the issuer's entry in the local F</etc/passwd> file or equivalent. If this
448 field is left empty, the <owner> and <mode> fields must also be empty.
449
450 =item <mode>
451
452 Defines the socket's UNIX mode bits. Acceptable values are the standard
453 three- or four-digit numbers corresponding to combinations of
454 permissions. Examples: C<755> corresponds to C<rwxr-xr-x>, and C<644> to
455 C<rw-r--r-->.
456
457 Leaving this field empty sets the symbolic link's mode bits to C<777>
458 (C<rwxrwxrwx>), modulated by the cell's umask. In this case, the <owner>
459 and <group> fields must also be empty.
460
461 =back
462
463 =head2 The %define or %undef Instructions
464
465 The C<%define> instruction in a package configuration file declares or
466 defines a variable, depending on its number of arguments:
467
468 =over 4
469
470 =item *
471
472 If followed by a single argument, it declares that argument to be
473 defined. The argument is then available as a controller when mentioned in
474 C<%ifdef> and C<%ifndef> statements, which evaluate to C<true> and
475 C<false> respectively.
476
477 =item *
478
479 If followed by two arguments, it defines the second argument as the value
480 of the first. When the first argument appears later in this prototype or
481 other prototype or library files as a variable -- surrounded by curly
482 braces and preceded by a dollar sign, as in the example C<${variable}> --
483 the B<package> command interpreter substitutes the second argument for it.
484
485 =back
486
487 The C<%undef> statement negates the effect of a previous C<%define>
488 statement, declaring its argument to be defined no longer, or to have a
489 value no longer if it is a variable.
490
491 The syntax for the two types of instruction are as follows:
492
493    %define <declaration>
494    %define <variable> <value>
495    %undef  <declaration>
496    %undef  <variable>
497
498 where
499
500 =over 4
501
502 =item %define
503
504 Indicates a definition statement.
505
506 =item %undef
507
508 Indicates a statement that negates a definition.
509
510 =item <declaration>
511
512 Names the string being declared by a C<%define> statement, or
513 negated by an C<%undef> statement.
514
515 =item <variable>
516
517 Specifies the name of the variable that a C<%define> statement is
518 defining, or an C<%undef> statement is negating.
519
520 =item <value>
521
522 Specifies the value to substitute for the string in the <variable> field
523 when it appears in the appropriate format (surrounded by curly braces and
524 preceded by a dollar sign, as in the example C<${variable}>), in this or
525 other prototype and library files. It can include one or more words.
526
527 =back
528
529 =head2 The %ifdef and %ifndef Instructions
530
531 The C<%ifdef> instruction in a package configuration file specifies one or
532 more actions to perform if the indicated string has been declared by a
533 single-argument C<%define> statement, or is a variable for which a value
534 has been defined by a two-argument C<%define> statement.
535
536 Similarly, the C<%ifndef> instruction specifies one or more actions to
537 perform if the indicated string has not been declared or is a variable
538 without a value, either because no C<%define> statement has defined it or
539 an C<%undef> statement has undefined it.
540
541 In both cases, the optional C<%else> statement specifies one or more
542 alternate actions to perform if the first statement evaluates to
543 C<false>. (For an C<%ifdef> statement, the C<%else> statement is executed
544 if the indicated string has never been declared or is a variable without a
545 value, or if an C<%undef> statement has undefined either one; for an
546 C<%ifndef> statement, it is executed if the string has been declared or is
547 a variable with a value.)
548
549 It is possible to nest any number of C<%ifdef> and C<%ifndef> statements.
550
551 The two types of statement share a common syntax:
552
553    (%ifdef | %ifndef) <declaration>
554        <action>+
555    [%else [<declaration>]
556        <alternate_action>+]
557    %endif <declaration>
558
559 where
560
561 =over 4
562
563 =item %ifdef
564
565 Indicates that the statement evaluates as true if the string in the
566 <declaration> field is declared or is a variable with a defined value.
567
568 =item %ifndef
569
570 Indicates that the statement evaluates as true if the string in the
571 <declaration> field is not declared or is a variable without a defined
572 value.
573
574 =item <declaration>
575
576 Specifies the string that must be declared or the variable name that must
577 have a defined value for an C<%ifdef> statement to evaluate as C<true>,
578 which results in the specified action being performed.  For an C<%ifndef>
579 statement, the string must not be declared or the variable must have no
580 defined value for the statement to evaluate as C<true>. The first and
581 third occurrences of <declaration> (the latter following the string
582 C<%endif>) are required. The second occurrence (following the string
583 C<%else>) is optional, serving only to clarify to which C<%ifdef> or
584 C<%ifndef> statement the C<%else> statement belongs.
585
586 =item <action>
587
588 Specifies each action to perform if the C<%ifdef> or C<%ifndef> statement
589 evaluates as C<true>. Each action must appear on a separate
590 line. Acceptable types of actions are other statements beginning with a
591 percent sign and definition instructions.
592
593 =item <alternate_action>
594
595 Specifies each action to perform if the C<%ifdef> or C<%ifndef> statement
596 evaluates to C<false>. Each action must appear on a separate
597 line. Acceptable types of actions are other statements beginning with a
598 percent sign and definition instructions.
599
600 =back
601
602 =head2 The %include Instruction for Including a Library File
603
604 The C<%include> instruction in a package configuration file includes the
605 contents of the indicated library file in a configuration file that
606 results from the compilation of the prototype file in which the
607 C<%include> instruction appears. It has the following syntax:
608
609    %include <pathname>
610
611 where
612
613 =over 4
614
615 =item %include
616
617 Indicates a library file include statement.
618
619 =item <pathname>
620
621 Specifies the complete pathname of the library file to include. It can be
622 in AFS or on the local disk, and can include one or more variables.
623
624 =back
625
626 =head1 CAUTIONS
627
628 The configuration file must be completely correct. If there are any syntax
629 errors or incorrect values, the B<package> command interpreter exits
630 without executing any instruction.
631
632 =head1 EXAMPLES
633
634 The following example C<B> and C<C> instructions define a disk
635 F</dev/hd0a> with major and minor device numbers C<1> and C<0> and mode
636 bits of C<-rw-r--r-->, and a tty F</dev/ttyp5> with major and minor device
637 numbers C<6> and C<5> and mode bits of C<-rw-rw-rw>. In both cases, the
638 owner is C<root> and the owning group C<wheel>.
639
640    B /dev/hd0a 1 0 root wheel 644
641    C /dev/ttyp5 6 5 root wheel 666
642
643 The following example C<D> instruction creates the local F</usr> directory
644 with owner C<root> and group C<wheel> and mode bits of C<drwxr-xr-x>. The
645 C<R> update code removes any files and subdirectories that reside in the
646 F</usr> directory (if it already exists) but do not appear in the
647 configuration file.
648
649    DR /usr root wheel 755
650
651 The following example C<F> instruction, appropriate for a machine running
652 AIX 4.2 in the ABC Corporation cell, creates or updates the local disk
653 file F</bin/grep>, using F</afs/abc.com/rs_aix42/bin/grep> as the source.
654
655    F /bin/grep /afs/abc.com/rs_aix42 root wheel 755
656
657 The next example C<F> instruction creates the F</usr/vice/etc/ThisCell>
658 file and specifies an absolute pathname for the source file, as indicated
659 by the C<A> update code. The C<Q> code makes the B<package> command return
660 status code 4 as it exits, prompting a reboot of the machine if the
661 standard B<package>-related changes have been made to the machine's AFS
662 initialization file. No values are provided for the owner, group and mode
663 bits, so the file inherits them from the source file.
664
665    FAQ /usr/vice/etc/ThisCell /afs/abc.com/common/etc/ThisCell
666
667 The following example C<L> instruction, appropriate for a machine running
668 AIX 4.2 in the ABC Corporation cell, creates a symbolic link from
669 F</etc/ftpd> on the local disk to the file
670 F</afs/abc.com/rs_aix42/etc/ftpd>.
671
672    L /etc/ftpd /afs/abc.com/rs_aix42 root wheel 644
673
674 The following example S instruction defines the socket F</dev/printer>.
675
676    S /dev/printer root wheel 777
677
678 The following example C<%define> instruction defines the value for the
679 variable C<${diskmode}>. This variable is used elsewhere in the template
680 to fill the <owner>, <group>, and <mode> fields in a C<D>, C<F>, or C<L>
681 instruction.
682
683    %define diskmode root wheel 644
684
685 The following example C<%undef> instruction declares the string B<afsd>
686 not to be defined.
687
688    %undef afsd
689
690 The following example C<%ifdef> instruction specifies that if the string
691 C<rs_aix42> is currently declared, then when the prototype file containing
692 the instruction is compiled the three indicated library files are
693 included. There is no alternate action defined. There must be C<%define>
694 statements earlier in the prototype file to declare C<rs_aix42> and to
695 assign a value to the C<${wsadmin}> variable.
696
697    %ifdef rs_aix42
698    %include ${wsadmin}/lib/rs_aix42.readonly
699    %include ${wsadmin}/lib/rs_aix42.generic
700    %include ${wsadmin}/lib/rs_aix42.generic.dev
701    %endif rs_aix42
702
703 The following example C<%ifndef> instruction, appropriate for the State
704 University cell, defines C<stateu.edu> as the value of the C<${cell}>
705 variable if it does not already have a value.
706
707    %ifndef cell
708    %define cell stateu.edu
709    %endif cell
710
711 The following example C<%include> instruction includes the library file
712 C<base.generic> from the F<lib> subdirectory of the directory in which
713 B<package>-related files reside. The C<${wsadmin}> variable resolves to an
714 actual pathname (such as F</afs/abc.com/wsadmin>) during compilation.
715
716    %include ${wsadmin}/lib/base.generic
717
718 =head1 SEE ALSO
719
720 L<package(8)>
721
722 =head1 COPYRIGHT
723
724 IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.
725
726 This documentation is covered by the IBM Public License Version 1.0.  It was
727 converted from HTML to POD by software written by Chas Williams and Russ
728 Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.