2    Creating Kit Directories

After you develop a software product, you package the product files to process them into a kit. First you must organize these files by function and use, then place them into a kit-building directory structure. When you design the kit-building directory structure, consider where you want to place the product files on the customer's system and then create a kit directory structure that closely mirrors that on the customer's system.

A kit developer must perform the following actions to create kit directories:

  1. Obtain a unique three-letter manufacturer's product code (Section 2.1)

  2. Create the directory structure needed to build a product kit (Section 2.2)

  3. Populate the source directory on the kit-building system (Section 2.3)

2.1    Obtaining a Unique Product Code

Before you can create a product kit, you must have a unique three-letter product code. To obtain this product code, send electronic mail to product@dssr.sqp.zko.dec.com. You use this product code and a product version number that you assign to name your product-specific subdirectories.

Examples in this book use OAT as the prefix as the unique three-letter product code for the Orpheus Document Builder (ODB) product kit. Assuming this is the first release of the product, the examples use 100 as the version number.

2.2    Creating a Kit Building Directory Structure

To create a kit, you need three separate directory hierarchies on the kit development system. Figure 2-1 shows these directory hierarchies.

Figure 2-1:  Kit Directory Hierarchies

The following definitions describe each directory hierarchy:

Use the mkdir command to create your kit directories. For example:

# mkdir -p /mykit/src /mykit/data /mykit/output

2.3    Populating the Source Directory

The components of a kit can be installed in any directory on the customer's system. However, guidelines exist for file placement. The standard system directory structure separates files by function and use and is designed for efficient organization.

This section discusses the following topics:

You can choose any method for populating the source hierarchy. For example, you could create a Makefile to use with the make command, or you could copy files with the cp command.

2.3.1    Using Standard Directory Structures

A standard directory structure has the following advantages:

Specific directory requirements exist for each type of product kit. In some cases, additional files are required for the kit to build successfully.

Install product files in product-specific subdirectories of the root ( / ), /usr, and /usr/var directories, as described in the following list:

2.3.2    Using Context-Dependent Symbolic Links

If you are preparing a product kit that may run on a cluster, you need to create context-dependent symbolic links (CDSLs) to member-specific files in addition to using shared files in your product kit's inventory.

This section provides the following information:

Figure 2-2 shows member-specific directories in the ODB product kit source hierarchy.

Figure 2-2:  Member-Specific Directories in Source Hierarchy

Note

Layered product kits always should refer to CDSLs and not to the corresponding member-specific files. Doing this isolates CDSL awareness from the layered product and keeps it in the file system hierarchy, making it easier for you to maintain and upgrade your layered product kit. CDSL references access the correct file whether the product is installed on a cluster or on a single system, and continue to work if file types change in a future version of the product.

For example, refer to the /usr/var/X11/Xserver.conf file rather than the /usr/var/cluster/members/member0/X11/Xserver.conf file. These are the same if the /usr/var/X11/Xserver.conf file is a CDSL.

2.3.2.1    Knowing When to Use CDSLs

If your product kit might run on a cluster, you may need to create CDSLs.

Do not make a directory into a CDSL. After a directory has been made a CDSL, you cannot change it back to a regular directory. If a directory contains all member-specific files, make each file a CDSL. This allows shared files to be placed in the directory in a future version.

2.3.2.2    Identifying CDSLs

You can identify a CDSL by the presence of the {memb} variable in its pathname. For example:

lrwxrwxrwx  1   root    system      57 May 19 10:54 /etc/sysconfigtab -> \
    ../cluster/members/{memb}/boot_partition/etc/sysconfigtab
 
 

Note

The backslash ( \ ) character in this example indicates line continuation, and is not present in the actual output.

To resolve a CDSL's pathname, the kernel replaces the {memb} variable with the string memberN, where N is the member ID of the cluster member that is referencing the file. If a cluster member with member ID 2 is accessing the /etc/sysconfigtab file in this example, the pathname is resolved to /cluster/members/member2/boot_partition/etc/sysconfigtab.

