DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Packaging your software applications

1. Selective installation

This package has three types of objects. The installer chooses which of the three types to install and where to locate the objects on the installation machine.

Techniques

This case study shows examples of the following techniques:

Approach

To set up selective installation, you must:

  1. Define a class for each type of object which can be installed.

    In this case study, the three object types are the package executables, the manual pages, and the emacs executables. Each type has its own class: bin, man, and emacs, respectively. Notice in the example prototype file that all of the object files belong to one of these three classes.

  2. Initialize the CLASSES parameter in the pkginfo(4) file as null.

    Normally when you define a class, you want the CLASSES parameter to list all classes that will be installed. Otherwise, no objects in that class will be installed. For this example, the parameter is initially set to null. CLASSES will be given values by the request script based on the package pieces chosen by the installer. This way, CLASSES is set to only those object types that the installer wants installed. For an example, see the sample pkginfo file associated with this package. Notice that the CLASSES parameter is set to null.

  3. Define object pathnames in the prototype(4) file with variables.

    These variables will be set by the request script to the value which the installer provides. pkgadd(1M) resolves these variables at installation time and so knows where to install the package.

    The three variables used in this example are:

    Look at the example prototype file to see how to define the object pathnames with variables.

  4. Create a request script to ask the installer which parts of the package should be installed and where they should be placed.

    The request script for this package asks two questions:

    These two questions are repeated for each of the three object types.

    At the end of the request script, the parameters are made available to the installation environment for pkgadd(1M) and any other packaging scripts. In the case of this example, no other scripts are provided.

    When looking at the request script for this example, notice that the questions are generated by the data validation tools ckyorn and ckpath.

pkginfo file

   PKG='ncmp'
   NAME='NCMP Utilities'
   CATEGORY='applications,tools'
   ARCH='3b2'
   VERSION='Release 1.0, Issue 1.0'
   CLASSES=''

prototype file

   i pkginfo
   i request
   x bin $NCMPBIN 0755 root other
   f bin $NCMPBIN/dired=/usr/ncmp/bin/dired 0755 root other
   f bin $NCMPBIN/less=/usr/ncmp/bin/less 0755 root other
   f bin $NCMPBIN/ttype=/usr/ncmp/bin/ttype 0755 root other
   f emacs $NCMPBIN/emacs=/usr/ncmp/bin/emacs 0755 root other
   x emacs $EMACS 0755 root other
   f emacs $EMACS/ansii=/usr/ncmp/lib/emacs/macros/ansii 0644 root other
   f emacs $EMACS/box=/usr/ncmp/lib/emacs/macros/box 0644 root other
   f emacs $EMACS/crypt=/usr/ncmp/lib/emacs/macros/crypt 0644 root other
   f emacs $EMACS/draw=/usr/ncmp/lib/emacs/macros/draw 0644 root other
   f emacs $EMACS/mail=/usr/ncmp/lib/emacs/macros/mail 0644 root other
   f emacs $NCMPMAN/man1/emacs.1=/usr/ncmp/man/man1/emacs.1 0644 root other
   d man $NCMPMAN 0755 root other
   d man $NCMPMAN/man1 0755 root other
   f man $NCMPMAN/man1/dired.1=/usr/ncmp/man/man1/dired.1 0644 root other
   f man $NCMPMAN/man1/ttype.1=/usr/ncmp/man/man1/ttype.1 0644 root other
   f man $NCMPMAN/man1/less.1=/usr/ncmp/man/man1/less.1 0644 inixmr other

request script

   trap 'exit 3' 15
   

# determine if and where general executables should be placed ans=`ckyorn -d y \ -p "Should executables included in this package be installed" ` || exit $? if [ "$ans" = y ] then CLASSES="$CLASSES bin" NCMPBIN=`ckpath -d /usr/ncmp/bin -aoy \ -p "Where should executables be installed" ` || exit $? fi

# determine if emacs editor should be installed, and if it should # where should the associated macros be placed ans=`ckyorn -d y \ -p "Should emacs editor included in this package be installed" ` || exit $? if [ "$ans" = y ] then CLASSES="$CLASSES emacs" EMACS=`ckpath -d /usr/ncmp/lib/emacs -aoy \ -p "Where should emacs macros be installed" ` || exit $? fi

# determine if and where manual pages should be installed ans=`ckyorn \ -d y \ -p "Should manual pages associated with this package be installed" ` || exit $? if [ "$ans" = y ] then CLASSES="$CLASSES man" NCMPMAN=`ckpath -d /usr/ncmp/man -aoy \ -p "Where should manual pages be installed" ` || exit $? fi

# make parameters available to installation service, # and so to any other packaging scripts cat >$1 <<! CLASSES='$CLASSES' NCMPBIN='$NCMPBIN' EMACS='$EMACS' NCMPMAN='$NCMPMAN' !

exit 0


Next topic: 2. Device driver installation
Previous topic: Case studies of package installation

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004