Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
2.  Building a Package Creating a prototype File The Format of the prototype File The owner Field  Previous   Contents   Next 
   
 

The group Field

The group field may contain a group name, a question mark (?), or a variable specification. A group name has a maximum of 14 characters and should be a name that already exists on the target system (such as, bin or sys). A ? means that the group will be unchanged as the object is installed, implying that the object of the same name already exists on the target system.

A variable specification can be of the form $Group or $group, where the first letter of the variable is either an uppercase letter or a lowercase letter. If the variable begins with a lowercase letter, it must be defined as the package is built, either in the prototype file or as an option to the pkgmk command. If the variable begins with an uppercase letter, the variable specification will be inserted into the pkginfo file as a default value, and may be redefined at install time via a request script. For information on the difference between install and build variables, see "Package Environment Variables".

Files with file type i (information file) and l (hard link) should leave this field blank.

Creating a prototype File From Scratch

If you want to create a prototype file from scratch, you can do so with your favorite text editor, adding one entry per package object. See "The Format of the prototype File" andprototype(4) for more information on the format of the file. However, after you have defined each package object, you might want to include some of the features described in "Adding Functionality to a prototype File".

Creating a prototype File With the pkgproto Command

You can use the pkgproto command to build a basic prototype file, as long as you have organized your package directory structure as described in "Organizing a Package's Contents". For example, using the sample directory structure and pkginfo file described in previous sections, the commands for creating the prototype file are:

$ cd /home/jane
$ pkgproto ./SUNWcadap > InfoFiles/prototype

The prototype file looks like:

d none SUNWcadap 0755 jane staff
d none SUNWcadap/demo 0755 jane staff
f none SUNWcadap/demo/file1 0555 jane staff
d none SUNWcadap/srcfiles 0755 jane staff
f none SUNWcadap/srcfiles/file5 0555 jane staff
f none SUNWcadap/srcfiles/file6 0555 jane staff
d none SUNWcadap/lib 0755 jane staff
f none SUNWcadap/lib/file2 0644 jane staff
d none SUNWcadap/man 0755 jane staff
f none SUNWcadap/man/windex 0644 jane staff
d none SUNWcadap/man/man1 0755 jane staff
f none SUNWcadap/man/man1/file4.1 0444 jane staff
f none SUNWcadap/man/man1/file3.1 0444 jane staff

Note - The actual owner and group of the person building the package is recorded by the pkgproto command. A good technique is to use the chown -R and the chgrp -R commands, setting the owner and group as intended before running the pkgproto command.


This prototype file is not yet complete. See "Fine-Tuning a prototype File Created With the pkgproto Command" for information on completing this file.

Fine-Tuning a prototype File Created With the pkgproto Command

Although the pkgproto command is useful in creating an initial prototype file, it does not create entries for every package object that needs to be defined, or make complete entries. The pkgproto command does not:

  • Create complete entries for objects with file types v (volatile files), e (editable files), x (exclusive directories), or i (information files or installation scripts).

  • Support multiple classes with a single invocation.

Therefore, you probably need to modify the prototype file to include at least some of these object definitions, possibly redefine path names and other field settings, and include some of the features described in "Adding Functionality to a prototype File".

Creating Object Entries With File Types v, e, x, and i

At the very least, you need to modify the prototype file to add objects with file type i. If you stored your information files and installation scripts in the first level of your package directory (for example, /home/jane/SUNWcadap/pkginfo), then an entry in the prototype file would look like:

i pkginfo

If you did not store your information files and installation scripts in the first level of your package directory, then you need to specify their source location. For example:

i pkginfo=/home/jane/InfoFiles/pkginfo

Or, you can use the !search command to specify the location for the pkgmk command to look when building the package. See "Providing a Search Path for the pkgmk Command" for more information.

To add entries for objects with file types v, e, and x, follow the format described in "The Format of the prototype File", or refer to prototype(4).


Note - Remember to always assign a class to files with a file type of e (editable) and have an associated class action script for that class. Otherwise, the files will be removed during package removal, even if the path name is shared with other packages.


Using Multiple Class Definitions

If you use the pkgproto command to create your basic prototype file, you can assign all of the package objects to the none class or one, specific class. As shown in "Creating a prototype File With the pkgproto Command", the basic pkgproto command assigns all objects to the none class. To assign all objects to a specific class, you can use the -c option. For example:

$ pkgproto -c classname /home/jane/SUNWcadap > /home/jane/InfoFiles/prototype

If you use multiple classes, you may need to manually edit the prototype file and modify the class field for each object. If you use classes, you also need to define the CLASSES parameter in the pkginfo file and write class action scripts. As mentioned previously, using classes is an optional feature and is discussed in detail in "Writing Class Action Scripts".

Example--Fine-Tuning a prototype File Created Using the pkgproto Command

Given the prototype file created by the pkgproto command in "Creating a prototype File With the pkgproto Command", there are several modifications that need to be made.

  • There needs to be an entry for the pkginfo file.

  • The path fields need to be modified to be the path1=path2 format, since the package source is in /home/jane. (Since the package source is a hierarchical directory, and the !search command does not search recursively, it may be easier to use the path1=path2 format.)

  • The owner and group fields should contain the names of existing users and groups on the target system. That is, the owner jane will result in an error since this owner is not part of the SunOS™ operating system.

    The modified prototype file looks like:

    i pkginfo=/home/jane/InfoFiles/pkginfo
    d none SUNWcadap=/home/jane/SUNWcadap 0755 root sys
    d none SUNWcadap/demo=/home/jane/SUNWcadap/demo 0755 root bin
    f none SUNWcadap/demo/file1=/home/jane/SUNWcadap/demo/file1 0555 root bin
    d none SUNWcadap/srcfiles=/home/jane/SUNWcadap/srcfiles 0755 root bin
    f none SUNWcadap/srcfiles/file5=/home/jane/SUNWcadap/srcfiles/file5 0555 root bin
    f none SUNWcadap/srcfiles/file6=/home/jane/SUNWcadap/srcfiles/file6 0555 root bin
    d none SUNWcadap/lib=/home/jane/SUNWcadap/lib 0755 root bin
    f none SUNWcadap/lib/file2=/home/jane/SUNWcadap/lib/file2 0644 root bin
    d none SUNWcadap/man=/home/jane/SUNWcadap/man 0755 bin bin
    f none SUNWcadap/man/windex=/home/jane/SUNWcadap/man/windex 0644 root other
    d none SUNWcadap/man/man1=/home/jane/SUNWcadap/man/man1 0755 bin bin
    f none SUNWcadap/man/man1/file4.1=/home/jane/SUNWcadap/man/man1/file4.1 0444 bin bin
    f none SUNWcadap/man/man1/file3.1=/home/jane/SUNWcadap/man/man1/file3.1 0444 bin bin

Adding Functionality to a prototype File

Besides defining every package object in the prototype file, you can also:

  • Define additional objects to be created at install time.

  • Create links at install time.

  • Distribute packages over multiple volumes.

  • Nest prototype files.

  • Set a default value for the mode, owner, and group fields.

  • Provide a search path for the pkgmk command.

  • Set environment variables.

See the following sections for information on making these changes.

 
 
 
  Previous   Contents   Next