The swpackage command packages software products defined in
a PSF into a depot. You can then use the software in the depot with
other SD-UX commands.
Overview
Features and limitations include:
Uses the PSF to organize files into
products, subproducts, and filesets.
Can include control scripts and PSFs to further
specify how to handle the software when installing it onto the target
system.
Sets permissions of the files being packaged.
Can package either simple, one-fileset products
or complex products with many filesets and subproducts.
Provides a way to repackage (change) existing products.
The swpackage command provides only a command line
user interface. There is no Graphical User Interface for the packaging tasks.
Can create directory depots (including CDs) or tape
depots (useful for distributing software via the internet).
Does not automatically register newly created depots.
You must use the swreg command (see “Registering
and Unregistering Depots (swreg) ”).
The swpackage Process
The swpackage process includes up to four phases:
Table 10-4 swpackage Process Phases
| I. Selection | swpackage reads the PSF |
| II. Analysis | swpackage analyzes the packaging tasks
and requirements before actually packaging the software to the target
depot or tape. swpackage compares the software to be packaged against
the target depot to make sure the packaging operation will be successful. |
| III. Build | swpackage packages the source files and
information into a product object, and inserts the product into
the distribution depot. swpackage creates the depot but does not
register it. You must have appropriate SD-UX permission to create
this new depot on the local host. If the target (destination)
is a tape media, a temporary depot is created. |
| IV. Make Tape | (Optional) This phase occurs only if
you are packaging to a distribution tape. swpackage copies the source files
and a temporary depot catalog to the tape. (Note that swpackage
cannot compress files when writing to a tape.) |
Figure 10-1 “An
Overview of the Packaging Process” shows
an overview of the swpackage session.
Phase I: Selection
When you run swpackage, you must specify a PSF and any other
options you wish to include. The swpackage command begins the session
by telling you the source, target, software selections, and options
used,
Determine the
product, subproduct, and fileset required for the structure
Determine which files are contained in each fileset
Determine the attributes associated with each objects
Check PSF syntax and terminates the session if any
are encountered
Phase II: Analysis
swpackage performs four checks during this phase:
Check for unresolved dependencies.
For every fileset in each selected product, swpackage checks
to see if a requisite of the fileset is not also
selected or not already present in the target
depot. Unresolved dependencies within the product generate errors.
Unresolved dependencies across products produce notes.
Check your authorization to package (or
re-package) products.
For each new product (a product that does not exist
on the target depot) swpackage checks the target depot to see if
you have permission to create a new product on it (insert permission).
If you do not, the product is not selected.
For each existing product (one you are re-packaging) swpackage checks
to see if you have permission to change it (write permission). If
you do not, the product is unselected.
If all products are not selected because permission is denied,
the session terminates with an error.
If the depot is a new depot or if you are packaging to a tape,
this authorization check is skipped. If you have permission to create
a new depot, then you have permission to create products within
it. Since a tape session first writes to a temporary depot then
copies it to tape, if you have permission to create a new (temporary)
depot, you can package to tape.
Check for software being repackaged.
For each selected product, swpackage checks to see if the
product already exists in the target depot.
If it does exist, swpackage checks
to see which filesets are being added (new filesets) or modified.
If it exists and all filesets are selected, swpackage
checks to see if any existing filesets have been obsoleted by the
new product.
Performing Disk Space Analysis (DSA)
swpackage verifies that the target depot has enough free disk
space to package the selected products.
If adequate disk space is available
for the packaging operation to proceed, swpackage writes a note
to the log file to note the impact on disk space.
An error results if the package will encroach into
the disk's minfree space.
An error results if the package phase requires more
disk space than is available.
If you set the enforce_dsa command option to false, swpackage changes disk
space errors to warnings and continues. This lets you cross into
the minfree space to complete a packaging operation.
Phase III: Build
When packaging a product, if the target depot does not exist,
swpackage creates it. If it does exist, swpackage will merge new
product(s) into it. For each different version of the product, a
directory is created using the defined product tag attribute and
a unique instance number (instance ID) for all the product versions
that have the same tag.
Before a new storage directory is created, swpackage checks
to see if this product version has the same identifying attributes
as an existing product version.
If all the identifying attributes match, you are re-packaging
(modifying) an existing version. Otherwise, swpackage creates a
new version in the target distribution.
The packaging process uses an explicit ordering to avoid corrupting
the target distribution if a fatal error occurs. Each product is
packaged in its entirety and when all specified products have been
packaged successfully, the distribution's global INDEX
file is built/rebuilt. Within each product construction, the following
order is adhered to:
Check if the product is new or already exists. If it is new,
create the product's storage directory.
For each fileset in the product, copy the fileset's
files into their storage location (within the product's
storage directory), and create the fileset's catalog (database
information) files.
After the individual filesets, create the product's
informational files (meta-files).
A target depot is only the first step in creating a CD-ROM.
If the ISO 9660 standard format is desired, a utility to perform
this conversion would be necessary. This conversion is not supported
by swpackage.
Distribution tapes
are created in tar format (although SD-UX commands can also read
depots from cpio format tapes). To create the tape, swpackage first
builds the products into a temporary distribution depot. (The depot
is removed when swpackage completes.) To conserve space, all files
exist as references to the real source files. After the distribution depot
is constructed, swpackage then archives it, along with the real files,
onto the tape device.
When archiving a product that contains kernel filesets onto
a tape media, swpackage puts these filesets first within the archive
to provide efficient access by swinstall. swpackage also orders
filesets based on prerequisite dependency relationships.
Phase IV: Make Tape
This optional phase occurs only when you package to a distribution
tape.
In this phase, swpackage copies the
source files and a temporary depot catalog to the tape.
swpackage does a tape space calculation to ensure
that the tape can hold the software package. If one tape cannot
hold it all, then swpackage will partition the software across multiple
tapes.
swpackage cannot compress files when writing to
a tape.
Using
swpackage |
 |
