HPlogo HP-UX Reference Volume 2 of 5 > s

swmodify(1M)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

swmodify — modify software products in a target root or depot

SYNOPSIS

swmodify [-d|-r] [-p] [-u] [-v] [-V] [-a attribute=[value]] [-C session_file] [-f software_file] [-P pathname_file] [-s product_specification_file| [-S session_file] [-x option=value] [-X option_file] [software_selections] [@ target_selection]

Remarks

  • SD-UX commands are included with the HP-UX operating system and manage software on the local host only.

  • To install and manage software simultaneously on multiple remote hosts (including HP-UX, other UNIX® platforms, Windows NT®, and PCs) from a central controller, you must purchase the HP OpenView Software Distributor which provides extended software management capabilities. Information specific only to the OpenView product is marked with a heading similar to the following:

    • The following applies only to HP OpenView Software Distributor.

DESCRIPTION

The swmodify command modifies the definitions of software objects installed into a primary or alternate root, or available from a software depot. It supports the following features:

  • adding new objects - The user can add new bundles, products, subproducts, filesets, control files, and files to existing objects (which will contain them).

  • deleting existing objects - The user can delete existing bundles, products, subproducts, filesets, control files, and files from the objects which contain them.

  • modifying attribute values - The user can add an attribute, delete an attribute, or change the existing value of an attribute for any existing object. When adding a new object, the user can at the same time define attributes for it.

  • committing software patches - The user can remove saved backup files, committing the software patch.

With the exception of control files, swmodify does not manipulate the actual files that make up a product (fileset). The command manipulates the catalog information which describes the files. However, swmodify can replace the contents of control files.

Common uses of swmodify include:

  • adding file definitions to the existing list of file definitions in a fileset. Example: If a fileset's control scripts add new files to the installed file system, the scripts can call swmodify to "make a record" of those new files.

  • changing the values of existing attributes. Example: If a product provides a more complex configuration process (beyond the SD configure script), that script can set the fileset's state to CONFIGURED upon successful execution.

  • defining new objects. Example: to "import" the definition of an existing application that was not installed by SD, construct a simple PSF describing the product. Then invoke swmodify to load the definition of the existing application into the IPD.

Options

swmodify supports the following options:

-d

Perform modifications on a depot (not on a primary or alternate root). The given target_selection must be a depot.

-p

Preview a modify session without modifying anything within the target_selection.

-r

Perform modifications on an alternate root (and not the primary root, /). The given target_selection must be an alternate root.)

-u

If no -a attribute=value options are specified, then delete the given software_selections from within the given target_selection. This action deletes the definitions of the software objects from the depot catalog or installed products database.

If -a attribute options are specified, then delete these attribute definitions from the given software_selections (from within the given target_selection).

-v

Turn on verbose output to stdout.

-V

List all the SD layout_versions this command supports.

-a attribute[=value]

Add, modify, or delete the value of the given attribute. If the -u option is specified, then delete the attribute from the given software_selections (or delete the value from the set of values currently defined for the attribute). Otherwise add/modify the attribute for each software_selection by setting it to the given value.

Multiple -a options can be specified. Each attribute modification will be applied to every software_selection.

The -s and -a options are mutually exclusive, the -s option cannot be specified when the -a option is specified.

-C session_file

Save the current options and operands to session_file. You can enter a relative or absolute path with the file name. The default directory for session files is $HOME/.sw/sessions/. You can recall a session file with the -S option.

-f software_file

Read the list of software_selections from software_file instead of (or in addition to) the command line.

-P pathname_file

Specify a file containing the pathnames of files being added to or deleted from the IPD instead of having to specify them individually on the command line.

-s product_specification_file

The source Product Specification File (PSF) describes the product, subproduct, fileset, and/or file definitions which will be added or modified by swmodify.

The -s and -u options are mutually exclusive, the -s option cannot be specified when the -u option is specified.

-S session_file

Execute swmodify based on the options and operands saved from a previous session, as defined in session_file. You can save session information to a file with the -C option.

-x option=value

Set the session option to value and override the default value (or a value in an alternate options_file specified with the -X option). Multiple -x options can be specified.

-X option_file

Read the session options and behaviors from options_file.

Operands

The swmodify command supports two types of operands: software selections followed by target selections. These operands are separated by the "@" (at) character. This syntax implies that the command operates on "selections at targets".

Software Selections

The selections operands consist of software_selections.

swmodify supports the following syntax for each software_selection:

bundle[.product[.subproduct][.fileset]][,version] product[.subproduct][.fileset][,version]

The version component has the form:

