Issue
if ! /usr/bin/getent passwd sgate>/dev/null; then
%define bindir /home/sgate/elasticsearch
elif ! /usr/bin/getent passwd rgate>/dev/null; then
%define bindir /home/rgate/elasticsearch
fi
RPM build errors:
File must begin with "/": if
File must begin with "/": !
Two files on one line: /usr/bin/getent
File must begin with "/": passwd
Two files on one line: /usr/bin/getent
File must begin with "/": sgate>/dev/null;
Two files on one line: /usr/bin/getent
File must begin with "/": the
File not found: /root/ES_RPM/ElasticSearchRPM/BUILDROOT/elasticsearch-5.2.2-1.x86_64/home/*/elasticsearch
File must begin with "/": elif
File must begin with "/": !
Two files on one line: /usr/bin/getent
File must begin with "/": passwd
Two files on one line: /usr/bin/getent
File must begin with "/": rgate>/dev/null;
Two files on one line: /usr/bin/getent
File must begin with "/": then
File not found: /root/ES_RPM/ElasticSearchRPM/BUILDROOT/elasticsearch-5.2.2-1.x86_64/home/*/elasticsearch
File must begin with "/": fi
I am getting this error while running RPM. Where am I going wrong with this if logic?
Solution
You cannot use shell script in %files
section. You can use macros, e.g.:
%if
...
%endif
But those macros conditionals are evaluated during build time and not during installation.
Answered By - msuchy