You can create a finish script to automatically add packages or patches after Solaris is installed on a system. Adding packages in this way not only saves time, but ensures consistency in what packages and patches are installed on different systems at your site.
When using the pkgadd(1M) or patchadd(1M) commands in your finish scripts, use the -R option to specify /a as the root path.
Example 7-1 shows an example of a finish script that adds packages.
#!/bin/sh BASE=/a MNT=/a/mnt ADMIN_FILE=/a/tmp/admin mkdir ${MNT} [Mounts a directory on a server that contains the package to install.] mount -f nfs sherlock:/export/package ${MNT} [Creates a temporary package administration file, admin, to force the pkgadd(1M) command not to perform checks (and prompt for questions) when installing a package. This enables you to maintain a hands-off installation when you are adding packages.] cat >${ADMIN_FILE} <<DONT_ASK mail=root instance=overwrite partial=nocheck runlevel=nocheck idepend=nocheck rdepend=nocheck space=ask setuid=nocheck conflict=nocheck action=nocheck basedir=default DONT_ASK [Adds the package by using the -a option (specifying the package administration file) and the -R option (specifying the root path).] /usr/sbin/pkgadd -a ${ADMIN_FILE} -d ${MNT} -R ${BASE} SUNWxyz umount ${MNT} rmdir ${MNT} |
In the past, the chroot(1M) command was used with the pkgadd and patchadd commands in the finish script environment. In the rare instances in which 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