手册页部分 1M: 系统管理命令

退出打印视图

更新时间: 2014 年 7 月
 
 

pkgcond(1M)

名称

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

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

选项

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.

示例

示例 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
示例 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

退出状态

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.

属性

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/core-os
Interface Stability
Uncommitted

另请参见

pkgtrans(1), pkgadd(1M), pkgask(1M), pkgchk(1M), pkgrm(1M), pkginfo(4), attributes(5)

附注

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.