Note

Single systems always resolve the {memb} variable to member0.

2.3.2.3    Creating CDSLs

Follow these steps to create CDSLs:

  1. Identify files in your kit that need to be member-specific. Looking at the sample OAT100 product kit source hierarchy shown in Figure 2-3, these member-specific files are odb.conf and odb_log.

  2. Determine the file system where the CDSLs should reside: root, usr, or usr/var. The odb.conf file is in the root file system, and the odb_log file is in the usr/var file system.

  3. Log in as root or use the su command to gain superuser privileges.

  4. Create the necessary parent directories for the CDSLs in your source hierarchy. For example:

    # mkdir -p /mykit/src/opt/OAT100
    # mkdir -p /mykit/src/usr/var/opt/OAT100/log_files
     
     
    

  5. Create the necessary member-specific directories in your source hierarchy. For example:

    # mkdir -p /mykit/src/cluster/members/member0/opt/OAT100
    # mkdir -p /mykit/src/usr/var/cluster/members/member0/opt/OAT100/log_files
     
     
    

  6. Copy member-specific files to the member-specific areas you created in the previous step. For example, if your developer-supplied files are under /mnt, use commands similar to the following:

    # cd /mykit/src/cluster/members/member0/opt/OAT100
    # cp /mnt/opt/OAT100/odb.conf .
    # cd /mykit/src/usr/var/cluster/members/member0/opt/OAT100/log_files
    # cp /mnt/usr/var/opt/OAT100/log_files/odb_log .
    

    Note

    Member-specific files are always shipped in member0.

  7. Use the ln -s command to create the necessary CDSLs in your source hierarchy. For example:

    # cd /mykit/src/opt/OAT100
    # ln -s ../../cluster/members/{memb}/opt/OAT100/odb.conf
    # cd /mykit/src/usr/var/opt/OAT100/log_files
    # ln -s ../../../cluster/members/{memb}/opt/OAT100/log_files/odb_log
    

    Although you created cluster/members/member0 directories, you linked to cluster/members/{memb} directories. When your product kit is installed, this lets the kernel resolve the {memb} variable to memberN, where N is the member ID of the cluster member that is referencing the file. Single systems are always member0.

  8. Use the ls -l command to verify the CDSLs. For example:

    # ls -l /mykit/src/opt/OAT100/odb.conf
    lrwxrwxrwx ...odb.conf -> ../../cluster/members/{memb}/opt/OAT100/odb.conf
    # ls -l /mykit/src/usr/var/opt/OAT100/log_files/odb_log
    lrwxrwxrwx ...odb_log -> \
        ../../../cluster/members/{memb}/opt/OAT100/log_files/odb_log
     
     
    

Caution

Do not use the mkcdsl command to make CDSLs when you are creating product kits.

2.3.2.4    Restrictions

The following restrictions apply when you use CDSLs in product kits:

2.3.3    Placing Files in the Kit Source Directory

Files in the kit source directory hierarchy should match their intended installation location under the root ( / ), /usr, and /var file systems. Plan to install all of your kit files in product-specific subdirectories in the /opt, /usr/opt, and /usr/var/opt directories to prevent name space conflicts with the base operating system and other layered products.

Table 2-1 shows where to place kit files that will be installed in the root ( / ), /usr, and /var file systems:

Table 2-1:  File Locations in Kit Directories

Location in Kit src Directory Installed File System
opt/PRODCODE root ( / )
usr/opt/PRODCODE /usr
usr/var/opt/PRODCODE /usr/var

If you overwrite base operating system files, you may encounter the following problems:

2.3.4    Setting Up the Sample Product Kit Source Directory

Figure 2-3 shows how the Orpheus Document Builder (ODB) product is installed in the standard directory structure, under /opt, /usr/opt, and /usr/var/opt. The directories shown between the src and the OAT* directories are the existing directories on the customer's system. All directories and files created by the product are shipped under the OAT* directories. In this example, directory names begin with OAT because OAT is the three-letter product code assigned to Orpheus Authoring Tools, Inc..

