Linux - Is there a way to fake the highest directory?

/ is the highest directory in Linux. Is there a way to fake that to something else say /opt/rpmbuild/BUILDROOT?

Here's my problem space. I am trying to re-package a COTS into RPM format. The COTS came in a form of binary and I need to install that first before packaging it into RPM. The install is installing it into /opt/app directory, and I want it to install it into /opt/rpmbuild/BUILDROOT/opt/app but I couldn't force that to happen.


Solution 1:

chroot /opt/rpmbuild/BUILDROOT can do this, but it requires that you have a working OS installed within the chroot directory.

Instead of using chroot, a simpler option would be to create a symlink from /opt/app to /opt/rpmbuild/BUILDROOT/opt/app:

mkdir -p /opt/rpmbuild/BUILDROOT/opt/app
ln -s /opt/rpmbuild/BUILDROOT/opt/app /opt/app

Then the installation will think it's working in /opt/app, but will in fact go into /opt/rpmbuild/BUILDROOT/opt/app.

Solution 2:

Have a look into man chroot, this should help you.