Issue
I'm a newby in RPM building. I have to build RPM which would install a package only if file /etc/i-am-a-requirement exists on target machine. So I wrote
%pre
if test -f "/etc/i-am-a-requirement"; then
echo "I'm OK to continue"
else
echo "The file is not found, the RPM won't be installed"
-- How to add failure here? --
fi
I know that normally we expect RPM to have dependency packages, but in this case "/etc/i-am-a-requirement" is distributed as binary, so it does not have a package at all.
Solution
the %pre
, %post
and other scripts cannot stop the installation of an rpm. Once you are inside the scriptlets; installation will continue nomatter the exit code of your scriptlets.
You should use Requires:
Requires: /etc/i-am-a-requirement
Answered By - Chris Maes Answer Checked By - David Goodson (WPSolving Volunteer)