アプリケーションパッケージ開発者ガイド

管理者による入力の要求

このケーススタディーで使用するパッケージには、3 種類のオブジェクトがあります。インストールするオブジェクトの種類と、インストール先マシン内でオブジェクトを配置する場所は、管理者が選択できます。

手法

このケーススタディーでは、次の手法の実例を示します。

アプローチ

このケーススタディーで選択的インストールを設定するには、次の作業を完了する必要があります。

ケーススタディーで使用するファイル

pkginfo ファイル

PKG=ncmp
NAME=NCMP Utilities
CATEGORY=application, tools
BASEDIR=/
ARCH=SPARC
VERSION=RELEASE 1.0, Issue 1.0
CLASSES=""
NCMPBIN=/bin
NCMPMAN=/usr/man
EMACS=/usr/emacs

prototype ファイル

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 スクリプト

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

request スクリプトは、ファイルシステム上にファイルを残さずに終了できます。Solaris バージョン 2.5 よりも前のバージョンおよび互換バージョンでインストールを行う場合、checkinstall スクリプトが使用されていない可能性があるので、request スクリプトを使用してファイルシステムのテストを行い、インストールの成功を確認することをお勧めします。request スクリプトがコード 1 で終了すると、インストールはクリーンに終了します。

これらのファイル例では、パラメータ型パスを使用して複数のベースディレクトリを確立する方法が示されています。しかし、pkgadd コマンドによって管理および検証される BASEDIR パラメータを使用する必要が生じる場合もあります。複数のベースディレクトリを使用する際には、同じプラットフォームに複数のバージョンやアーキテクチャーをインストールする場合に備えて、特別な注意を払う必要があります。