Solaris Advanced Installation Guide

Adding Packages and Patches

You can create a finish script to automatically add packages and patches after Solaris is installed on a system. This will not only save you time, but it can ensure consistency on what packages and patches are installed on various systems at your site. When using the pkgadd(1M) or patchadd(1M) commands in your finish scripts, you should use the -R option to specify /a as the root path.

Example 9-1 provides an example finish script to add packages.


Example 9-1 Adding Packages With a Finish Script

	#!/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, patchadd(1M), to force the pkgadd(1M) command
not to perform checks (and prompt for questions) when installing a package.
This enables you to maintain a hand-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. Although this is not recommended, there may be some packages or patches that will not work with the -R option. In those instances, you must create a fake /etc/mnttab file in the /a root path before using the chroot command. The easiest way to do this is to add the following line to your finish script.


cp /etc/mnttab /a/etc/mnttab