views:

46

answers:

3

How can I create a solaris package that will not to break soft links when the package gets installed ?

A: 

Are these symbolic links parts of your package prototype file ? If so, how are they defined ?

jlliagre
A: 

You can use the class field in the prototype file to conditionally install things. For example:

d none /foo 0775 $USER $GROUP
d createbar /bar 0775 $USER $GROUP

The directory /foo will normally always be created because "none" is the default class. On the other hand, /bar will only be created if the installer is set to install things in the "createbar" class.

then /foo would only be created if the installer is told to create items in class "createfoo".

The initial set of classes to install is set in the pkginfo file. You can alter the class list in the request or checkinstall scripts. The idea is for one of these scripts to perform some check to decide whether to install the optional components, then alter CLASSES appropriately. For example:

# Create /bar unless it already exists as a symlink
if [ ! -L /bar ]
then
    echo "CLASSES=${CLASSES} createbar"
fi

If this answer doesn't meet your needs, maybe you could give a better description of what you're trying to do.

Kenster
A: 

What do you mean by breaking links? I can think of a couple of things that might happen to the links:

  1. Overwrite a symlink with a file
  2. Overwrite a symlink with a directory
  3. Put a file into a directory to which a symlink is pointing (say, you install into /opt/foo/bar, and /opt/foo is a symlink)

It would help if you clarified your question.

In either case however, the class action scripts are something you might want to look at, if you want to handle certain files from your package in a special way.

In the prototype file, you need to assign a class name to a file, and in a different package, you need to provide a script which will handle this class. You can take a look at CSWcswclassutils, a package which provides a number of class action examples. You would create a similar package providing a class action script, and use the scripts in your package with special files.

automatthias