- determine type and capability of target
/usr/bin/pkgcond [-nv] condition
The pkgcond command allows you to determine the type of target being operated on (global zone, non-global zone, diskless client, and so forth) and the capabilities available for that type of client (can add a driver, path is writable, and so forth). The pkgcond command is intended to be invoked from package and patch scripts, but can also be used in situations that mimic the context of these scripts. See NOTES for further guidance.
pkgcond has one mandatory argument, a condition. The command tests whether the condition is true for the specified path. The condition can be one of the following:
The path argument usually denotes the root of the global zone or non-global zone, or alternate root. If path is optional and not specified, the default is /.
The behavior of the is_what condition is somewhat special, because it displays results of all other conditions to standard output.
The following options are supported:
Negate return status (0 becomes 1 and 1 becomes 0). It negates results in the case of is_what condition.
Verbose mode. Displays detailed data about intermediate checks performed.
Example 1 Listing All Available Information
The following command lists all available information about the current running system, in a user-friendly way.
example# pkgcond -n is_what
Example 2 Determining if Target is an Alternate Root
The following command determines whether an alternate boot environment exists under /altroot_mount.
example# pkgcond is_alternative_root /altroot_mount
Condition is true unless -n was specified.
Condition is false unless -n was specified.
Command line usage error.
Command failed to perform the test due to a fatal error.
See attributes(5) for descriptions of the following attributes:
Supported usage of pkgcond is subject to the following constraints:
Do not use pkgcond outside of the Solaris marketing release in which it is provided (for example, do not use Solaris 10 pkgcond against a Solaris 9 target).
Restrict use of the optional path argument according to the following rules:
The command pkgcond condition $ROOTDIR can be used in patch level scripts.
The command pkgcond condition $PKG_INSTALL_ROOT can be used in package level scripts.
A command of the form pkgcond condition without the optional path argument can be used in any context.
Use of pkgcond with an arbitrary path argument is not recommended or supported, as the results returned might not be accurate.