System Administration Commands pkgcond(1M)
NAME
pkgcond - determine type and capability of target
SYNOPSIS
/usr/bin/pkgcond [-nv] condition
DESCRIPTION
The pkgcond command allows you to determine the type of tar-
get being operated on (global zone, non-global zone, disk-
less 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:o can_add_driver [path]
o can_remove_driver [path]
o can_update_driver [path]
o is_alternative_root [path]
o is_boot_environment [path]
o is_diskless_client [path]
o is_global_zone [path]
o is_mounted_miniroot [path]
o is_netinstall_image [path]
o is_nonglobal_zone [path]
o is_path_writable path
o is_running_system [path]
o is_sparse_root_nonglobal_zone [path]
o is_what [path]
o is_whole_root_nonglobal_zone [path]
SunOS 5.11 Last change: 20 Oct 2009 1
System Administration Commands pkgcond(1M)
The path argument usually denotes the root of the globalzone 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 stan-
dard output. OPTIONS The following options are supported:-n
Negate return status (0 becomes 1 and 1 becomes 0). Itnegates results in the case of is_what condition.
-v
Verbose mode. Displays detailed data about intermediate checks performed.EXAMPLES
Example 1 Listing All Available Information The following command lists all available information aboutthe 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 bootenvironment exists under /altroot_mount.
example# pkgcond is_alternative_root /altroot_mount
EXIT STATUS 0Condition is true unless -n was specified.
SunOS 5.11 Last change: 20 Oct 2009 2
System Administration Commands pkgcond(1M)
1Condition is false unless -n was specified.
2 Command line usage error. 3 Command failed to perform the test due to a fatal error.ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Availability | SUNWcs ||_____________________________|_____________________________|
| Interface Stability | Uncommitted ||_____________________________|_____________________________|
SEE ALSO
pkgtrans(1), pkgadd(1M), pkgask(1M), pkgchk(1M), pkgrm(1M), pkginfo(4), attributes(5) NOTESSupported usage of pkgcond is subject to the following con-
straints:1. Do not use pkgcond outside of the Solaris marketing
release in which it is provided (for example, donot use Solaris 10 pkgcond against a Solaris 9 tar-
get).2. Restrict use of the optional path argument accord-
ing to the following rules:o The command pkgcond condition $ROOTDIR can be
used in patch level scripts.o The command pkgcond condition $PKG_INSTALL_ROOT
can be used in package level scripts.SunOS 5.11 Last change: 20 Oct 2009 3
System Administration Commands pkgcond(1M)
o 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 recom-
mended or supported, as the results returned might not be accurate.SunOS 5.11 Last change: 20 Oct 2009 4