** Web http://www.software.hp.com/products/SD_AT_HP/docs/cookbook.html
1.List sw on cdrom
swlist -s /cdrom
2.list sw on cdrom and choose product
swlist -s /cdrom Java15JDK
3.Create depot sw on destination
swcopy -s /cdrom Java15JDK \* @ /<destination>
Software Depot Package Builder:
Installed in:
/opt/spb/bin/spb
creating a software depot
swpackage
Swpackage can create an unregistered depot. It's primarily used to package up software products for later installation by swinstall. (We'll look at that process later.)
# swpackage -s /depot/psf_files/procmail.psf \
-d /home/bass/depot
"-s" specifies the source, "procmail.psf", a Product Specification File, which tells swpackage how to package up the product. (We'll talk about PSF files a little later.)
"-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 the section Creating Depot Files or Tapes for details.)
swcopy
If you have a bunch of 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
"-s" specifies the source depot, "/home/bass/depot". It could be a depot file, directory, tape device or mounted CD-ROM.
"procmail" is the name of the product or fileset to copy.
"@" specifies the destination depot, "/tmp/depot". (Yes, I think they should have used "-d" for destination.)
registering the depot directory (optional)
Note that the newly-created depot directory is unregistered. That means we can't locate it with:
% swlist -l depot
Which would list all the available depots on this system.
However, we can still list the depot's contents with swlist, if we tell him where the depot is:
% 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
There are basically two ways: Copy existing products or filesets with swcopy, or package up new products with swpackage. Copying is simple and was explained above in Method B. 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-ROM. It has to be a fully-rooted path; this is, 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>
packaging software products using swpackage
Swpackage is used to gather the pieces of a software product together and stick them into a Software Depot. It's possible to tell him lots of things about the product, 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, I'll just do the basics: gathering up the bits and putting them in the depot.
As we saw in Method A, the basic swpackage command is:
# swpackage -s PSF_FILE @ DEPOT
PSF_FILE is the Product Specification File, and DEPOT is the destination.
I recommend using the "-p" flag 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, I created some templates, and I fill in the blanks. There are two main areas that I 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 -- I 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.
Appendix 1 contains the PSF I use for packaging software products that will be swinstalled into /usr/contrib.
Appendicies 2, 3 and 4 are the PSF and post-install and post-remove scripts for packaging products to be installed in /opt.
hp-ux 10.x/11.x compatibility
Most software that is compiled under HPUX-10 will run just fine on HPUX-11, without recompiling. So far, the only exceptions I have encountered have been programs which use the "curses" library manipulate the text cursor in an xterm, hpterm or dtterm. Text editors such as Elvis and Vim are examples of this kind of program.
To make a product available to swinstall on either an HPUX-10 or -11 system, use the values below for these PSF directives:
architecture S700/S800_HPUX_10/11
os_release ?.10.*|?.11.*
To force swinstall to allow HPUX-10 software to be installed on HPUX-11, Add the "-x allow_incompatible=true" argument to the command line.
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
Swpackage 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:
# 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" flag 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 so:
# swpackage -d "| gzip -c > /tmp/procmail.depot.gz" \
-x target_type=tape ...
swlist tricks
Assume you have the HPUX 10.20 Install CD-ROM mounted on "/cdrom".
What is the product name of the C compiler? Of the Fortran compiler?
% swlist -l product -l subproduct -s /cdrom | grep -i compiler
# C-ANSI-C B.10.20.00 HP C/ANSI C CompilerThe answer is C-ANSI-C.
% swlist -l product -l subproduct -s /cdrom | grep -i fortran
# FORTRAN B.10.20.00 FORTRAN Programming
FORTRAN.Demos FORTRAN Guide, Reference and Floating Point Guide
FORTRAN.Development FORTRAN Programming
FORTRAN.Help FORTRAN On-line Help
FORTRAN.Manuals FORTRAN Man Pages
FORTRAN.ManualsByLang FORTRAN manuals in foreign languages
FORTRAN.Notes FORTRAN Release notes
FORTRAN.Vectorizor FORTRAN VectorizorThe answer is FORTRAN.
I swinstalled the C compiler from some depot somewhere. How can I find out which one?
% swlist -v -l product C-ANSI-C | grep install_source
install_source windsock:/depot/s700_hpux_10.20What product contains pxdb?
% swlist -l file -s /cdrom | grep pxdb
C-Plus-Plus.HPCXX: /opt/CC/contrib/Tools/time_pxdb
DebugPrg.DEBUG-PRG: /opt/langtools/bin/pxdb
DebugPrg.DEBUG-PRG: /opt/langtools/lib/nls/msg/C/pxdb.cat
OS-Core.Q4: /usr/contrib/bin/q4pxdb
OS-Core.Q4: /usr/contrib/lib/nls/msg/C/q4pxdb.catThe answer is DebugPrg.
0 comments:
Post a Comment