Contact

 

PING : CREATING YOUR OWN SD-UX DEPOTS by David C. Snyder

These are the steps that you need to follow to create your own SD-UX depots:

1.

Give yourself access to SD-UX. You can do this one of two ways (both of these require you to be root):

a. Add yourself to the Host Access Control List by typing (as root):

swacl -M user:rhood:crwit -l host

b. Create a group called swadm in /etc/group, and add yourself to that group. Don't forget to logout and login. You will also have to use the newgrp(1) command to switch your default group to swadm.

2.

Create a depot directory. I prefer to make my own instead of using the default /var/spool/sw. For example, yours might be /users/rhood/sw.

3.

Customize SD by creating your own $HOME/.sw/defaults. Create a $HOME/.sw directory and copy /usr/lib/sw/sys.defaults to $HOME/.sw/defaults. Uncomment all of the lines that contain "= /var/spool/sw" and change the location to the path of your depot, "/users/rhood/sw". If you want your depot to only contain references to the files rather than a copy of the files, also change the "swpackage.package_in_place" option from "false" to "true". Here's a little script that does this for you:

 

mkdir $HOME/.sw
cp /usr/lib/sw/sys.defaults $HOME/.sw/defaults
chmod u+w $HOME/.sw/defaults
ed $HOME/.sw/defaults << EOT
1,\$s/^# *\(.*= *\)\/var\/spool\/sw *\$/\1\/users\/rhood\/sw/
1,\$s/^# *\(swpackage.package_in_place\).*/\1 = true
w
q
EOT

4.

Create a Product Specification File. The HP Manual, Managing HP-UX Software With SD-UX has lots of information on this in Chapter 10. Although there are many fields that you can include, only a few are required. I have a Perl script called "psf" which generates a minimum .psf file given that you follow a few simple rules:

* Put all of the files that you want to include under one directory.
* Name the directory using the following format: name-major.minor. For example, sed-2.05 or gcc-2.7.2.3.
* Run the script from the parent of this directory and give it only a simple directory name(s). For example:

psf sed-2.05 gcc-2.7.2.3 > stuff.psf

If you give it an absolute path name, you will have to manually edit the resulting .psf file to fix the directory mappings.

My script assumes that you want everything to be installed into /usr/local. If you want to change that, you'll have to edit my psf script. It would be easy to make the destination directory a command line argument, but I haven't done so because thus far I'm the only one who uses psf. Just search for "=/usr/local" and change that to whatever you like, "/usr/share/sysadm" for example.

5. Create your depot using swpackage. For example:
swpackage -vv -s stuff.psf

6. Register your depot using swreg. For example:
swreg -l depot /users/rhood/sw

7. List the contents of your depot with:
swlist -d @ /users/rhood/sw

8. List all of the files that belong to a product in your depot with:
swlist -l file -d SED GCC,r=2.7.2.3 @ /users/rhood/sw

9. There are fancy swpackage commands that you can use to edit a product specification after it has been added to the depot, but I find these hard to use and error prone. I prefer to remove the product and reload it from the .psf file. For example, to update the SED product in your depot, do:
swremove -d SED,r=2.05 @ /users/rhood/sw swpackage -vv -s sed.psf

10. I have a small script called cleansw that I use to remove all of the products from my depot. It just does an swlist to find out what products are there, and then does a bunch of swremove's.

That's about it. There are, of course, a number of things that can go wrong. If you can't run swpackage even after adding your self to the Host Access Control List, your system name may be incorrect in one or more of the '_*' files under /var/adm/sw/security. If you get errors or warnings when you run swpackage, it could be that your .psf file is out of date or that you don't have read access to some of the files listed in your .psf file. If you encounter other problems, please let me know even if you figure them out yourself so that I can add your solution to this document.

DOWNLOADS

* sample.psf - a sample psf file to create a depot of Perl
* psf.pl - Perl script for building a Product Specification File (psf)
* cleansw - shell script to remove all products from a depot