[,r <op> revision][,a <op> arch][,v <op> vendor] [,c <op> category][,l=location][,fr <op> revision] [,fa <op> arch]

  • location applies only to installed software and refers to software installed to a location other than the default product directory.

  • fr and fa apply only to filesets.

  • The <op> (relational operator) component can be of the form:

    • ==, >=, <=, <, >, or !=

    which performs individual comparisons on dot-separated fields.

    For example, r>=B.10.00 chooses all revisions greater than or equal to B.10.00. The system compares each dot-separated field to find matches.

  • The = (equals) relational operator lets you specify selections with the shell wildcard and pattern-matching notations:

    • [ ], *, ?, !

    For example, the expression r=1[01].* returns any revision in version 10 or version 11.

  • All version components are repeatable within a single specification (e.g. r>=A.12, r<A.20). If multiple components are used, the selection must match all components.

  • Fully qualified software specs include the r=, a=, and v= version components even if they contain empty strings. For installed software, l= is also included.

  • No space or tab characters are allowed in a software selection.

  • The software instance_id can take the place of the version component. It has the form:

    • [instance_id]

    within the context of an exported catalog, where instance_id is an integer that distinguishes versions of products and bundles with the same tag.

The \* software specification selects all products. It is not allowed when removing software from the root directory /.

If a product_specification_file is specified, swmodify will select the software_selections from the full set defined within the PSF. The software selected from a PSF is then applied to the target_selection, with the selected software objects either added to it or modified within it. If a PSF is not specified, swmodify will select the software_selections from the software defined in the given (or default) target_selection.

Target Selection

The swmodify command supports the specification of a single, local target_selection, using the syntax:

[ @ /directory]

When operating on the primary root, no target_selection needs to be specified. (The target / is assumed.) When operating on a software depot, the target_selection specifies the path to that depot. If the -d option is specified and no target_selection is specified, the default distribution_target_directory is assumed (see below).

EXTERNAL INFLUENCES

Default Options

In addition to the standard options, several SD behaviors and policy options can be changed by editing the default values found in:

/var/adm/sw/defaults

the system-wide default values.

$HOME/.swdefaults

the user-specific default values.

Values must be specified in the defaults file using this syntax:

[command_name.]option=value

The optional command_name prefix denotes one of the SD commands. Using the prefix limits the change in the default value to that command. If you leave the prefix off, the change applies to all commands.

You can also override default values from the command line with the -x or -X options:

command -x option=value command -X option_file

The following keywords are supported by swmodify. If a default value exists, it is listed after the "=". The commands that this option applies to are also specified. The policy options that apply to swmodify are:

control_files=

When adding or deleting control file objects, this option lists the tags of those control files. There is no supplied default. If there is more than one tag, they must be separated by white space and surrounded by quotes.

distribution_target_directory=/var/spool/sw

Defines the default distribution directory of the target depot. The target_selection operand overrides this default.

files=

When adding or deleting file objects, this option lists the pathnames of those file objects. There is no supplied default. If there is more than one pathname, they must be separated by white space.

layout_version=1.0

Specifies the POSIX layout_version to which the SD commands conform when writing distributions and swlist output. Supported values are "1.0" (default) and "0.8".

SD object and attribute syntax conforms to the layout_version 1.0 specification of the IEEE POSIX 1387.2 Software Administration standard. SD commands still accept the keyword names associated with the older layout version, but you should use layout_version=0.8 only to create distributions readable by older versions of SD.

See the description of the layout_version option in sd(5) for more information.

logdetail=false

The logdetail option controls the amount of detail written to the log file. When set to true, this option adds detailed task information (such as options specified, progress statements, and additional summary information) to the log file. This information is in addition to log information controlled by the loglevel option.

logfile=/var/adm/sw/sw<modify>.log

Defines the default log file for swmodify.

loglevel=1

Controls the log level for the events logged to the swmodify logfile, the target agent logfile, and the source agent logfile. This information is in addition to the detail controlled by the logdetail option. See logdetail for more information.

A value of

0

provides no information to the log files.

1

enables verbose logging to the log files.

2

enables very verbose logging to the log files.

patch_commit=false

Commits a patch by removing files saved for patch rollback. When set to true, you cannot roll back (remove) a patch unless you remove the associated base software that the patch modified.

software=

Defines the default software_selections. There is no supplied default. If there is more than one software selection, they must be separated by spaces. Software is usually specified in a software input file, as operands on the command line, or in the GUI.

source_file=

Defines the default location of the source product specification file (PSF). The host:path syntax is not allowed, only a valid path can be specified. The -s option overrides this value.

targets=

Defines the default target_selections. There is no supplied default (see select_local above). If there is more than one target selection, they must be separated by spaces. Targets are usually specified in a target input file, as operands on the command line, or in the GUI.

verbose=1

Controls the verbosity of a non-interactive command's output:

0

disables output to stdout. (Error and warning messages are always written to stderr).

1

enables verbose messaging to stdout.

2

for swmodify, enables very verbose messaging to stdout.

Session File

Each invocation of the swmodify command defines a modify session. The invocation options, source information, software selections, and target hosts are saved before the installation or copy task actually commences. This lets you re-execute the command even if the session ends before proper completion.

Each session is automatically saved to the file $HOME/.sw/sessions/swmodify.last. This file is overwritten by each invocation of swmodify.

You can also save session information to a specific file by executing swmodify with the -C session__file option.

