Q on RPM, conditional install or removal, like installf, removef

I am creating binary RPM on RedHat 6 and would like to do this:

at install time, depending on situation, install a file or not install it

For comparison, I do this on solaris using "installf",
is there a way of achieving similar functionality in RPM?

And conversely for conditional removal (like "removef" on solaris)

That's done with dependencies -- depending on a certain package to make sure a certain file's available, etc.

Are you talking about the Require: packagename of a specfile? (also available: BuildRequires)
Which basicly is the same like what Corona said.

hth

No, I am not talking about package dependencies.

It's like this, in the post install pseudo-code

first part of post install script
if [ some condition ] ; then
install /opt/dir/file
end if
rest of post install script

IOW, if "some condition" is true then /opt/dir/file becomes part of the installed package, otherwise not.

That sounds like data files, which are the sort of thing a package manager doesn't generally remove on uninstall, or strictly consider part of its set of installed files.

RPM does turn out to have pre/post install scripts though.