It looks like you are trying to create a roaming RPM .
In the preamble of your .spec file .spec place the path prefix for the file that you can move. For example, if the full path to your file is
/base/path/to/my/file
then /base can be changed during the installation of RPM, but /path/to/my/file will remain the same.
Here you put in your .spec file:
Make sure you specify this prefix by specifying all moveable files in the %install and %files sections of the .spec file. There are conditions under which a roaming RPM may not work, so check out these things and .
%files %{prefix}/path/to/my/file
Now that you install RPM, you can specify a different prefix.
rpm -i sample.rpm --prefix /tmp
This will install the file in /tmp/path/to/my/file .
nohup source share