A session file uses the same syntax as the defaults files. You can specify an absolute path for the session file. If you do not specify a directory, the default location for a session file is $HOME/.sw/sessions/.

To re-execute a session file, specify the session file as the argument for the -S session__file option of swmodify. See the swpackage(4) by typing man 4 swpackage for PSF syntax.

Note that when you re-execute a session file, the values in the session file take precedence over values in the system defaults file. Likewise, any command line options or parameters that you specify when you invoke swmodify take precedence over the values in the session file.

Environment Variables

The environment variable that affects swmodify is:

LANG

Determines the language in which messages are displayed. If LANG is not specified or is set to the empty string, a default value of C is used. See the lang(5) man page by typing man 5 lang for more information.

NOTE: The language in which the SD agent and daemon log messages are displayed is set by the system configuration variable script, /etc/rc.config.d/LANG. For example, /etc/rc.config.d/LANG, must be set to LANG=ja_JP.SJIS or LANG=ja_JP.eucJP to make the agent and daemon log messages display in Japanese.

Signals

The swmodify command ignores SIGHUP, SIGTERM, SIGUSR1, and SIGUSR2. The swmodify command catches SIGINT and SIGQUIT. If these signals are received, swmodify prints a message and then exits. During the actual database modifications, swmodify blocks these signals (to prevent any data base corruption). All other signals result in their default action being performed.

RETURN VALUES

The swmodify command returns:

0

The add, modify, or delete operation(s) were successfully performed on the given software_selections.

1

An error occurred during the session (e.g. bad syntax in the PSF, invalid software_selection, etc.) Review stderr or the logfile for details.

DIAGNOSTICS

The swmodify command writes to stdout, stderr, and to specific logfiles.

Standard Output

In verbose mode, the swmodify command writes messages for significant events. These include:

  • a begin and end session message,

  • selection, analysis, and execution task messages.

Standard Error

The swmodify command also writes messages for all WARNING and ERROR conditions to stderr.

Logfile

The swmodify command logs events to the command logfile and to the swmodify logfile associated with each target_selection.

Command Log

The swmodify command logs all messages to the the logfile /var/adm/sw/swmodify.log. (The user can specify a different logfile by modifying the logfile option.)

Target Log

When modifying installed software, swmodify logs messages to the file var/adm/sw/swagent.log beneath the root directory (e.g. / or an alternate root directory). When modifying available software (within a depot), swmodify logs messages to the file swagent.log beneath the depot directory (e.g. /var/spool/sw).

EXAMPLES

Add additional files to an existing fileset:

swmodify -xfiles='/tmp/a /tmp/b /tmp/c' PRODUCT.FILESET

Replace the definitions of existing files in an existing fileset (e.g. to update current values for the files' attributes):

chown root /tmp/a /tmp/b swmodify -x files='/tmp/a /tmp/b' PRODUCT.FILESET

Delete control files from a fileset in an existing depot:

swmodify -d -u -x control_files='checkinstall subscript' \ PRODUCT.FILESET @ /var/spool/sw

Create a new fileset definition where the description is contained in the PSF file new_fileset_definition:

swmodify -s new_fileset_definition

Delete an obsolete fileset definition:

swmodify -u PRODUCT.FILESET

Commit a patch (remove files saved for patch rollback):

swmodify -x patch_commit=true PATCH

Create some new bundle definitions for products in an existing depot:

  • swmodify -d -s new_bundle_definitions \* @ /mfg/master_depot

Modify the values of some fileset's attributes:

swmodify -a state=installed PRODUCT.FILESET

Modify the attributes of a depot:

swmodify -a title='Manufacturing's master depot' \ -a description=</tmp/mfg.description @ /mfg/master_depot

WARNINGS

If the target_selection is a software depot and you delete file definitions from the given software_selections, the files' contents are not deleted from the depot.

LIMITATIONS

The following applies only to HP OpenView Software Distributor.

The swmodify command does not apply to PC software.

FILES

$HOME/.swdefaults

Contains the user-specific default values for some or all SD options.

$HOME/.sw/sessions/

Contains session files automatically saved by the SD commands, or explicitly saved by the user.

/usr/lib/sw/sys.defaults

Contains the master list of current SD options (with their default values).

/var/adm/sw/

The directory which contains all of the configurable (and non-configurable) data for SD. This directory is also the default location of logfiles.

/var/adm/sw/defaults

Contains the active system-wide default values for some or all SD options.

/var/adm/sw/products/

The Installed Products Database (IPD), a catalog of all products installed on a system.

/var/spool/sw/

The default location of a target software depot.

AUTHOR

swmodify was developed by the Hewlett-Packard Company.

SEE ALSO

sd(4), sd(5), swacl(1M), swagentd(1M), swask(1M), swconfig(1M), swgettools(1M), swinstall(1M), swjob(1M), swlist(1M), swpackage(1M), swpackage(4), swreg(1M), swremove(1M), swverify(1M), the Managing HP-UX Software with SD-UX manual, the HP OpenView Software Distributor Administrator's Guide.

© Hewlett-Packard Development Company, L.P.