Go to main content

man pages section 8: System Administration Commands

Exit Print View

Updated: Thursday, June 13, 2019
 
 

pkgcond(8)

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 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:

  • can_add_driver [path]

  • can_remove_driver [path]

  • can_update_driver [path]

  • is_alternative_root [path]

  • is_boot_environment [path]

  • is_diskless_client [path]

  • is_global_zone [path]

  • is_mounted_miniroot [path]

  • is_netinstall_image [path]

  • is_nonglobal_zone [path]

  • is_path_writable path

  • is_running_system [path]

  • is_sparse_root_nonglobal_zone [path]

  • is_what [path]

  • is_whole_root_nonglobal_zone [path]

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.

Options

The following options are supported:

–n

Negate return status (0 becomes 1 and 1 becomes 0). It negates 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 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

Exit Status

0

Condition is true unless –n was specified.

1

Condition 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(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
package/svr4
Interface Stability
Uncommitted

See Also

pkgtrans(1), pkginfo(5), attributes(7), pkgadd(8), pkgask(8), pkgchk(8), pkgrm(8)

Notes

Supported usage of pkgcond is subject to the following constraints:

  1. 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).

  2. 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.