swpackage(1M) — Hewlett-Packard Company
NAME
swpackage − Package software products into a target depot or tape
For a description of the Product Specification File used as input to the swpackage command, see the swpackage(4) manual page by typing:
man 4 swpackage
SYNOPSIS
swpackage [-p] [-v[v]] [-V] [-s product_specification_file|directory] [-d directory|device]
[-x option=value] [-X option_file] [-f software_file] [-C session_file] [-S session_file]
[software_selections] [ @ target_selection]
DESCRIPTION
The swpackage command is not distributed; it only operates on the local host. It packages software products into:
• a distribution directory (which can be accessed directly, or copied onto a CD-ROM),
• a distribution tape (such as DDS, nine-track or cartridge tapes).
A software product is organized into a three-level hierarchy: products, subproducts, and filesets. The actual files that make up a product are packaged into filesets. Subproducts can be used to partition or subset the filesets into logical groupings. (Subproducts are optional.) A product, subproduct, and fileset also have attributes associated with them.
Both directory and tape distributions use the same format. The swpackage command:
• Organizes the software to be packaged into products, subproducts, and filesets,
• Provides flexible mechanisms to package source files into filesets,
• Modifies existing products in a distribution directory,
• Repackages products in a distribution directory into a distribution tape.
Both the swpackage and swcopy commands create or modify a target depot. The differences between these commands are:
• The swcopy command copies products from an existing depot to another depot. The swpackage command creates products based on the user’s specification, and packages these products into a depot.
• swpackage can be used to re-package software_selections from an existing distribution directory to a distribution tape.
• The swcopy command can copy from a local or remote source to a set of local or remote targets. The swpackage command packages source files from the local filesystem into a product, for insertion into a local distribution directory or tape.
• After creating a target depot, swcopy registers that directory with the local swagentd so that it can be found by swlist, swinstall, etc. With swpackage, the depot is not registered; the user must explicitly invoke the swreg command.
The swpackage and other SD commands can create distributions that conform to layout_version=1.0 of the POSIX 1387.2 Software Administration standard. The previous SD layout_version=0.8 is also supported. What layout_version the SD commands write is controlled by the layout_version option for swpackage, swmodify, swcopy, and swlist. The version of the parser used by swpackage can be controlled by specifying the layout_version attribute in the PSF file.
Options
swpackage supports the following options:
-p Previews a package session without actually creating or modifying the directory (tape).
-v[v]
Turns on verbose output to stdout. (The swpackage logfile is not affected by this option.) A second -v will turn on very verbose output. Verbose output is enable by default, see the verbose option below.
-V List the SD data model revision(s) which swpackage supports. By default, swpackage always packages using the latest SDU data model revision.
-s product_specification_file|directory
The source Product Specification File (PSF) describes the product, subproduct, fileset, and file definitions used to build a software product from a set of source files.
The source can also be an existing directory depot (which already contains products).
-d directory|device
If creating a distribution directory, this option defines the pathname of the directory. If creating a distribution tape, this option defines the device file on which to write the distribution. When creating a distribution tape, the tape device (file) must exist, and the -x target_type=tape option must be specified (see below).
Note that the -d option is obsolete. Use the @ target_selection operand instead.
You can also specify that the swpackage output be "piped" to an external command using:
swpackage -d "| <command>"-x target_type=tape-s <source>
The | symbol and command must be quoted because it is interpreted by swpackage and not the shell.
-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.
-f software_file
Read the list of software_selections from software_file instead of (or in addition to) the command line.
-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 /.sw/sessions/. You can recall a session file with the -S option.
-S session_file
Execute swpackage 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.
Operands
The swpackage command supports the following syntax for each software_selection:
bundle[.product[.subproduct][.fileset]][,version]
or
product[.subproduct][.fileset][,version]
The version component has the form:
[,r <op> revision][,a <op> arch][,v <op> vendor][,c <op> category]
or
[instance_id]
where <op> can be: ==, >=, <=, <, >, or != which performs individual comparisons on dot-separated fields. For example, r>=BB.10.00 means choose all revisions that are greater than or equal to BB.10.00. The system will compare each dot-separated field to find matches. Software will only be selected when matches within each field are satisfied. Wildcards are not allowed with these operators.
The = (equals) relational operator is also allowed. It provides the shell pattern matching notations []*?! or wildcards to specify selections as opposed to comparing dot-separated fields.
All version components are repeatable within a single specification (e.g. r>=AA.12, r<AA.20). If multiple components are used, the selection must match all components. No isspace(3) characters are allowed.
The \* software specification selects all products.
For complete information, see the sd(4) manual page.
If specified, the software selections cause swpackage to only (re)package those software selections from the full set defined in the source product_specification_file. If no software_selections are specified, then swpackage will (re)package all the products defined in the source product_specification_file.
The swpackage command supports the following syntax for a target_selection:
@ /path
If creating a distribution directory, this option defines the path to the directory. If creating a distribution tape, this option defines the path to the device file on which to write the distribution. When creating a distribution tape, the tape device (file) must exist, and the -x target_type=tape option must be specified (see below).
EXTERNAL INFLUENCES
Defaults File
In addition to the standard options, several swpackage behaviors and policy options can be changed by editing the default values found in:
/var/adm/sw/defaults - the system-wide default values,
$HOME/.sw/defaults - the user-specific default values.
Values must be specified in the defaults file using this syntax:
swpackage.option=value
The default values can be overridden by specifying an options file with the -X option, or by specifying -x option=value on the command line. The policy options that apply to swcpackage are:
compress_cmd=/usr/contrib/bin/gzip
Defines the command called to compress files before installing, copying or packaging. If the compression_type option is set to other than gzip or compress, this path must be changed.
compress_files=false
When compress_files is set to true, files are compressed using the current compress_cmd and their compression_type is set to the value of current compression_type option. Files which have already been compressed by a previous swpackage are not affected by this option. Only one of the compress_files and uncompress_files options may be set to true during a swpackage session. The compress_files option may not be set to true if package_in_place is set to true or if the target_type is set to tape.
compression_type=gzip
Defines the default compression type used by the swpackage when it compresses files during packaging. The compression type is recorded for each file compressed so that the correct uncompression can later be applied by swinstall, swcopy, or swpackage if uncompress_files set to true. The compress_cmd specified must produce files with the compression_type specified. The uncompress_cmd must be able to process files of the compression_type specified unless the format is gzip which is uncompressed by the internal uncompressor ( funzip). The only supported compression types are compress and gzip.
create_target_acls=true
When creating a target depot, this keyword determines whether swpackage will create Access Control Lists (ACLs) in the depot. If the user is the superuser, a value of false for this keyword causes swpackage to not create ACLs for each new product being packaged (and for the depot if the depot is new). When swpackage is invoked by any other user, it will always create ACLs in the target depot. This keyword has no impact on the ACLs which already exist in the depot. (The swpackage command never creates ACLs when software is packaged on to a distribution tape.)
enforce_dsa=true
A value of true for this keyword causes swpackage to terminate if the disc space required to package the software_selections into the target depot exceeds the minfree threshold for the impacted filesystem(s). A value of false will cause swpackage to write into minfree space, up to the absolute limit of the filesystem(s).
follow_symlinks=false
Do not follow symbolic links in the package source files, but include the symbolic links in the packaged products. A value of true for this keyword causes swpackage to follow symbolic links in the package source files and include the files they reference in the packaged products.
include_file_revisions=false
Controls whether or not swpackage includes each source file’s revision attribute in the product(s) being packaged. Because this operation is time consuming, by default the revision attributes are not included. A value of true for this keyword causes swpackage to execute what(1) and possibly ident(1) (in that order) to try to determine a file’s revision.
logfile=/var/adm/sw/swpackage.log
Defines the file where all messages get logged.
layout_version=1.0
The object and attribute syntax of SD now conforms to the layout_version of 1.0 from the IEEE POSIX 1387.2 Software Administration standard. This options controls to which layout_version the SD commands write distributions and swlist output.
Supported values are "0.8" and "1.0". The value of "1.0" should be used for future compatibility; the SD commands still accept the old keyword names as well as the new ones. The value of "0.8" should only be used to create distributions readable by older versions of SD.
logdetail=false[true]
The SD loglevel and logdetail options allow you to choose what amount of information you need in your logfiles - from no detail to complete information.
The loglevel=0 option allows no information to be written to the logfile. This essentially turns off the logfile process.
The logdetail=true[false] option controls the amount of detail written to the logfile. Here are the possible combinations of loglevel and logdetail options:
| Log Level | Log Detail | Information Included |
| loglevel=0 | No information is written to the logfile. |
|
| loglevel=1 | logdetail=false | Only POSIX events are logged; this is the default. |
| loglevel=1 | logdetail=true | POSIX detail as above plus task progress messages. Setting loglevel=1 is not necessary, it is the default. |
| loglevel=2 | logdetail=false | POSIX and file level messages only. Setting the logdetail=false option is not necessary. |
| loglevel=2 | logdetail=true | All information is logged. Setting both loglevel=2 and logdetail=true options is required. With this combination you may get the same logfile behavior as previous HP-UX 10.x releases. |
loglevel=1
Controls the log level for the events logged to the swpackage logfile. A value of 0 prevents information from being logged. A value of 1 enables verbose logging to the logfile. A value of 2 enables very verbose logging to the logfile.
media_capacity=1330
If creating a distribution tape, this keyword specifies the capacity of the tape in one-million byte units. This option is required if the media is not a DDS tape or a disk file. Without this option, swpackage sets the size to 1330 Mbytes for tape and "free space up to minfree" on a disk file.
package_in_place=false
A value of true for this keyword causes swpackage to package the specified products such that the target depot will not contain the files that make up a product. Instead, swpackage inserts references to the original source files used to build a product. This behavior allows the packaging of products in a development or test environment without consuming the full disc space of copying all the source files into the target depot.
reinstall_files=true
Controls whether or not swpackage re-installs files which have not changed (in a fileset which already exists in the target depot and is being repackaged). A value of false for this keyword causes swpackage to only re-install those files which have changed (source file is different from the file in the target depot).
reinstall_files_use_cksum=false
If the reinstall_files keyword is false, this keyword controls how swpackage determines if files being re-installed (re-packaged) have changed. By default, swpackage compares only the files’ size and modification time. A value of true for this keyword causes swpackage to also compare the files’ checksum values.
software=
Defines the default software_selections. There is no supplied default. If there is more than software selection, they must be separated by spaces.
source_directory=/var/spool/sw
Defines the default distribution directory to read as the source (when the source_type is directory). The -s option overrides this default.
source_file=psf
Defines the default product_specification_file to read as the source (when the source_type is file). The -s option overrides this default.
source_type=file
Defines the type of source to package; allowed values are file and directory. The -s option overrides this default.
target_directory=/var/spool/sw
Defines the default distribution directory in which products will be packaged. The target_selection operand overrides this default.
target_tape=/dev/rmt/0m
Defines the default location of the target tape device file. The target_selection operand overrides this default.
target_type=directory
Defines the type of distribution to create. The recognized types are directory and tape.
targets=
Defines the default, target directory or device. There is no supplied default.
uncompress_cmd=
Defines the command called by swpackage to uncompress files. This command processes files which were stored on the media in a compressed format. If the compression_type stored with the file is gzip then the internal uncompression routine ( funzip) is used instead of the external uncompress_cmd. The default value for HP-UX is undefined.
uncompress_files=false
When uncompress_files is set to true, files are uncompressed using the current uncompress_cmd unless their stored compression_type is gzip in which case they are uncompressed by the internal uncompressor ( funzip ). Files which are not compressed are not affected by this option. Only one of the uncompress_files and compress_files options may be set to true during a swpackage session. The uncompress_files option may not be set to true if package_in_place is set to true or if the target_type is set to tape.
verbose=1
Controls the verbosity of the swpackage output (stdout). A value of 0 disables output to stdout. (Error and warning messages are always written to stderr). A value of 1 enables verbose messaging to stdout. A value of 2 enables very verbose messaging to stdout.
write_remote_files=false
This option controls whether swpackage will write to a target depot which exists on a remote (NFS) filesystem. If this option is set to true and the superuser has write permission on the remote filesystem, then swpackage will create or modify a target depot on that filesystem.
Session File
Each invocation of the swpackage command defines a packaging 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/swinstall{swcopy}.last. This file is overwritten by each invocation of swpackage.
You can also save session information to a specific file by executing swpackage 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 /.sw/sessions/ .
To re-execute a session file, specify the session file as the argument for the -S session__file option of swpackage.
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 swpackage take precedence over the values in the session file.
Environment Variables
The swpackage program sets the following environment variable, which is used by the software control scripts being executed.
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 lang(5) 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 swpackage command catches the signals SIGQUIT & SIGINT. If these signals are received, swpackage prints a message and then exits. Any products or filesets in the process of being (re)packaged are marked as CORRUPT, and need to be repackaged. A tape distribution in the process of being created will also be corrupt and need to be re-generated.
PRODUCT SPECIFICATION FILE
This section summarized the product_specification_file (PSF) which drives the swpackage session. See swpackage(4) for a detailed description of a PSF’s syntax and semantics by typing:
man 4 swpackage
A PSF is structured as follows:
[<depot specification>]
[<vendor specification>]
[<bundle specification>]
[<vendor specification>]
<product specification>
[<vendor specification>]
[<subproduct specifications>]
[<control script specifications>]
<fileset specification>
[<control script specifications>]
<file specifications>
[<fileset specification>]
...
[<product specification>]
...
Errors encountered while parsing the PSF result in no valid product definitions, then swpackage terminates. (All errors are logged to both stderr and the logfile.) In summary, the swpackage user can:
• Specify one or more products;
• For each product, specify one or more filesets.
• For each fileset, specify one or more files.
• (optional) Specify attributes for the target depot/tape;
• (optional) Specify one or more bundles, defining the bundle contents;
• (optional) Specify vendor information for groups of products and bundles (including all products), or for individual products.
• (optional) For each product, specify one or more subproducts, defining the subproduct contents;
• (optional) For each product or fileset, specify one or more control scripts.
RETURN VALUES
The swpackage command returns:
0 The products specified in the product_specification_file were successfully packaged into the target depot/tape.
1 An error occurred during the swpackage session (e.g. bad syntax in the product_specification_file.) Review stderr or the log file for details.
DIAGNOSTICS
The swpackage command writes to stdout, stderr, and to the logfile.
Standard Output
The swpackage command writes messages for significant events. These include:
• a begin and end session message,
• selection, analysis, packaging, and tape creation messages.
Standard Error
The swpackage command writes messages for all WARNING and ERROR conditions to stderr.
Logfile
The swpackage command logs detailed events to the log file /var/adm/sw/swpackage.log. (The user can specify a different logfile by modifying the logfile option.)
EXAMPLES
Package the products defined in the PSF products into the default target depot:
swpackage -s products
Preview the same operation (do not create the target depot), and generate very verbose output:
swpackage -p -vv -s products
Package the products into the target depot no_files, insert references to the source files instead of copying them into the depot:
swpackage -s products -x package_in_place=true @ no_files
Re-package a specific fileset:
swpackage -s products -x package_in_place=true product.fileset @ no_files
Re-package the entire contents of the depot /var/spool/sw onto the tape at /dev/rmt/0m:
swpackage -s /var/spool/sw -x target_type=tape @ /dev/rmt/0m
LIMITATIONS
The swpackage command does not apply to HP OpenView Software Distributor PC software. PC software is packaged on the PC Controller using the PC Console, then copied to a UNIX depot for subsequent distribution.
FILES
/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.
/usr/lib/sw/sys.defaults
Contains the master list of current SD options (with their default values).
/var/adm/sw/defaults
Contains the active system-wide default values for some or all SD options.
$HOME/.sw/defaults
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.
/var/spool/sw/
The default location of a source and target software depot.
/dev/rmt/0m
The default location of a source and target tape.
AUTHOR
swpackage was developed by the Hewlett-Packard Company.
SEE ALSO
swpackage(4), sd(4), sd(5), swacl(1M), swagentd(1M), swcluster(1M), swconfig(1M), swcopy(1M), swgettools(1M), swinstall(1M), swjob(1M), swlist(1M), swmodify(1M), swreg(1M), swremove(1M), swverify(1M), update(1M), and the HP OpenView Software Distributor Administrator’s Guide or Managing HP-UX Software with SD-UX manuals.
Hewlett-Packard Company — HP-UX Release 10.20: July 1996