Note

File attributes (ownership and permissions) for files and directories in the kit's source hierarchy must be set exactly as they should be on the customer's system. This means that you must be superuser when populating the source hierarchy so that you can change these file attributes.

Do not attempt to circumvent this requirement by setting file attributes in your subset control programs. If a superuser on the customer's system runs the fverify command on your subsets, attributes that have been modified by the subset control programs are reset to their original values in the kit's master inventory files.

Figure 2-3 shows a sample source directory for the OAT product.

Figure 2-3:  Sample Product Kit Source Directory

The following files have been provided by the ODB developers for the OAT kit. Each of these files has a path and an associated description, and must be placed correctly in the source hierarchy for the OAT product to build successfully.

  1. /odb.conf -- the ODB product configuration file

    If the product kit can be installed on a cluster, each cluster member must have its own copy of the configuration file. To accommodate this requirement, create a context-dependent symbolic link (CDSL) targeted to the member-specific file.

    1. The context-dependent symbolic link (CDSL) for the odb.conf file is linked to the member-specific cluster/members/{memb}/opt/OAT100/odb.conf file. This CDSL is installed in the root file system and placed in the opt/OAT100 source directory.

    2. The member-specific file odb.conf can differ on each cluster member. This file is installed in the cluster member's root file system and is placed in the cluster/members/member0/opt/OAT100 source directory.

    See Section 2.3.2 for information about CDSLs.

  2. /sbin/odb_recover -- a utility to recover corrupt ODB documents when the system boots. The odb_recover script executes when the system boots and the /usr file system may not be mounted.

    This file is installed in the root file system and is placed in the opt/OAT100/sbin source directory.

  3. /usr/bin/odb_start -- the ODB product startup script. The odb_start script is a user command.

    This file is installed in the /usr file system and is placed in the usr/opt/OAT100/bin source directory.

  4. /usr/var/log_files/odb_log -- the ODB product log file

    If the product kit can be installed on a cluster, each cluster member must have its own copy of the log file. To accommodate this requirement, create a context-dependent symbolic link (CDSL) targeted to a member-specific file.

    1. The context-dependent symbolic link (CDSL) for the odb_log file is linked to the member-specific usr/var/cluster/members/{memb}/opt/OAT100/log_files/odb.log file. This CDSL is installed in the /usr/var file system and placed in the usr/var/opt/OAT100/log_files source directory.

    2. The member-specific file odb_log can differ on each cluster member. This file is installed in the cluster member's /usr/var file system and is placed in the /usr/var/cluster/members/member0/opt/OAT100/log_files source directory.

    See Section 2.3.2 for information about CDSLs.

  5. /usr/var/templates/odb_template -- a document template that can be modified by a user.

    This file is installed in the /var file system and is placed in the usr/var/opt/OAT100/templates source directory.

Each of these files will be installed in the path provided by the kit developer. They reside in the same relative location in the kit source directory with opt/OAT100 inserted into the pathname.

For users to make effective use of your product after it is installed, they should add the directories that contain your product commands to the search path in their .profile or .login files. For example, the Orpheus Document Builder (ODB) product is installed in the standard directory structure under /opt, /usr/opt and /usr/var/opt. The src directory mirrors the root ( / ) directory on the customer's system. The commands for the product are located in the /opt/OAT100/sbin and /usr/opt/OAT100/bin directories. To use ODB commands without specifying the full path on the command line, the user can add these directory names to the PATH environment variable.

You can ship a symbolic link to make commands accessible through the standard directories. For example, the ODB kit contains the command /usr/opt/OAT100/bin/odb_start. A symbolic link can be created from /usr/bin/odb_start to /usr/opt/OAT100/bin/odb_start. This also makes the odb_start command available to users as a part of their normal search path, since /usr/bin is part of the standard path.

You can ship a symbolic link only if one of the following conditions apply: