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.

This chapter discusses the following topics:

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.enet.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 illustrates these directory hierarchies.

Figure 2-1:  Kit Directory Hierarchies

The following definitions describe each directory hierarchy:

To create the kit-building directory structure, issue the mkdir command for each required directory, as in the following example:

Example 2-1:  Creating the Kit-Building Directories

# mkdir /mykit
# mkdir /mykit/src
# mkdir /mykit/data
# mkdir /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 kit 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

File placement in a standard directory structure depends upon whether the system has a separate var file system.

Examples in this manual assume that var is not a separate file system, and show the /usr/var/opt directory.

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    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.3    Setting Up the Sample Product Kit Source Directory

Figure 2-2 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..

Caution

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-2 shows a sample source directory for the OAT product.

Figure 2-2:  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. The file paths in the source directory are different from the paths provided by the kit developers to avoid name space conflicts with other products.

  1. /README.odb -- a text file containing general product information

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

  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 tool 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/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.

  5. /usr/var/log_files/odb_log -- the context-dependent symbolic link (CDSL) for the odb_log file.

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

  6. /usr/var/cluster/members/member0/log_files/odb_log -- the file listing all of the ODB documents created by a user. The odb_log file can be modified by users.

    This file is installed in the /usr/var file system and is placed in the usr/var/cluster/members/member0/opt/OAT100/log_files 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 would make the odb_start command available to the user 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:

2.3.4    Using Context-Dependent Symbolic Links

If you are preparing a product kit that may run on a cluster, you need to use a context-dependent symbolic link (CDSL) to a member-specific file instead of using a shared file in your product kit's inventory.

This section provides the following information:

2.3.4.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. Once a directory is a CDSL you cannot change it back to a regular directory. If a directory contains all member-specific files, make each file a CDSL.

2.3.4.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.

2.3.4.3    Creating CDSLs

Follow these steps to create CDSLs:

  1. Determine the file system where the CDSLs should reside: root ( / ), /usr, or /usr/var.

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

  3. Use the mkdir command to create the member-specific directories for each file system. For example, if you are building the OAT100 kit in the /mykit directory, enter the following commands for the root ( / ), /usr, and /usr/var file systems:

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

  4. Copy the odb_log file to the member-specific area. Refer to the sample OAT100 product kit source directory shown in Figure 2-2.

  5. Use the ln -s command to create the CDSLs in the shared file locations. Specify relative pathnames, as shown in the following example:

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

    Note

    In the previous step, you created member specific files in the cluster/members/member0 directory, but in this step you created symbolic links to the cluster/members/{memb} directories. When your product kit is installed on a cluster, this allows the kernel to resolve the {memb} variable to memberN, where N is the member ID of the cluster member that is referencing the file.

  6. Use the ls -l command to verify the symbolic link, as shown in the following example:

    # ls -l odb_log
    lrwxrwxrwx  1 root  system    36 May 19 15:46 odb_log@ -> \
      ../../../cluster/members/member0/opt/OAT100/log_files/odb_log
     
     
    

    Note

    The backslash ( \ ) character shows line continuation and is not present in the actual output.

2.3.4.4    Restrictions

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

  1. If you are preparing a product kit to run on a version of the operating system prior to Version 5.0, you cannot use CDSLs.

  2. If you are creating a product kit on a system that is running a version of the operating system prior to Version 5.0, you can use CDSLs in your product kit but you must test it on a system running Version 5.0 or higher of the operating system.

  3. If you are creating a product kit on a system that is a cluster member running Version 5.0 or higher of the operating system, CDSLs cannot be resolved to the member-specific areas in the cluster/members/member0 directories. The kernel resolves {memb} link to the cluster ID of the member where you are creating the kit, memberN.