pkgadd prototype file that doesn't break links
How can I create a 开发者_运维知识库solaris package that will not to break soft links when the package gets installed ?
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.
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.
Are these symbolic links parts of your package prototype file ? If so, how are they defined ?
What do you mean by breaking links? I can think of a couple of things that might happen to the links:
- Overwrite a symlink with a file
- Overwrite a symlink with a directory
- 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.
精彩评论