Sie sind auf Seite 1von 4

Software Distributor: Cookbook

Creating a Software Depot


swpackage
The swpackage can create an unregistered depot. It's primarily used to package software
products for later installation by swinstall.
# swpackage -s /depot/psf_files/procmail.psf \-d /home/bass/depot
The -s specifies the source, procmail.psf, a Product Specification File, which tells swpackage
how to package up the product.
The -d specifies the destination, /home/bass/depot, a depot subdirectory. The destination
does not have to exist; swpackage will create it for you. The destination could also have been
a file or tape. (See "Creating Depot Files or Tapes (page 6)" for details.)

swcopy
If you have a several products or filesets that you want to group together into a new or existing
depot (a collection of patches, for example), use swcopy The destination depot does not have to
exist; swcopy will create it for you if it doesn't. For example:
# swcopy -s /home/bass/depot procmail @ /tmp/depot
The -s specifies the source depot, /home/bass/depot. It could be a depot file, directory, tape
device or mounted CD.
The procmail is the name of the product or fileset to copy.
The @ specifies the destination depot (rather than the -d used by swpackage, /tmp/depot.

Registering the Depot Directory - Optional


Note that the newly-created depot directory is unregistered. That means you can't locate it with:
% swlist -l depot
Which lists all the available depots on this system.
However, you can still list the depot's contents with swlist, if you specify the location of the
depot:
% swlist -s /home/bass/depot
If you want to register the depot, use the swreg command:
# swreg -l depot /home/bass/depot

Copying into a Software Depot Using swcopy


Copying is simple as previously explained. The basic form of the swcopy command is:
# swcopy -s SOURCE_DEPOT SELECTION @ DESTINATION_DEPOT
The SOURCE_DEPOT could be a depot file, directory, tape device or mounted CD. It has to be a
fully-rooted path; that is it must start with a /.
SELECTION is the name of the software selection (the product or fileset) to copy. To copy them
all, use \* as the selection.
The DESTINATION_DEPOT also has to be fully-rooted.
How do you know what the software selection's name is? For patches, it's usually the name of
the path. Use the swlist command to find out, like so:
% swlist -s <depot>
Creating a Software Depot

Packaging Software Products Using swpackage


The swpackage command is used to gather the pieces of a software product together and stick
them into a Software Depot. It's possible to specify lots of things about the product to swpackage.
For example, like what other products have to be installed first, or what products also have to
be on the system.
For the purpose of this cookbook, you will just do the basics: gathering up the bits and putting
them in the depot.
As you saw previously, the basic swpackage command is:
# swpackage -s PSF_FILE @ DEPOT
PSF_FILE is the Product Specification File, and DEPOT is the destination.
HP recommends using the -p option to preview the process, and fix any errors in the PSF before
actually writing anything into the depot.

The Product specification File (PSF)


The Product Specification File (PSF) is where the real work gets done. To make the job of writing
PSF files easier, templates were created and you can fill in the blanks. There are two main areas
that HP recommends that you swinstall software to: /opt and /usr/contrib. Each one
of them has the product broken out differently.
If a product only has a few files -- maybe an executable or two, a few man pages and maybe a
library file -- build it to reside in /usr/contrib/bin, /usr/contrib/man/man1, and
/usr/contrib/lib, respectively. For Gnu-configured software, this usually means setting the
prefix to /usr/contrib.
On the other hand, if this is a major software package -- like Emacs or TCL, I build it with the
prefix set to /opt/PACKAGE_NAME. This keeps it all together in one place, and simplifies the
PSF file. The Post-Install script adds the bin directory to the contents of /etc/PATH, which you
can source in your .cshrc.

Useful Command-line Options


-p

Preview Mode. The task quits after the analysis phase. Nothing
is written to disk.

-v

Verbose Mode

-vv

Very Verbose Mode

-x autoreboot=true

Allows software or patches which requires a reboot of the target


system to be installed.

-x mount_all_filesystems=false

Allows software or patch installations even if a filesystem, like a


cdrom drive, is not mounted.

-x allow_incompatible=true

Allows the installation of software or patches that are incompatible


(wrong HPUX rev or machine architecture) with the target system.

-x enforce_dependencies=false

Allows the removal of software that has other products or filesets


dependent on it. For example, some internally-developed tools
require Perl5. If I want to remove it so that I can replace it with a
later version, I can use this option.

Creating Depot Files or Tapes


The swpackage command is also used to re-package existing software selections from an existing
depot into a depot tape or file. For example, to re-package the procmail product from the depot
directory, /home/bass/depot, into a depot file,/tmp/procmail.depot, use the following:
6

# swpackage -d /tmp/procmail.depot -x target_type=tape \-s


/home/bass/depot procmail
The addition of the -x target_type=tape forces swpackage to write the depot sequentially
to the tape (or file) instead of creating a distribution directory.
To create a tape, substitute the file name given to the -d option with the tape device:
# swpackage -d /dev/rmt/0m -x target_type=tape \-s /home/bass/depot
procmail
The -d argument may also be a pipe to a UNIX command, like the following:
# swpackage -d "| gzip -c > /tmp/procmail.depot.gz" \-x target_type=tape
...

swlist Tricks
Assume you have the HP-UX 11i v1 (B.11.11) Installation CD mounted on /cdrom, you can find
the product name of the C compiler as follows:
% swlist -l product -l subproduct -s /cdrom | grep -i compiler
# B3901BA B.11.11.04 HP C/ANSI C Developer's Bundle for HP-UX 11.i
(S800)
If you swinstall the C compiler from a depot somewhere else you can determine which one with
the following:
% swlist -v -l product C-ANSI-C | grep install_source
install_source windsock:/var/opt/ignite/depots/Rel_B.11.11/apps_800
You could use the following command to determine which product contains pxdb:
% swlist -l file -s /cdrom | grep pxdb
DebugPrg.DEBUG-PRG: /opt/langtools/bin/pxdb
DebugPrg.DEBUG-PRG: /opt/langtools/bin/pxdb32
DebugPrg.DEBUG-PRG: /opt/langtools/bin/pxdb64
DebugPrg.DEBUG-PRG: /opt/langtools/lib/nls/msg/C/pxdb.cat
OS-Core.Q4: /usr/contrib/Q4/bin/q4.pxdb
OS-Core.Q4: /usr/contrib/Q4/bin/q4pxdb
OS-Core.Q4: /usr/contrib/Q4/bin/q4pxdb64
OS-Core.Q4: /usr/contrib/bin/q4.pxdb
OS-Core.Q4: /usr/contrib/bin/q4pxdb
OS-Core.Q4: /usr/contrib/bin/q4pxdb64
OS-Core.Q4: /usr/contrib/lib/nls/msg/C/q4pxdb.cat
OS-Core.Q4: /usr/contrib/lib/nls/msg/C/q4pxdb64.cat
PHCO_25723.Q4: /usr/contrib/Q4/bin/q4.pxdb
PHCO_25723.Q4: /usr/contrib/Q4/bin/q4pxdb
PHCO_25723.Q4: /usr/contrib/Q4/bin/q4pxdb64

swlist Tricks

Das könnte Ihnen auch gefallen