You can create a finish script to automatically add packages or patches after the Solaris software is installed on a system. By adding packages with a finish script, you reduce time and ensure consistency in what packages and patches are installed on different systems at your site.
When you use the pkgadd(1M) or patchadd(1M) commands in finish scripts, use the -R option to specify /a as the root path.
Example 24-2 shows an example of a finish script that adds packages.
#!/bin/sh
BASE=/a
MNT=/a/mnt
ADMIN_FILE=/a/tmp/admin
mkdir ${MNT}
mount -f nfs sherlock:/export/package ${MNT}1
cat >${ADMIN_FILE} <<DONT_ASK2
mail=root
instance=overwrite
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=ask
setuid=nocheck
conflict=nocheck
action=nocheck
basedir=default
DONT_ASK
/usr/sbin/pkgadd -a ${ADMIN_FILE} -d ${MNT} -R ${BASE} SUNWxyz3
umount ${MNT}
rmdir ${MNT}
|
Mounts a directory on a server that contains the package to install.
Creates a temporary package administration file, admin, to force the pkgadd(1M) command not to perform checks or prompt for questions when installing a package. Use the temporary package administration file to maintain a hands-off installation when you are adding packages.
Adds the package by using the -a option, specifying the package administration file, and the -R option, specifying the root path.
In the past, the chroot(1M) command was used with the pkgadd and patchadd commands in the finish script environment. In rare instances, some packages or patches do not work with the -R option. You must create a dummy /etc/mnttab file in the /a root path before issuing the chroot command.
To create a dummy /etc/mnttab file, add the following line to your finish script:
cp /etc/mnttab /a/etc/mnttab