Because Software Collections are designed to install the Software Collection packages in an alternate directory, set up the necessary SELinux labels so that SELinux is aware of the alternate directory.
If the file system hierarchy of your Software Collection package imitates the file system hierarchy of the corresponding conventional package, you can run the
semanage fcontext and restorecon commands to set up the SELinux labels.
For example, if the
/opt/provider/software_collection_1/x86_64/root/usr/ directory in your Software Collection package imitates the /usr/ directory of your conventional package, set up the SELinux labels as follows:
semanage fcontext -a -e /usr /opt/provider/software_collection_1/x86_64/root/usr restorecon -R -v /opt/provider/software_collection_1/x86_64/root/usr
The commands above ensure that all directories and files in the
/opt/provider/software_collection_1/x86_64/root/usr/ directory are labeled by SELinux as if they were located in the /usr/ directory.
To use the
semanage fcontext and restorecon commands in your Software Collection, add the commands to the %post post-installation scriptlet in the Software Collection spec file.
Important
Keep in mind that the
semanage -e command, which substitutes the source path for the destination path during labeling, is not supported in Red Hat Enterprise Linux 5.