swpackage Syntax
swpackage [-p] [-v] [-V] [-C session_file]
[-d directory|device] [-f software_file]
[-s product_specification_file|directory]
[-S session_file] [-x option=value] [-X option_file]
[software_selections] [@ target_selection]
Options and Operands
- -p
Previews the specified package session without actually
creating or modifying the depot or tape.
- -v
Turns on verbose output to stdout and lists messages for each product, subproduct
and fileset being packaged. (The swpackage logfile in /var/adm/sw/swpackage.log is not affected by this option.)
- -V
List the data model revisions which swpackage can read.
swpackage always packages using the latest data model revision.
- -C session_file
Run the command and save the current option
and operand values to a session_file for re-use in another session.
See “Session
Files”.
- -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 target_type=tape option must be specified.
- -f software_file
Read a list of software selections from
a separate file instead of (or in addition to) the command line.
See “Software
Files”.
- -s product_specification_file|directory
Specifies the PSF to use or the existing
directory to use as the source for the packaging session.
- -S session_file
Run the command based on values saved
from a previous installation session, as defined in session_file. See “Session
Files”.
- -x option=value
Sets a command option to value and overrides default values or a values in options
files. See “Changing Command Options”.
- -X option_file
Read session options and behaviors from option_file. See “Changing Command Options”.
- software_selections
The software objects to be installed.
See “Software
Selections”.
If you do not include this specification,
swpackage packages all the products listed in the PSF.
- @ target_ selections
The target of the command. See “Target
Selections”.
If you are creating a distribution depot (directory), this operand
defines the location of the directory. Without this operand, /var/spool/sw is used as the default depot directory.
If you are creating a distribution tape, this operand names
the device file on which to write the tar archive. swpackage must be able to determine if
the media is a DDS tape or a disk file. Without this operand, swpackage
uses the device file, /dev/swtape.
Changing Command Options
You
can change the behavior of this command by specifying additional command-line
options when you invoke the command (using the -x option) or by reading predefined values from a
file. The following table shows the options and default values that
apply to swconfig.
Table 10-5 swpackage Command Options and Default Values
admin_directory=/var/spool/sw allow_partial_bundles=true compress_command= /usr/contrib/bin/gzip distribution_source_directory= /var/spool/sw distribution_target_directory= /var/spool/sw distribution_target_serial= /dev/rmt/0m include_file_revisions=false
| logfile=/var/adm/sw/swpackage.log reinstall_files_use_cksum=true
|
For More Information
See Appendix A “Command
Options” for complete descriptions of each default.
Output
of Logfile Messages
The log file /var/adm/sw/swpackage.log captures output from the swpackage session.
Message logging by default sends verbose
messages to stdout.
(Setting the verbose option to 0 reduces the amount of information in stdout.)
Message logging also sends errors and warnings to stderr.
No logfile messages are written in preview (-p) mode.
The logfile is equal to stdout plus stderr.
Here is a sample log:
======= 01/27/01 18:58:45 MST BEGIN swpackage SESSION
* Session started for user "root@sdtest.myco.com".
* Source: vewd:test.psf
* Target: vewd:/var/spool/sw
* Software selections:
*
* Options:
preview true
verbose 1
loglevel 1
logfile /var/adm/sw/swpackage.log
source_type file
target_type directory
package_in_place false
follow_symlinks false
include_file_revisions false
enforce_dsa true
reinstall_files true
reinstall_files_use_cksum false
write_remote_files false
create_target_acls true
* Beginning Selection Phase.
* Reading the Product Specification File (PSF) "test.psf".
* Reading the product "SD" at line 1.
* Reading the fileset "commands" at line 4.
======= 01/27/01 18:58:45 MST END swpackage SESSION