LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Making the - - prefix option required when installing an RPM package (https://www.linuxquestions.org/questions/linux-software-2/making-the-prefix-option-required-when-installing-an-rpm-package-685226/)

sandricky 11-21-2008 12:20 PM

Making the - - prefix option required when installing an RPM package
 
We packaged up some of our scripts that our company uses. In the %files section of the spec file the files contain a path that will most likely not be used by some of our target users. We have added the Prefix: option to allow them to install in it another location with the --prefix option and it works great. The question is can we somehow make the --prefix option a required option when trying to install the RPM?

Thanks
Rick

penguiniator 11-22-2008 09:09 PM

Try looking at http://rpm.org/wiki/Docs#PackagerDocumentation. You may find the answer you need and more there.

unSpawn 02-07-2009 05:20 AM

(Well within necroposting limits I hope) AFAIK .spec "Prefix:" != RPM CLI arg "--prefix" but "--reloc". In any case using something like this:
Code:

%pre
if [ "$1" = "1" ]; then
        grep -q -- "--reloc" /proc/`pgrep rpm`/cmdline
else

will make RPM skip installing the package on script error. This is in no way an "official" method, can be bypassed easily using "--noscripts" (though you can test for that as well) and can be easily thwarted if you have multiple 'rpm' commands running (though you could 'pgrep -f packagename_and_rpm-args').

sandricky 02-09-2009 12:24 AM

Going with it.
 
Thanks, I've read and I asked but nothing that I found can make the --prefix a required option except adding the script option as unSpawn suggested. Thanks, I think I will go with it.


All times are GMT -5. The time now is 04:00 AM.