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.
This case study shows examples of the following techniques:
To set up selective installation, you must:
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.
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.
These variables will be set by the request script to the value which the installer provides. pkgadd(ADM) 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.
The request script for this package asks two questions:
When the answer is yes, then the appropriate class name is added to the CLASSES parameter. For example, when the question ``Should the manual pages associated with this package be installed'' is answered yes, the class man is added to the CLASSES parameter.
The appropriate variable is given the value of the response to this question. In the manual page example, the variable $NCMPMAN is set to this value.
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(ADM) 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.
PKG='ncmp' NAME='NCMP Utilities' CATEGORY='applications,tools' ARCH='3b2' VERSION='Release 1.0, Issue 1.0' CLASSES=''
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
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' !