RPM 构建不采用 %file 中的 if 语法
RPM build not taking if syntax in %file
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 构建错误:
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
我在 运行 RPM 时收到此错误。如果逻辑我哪里出错了?
你所拥有的%define
并没有按照你的想法去做;他们在定义事物,然后留下无效的 shell 代码。您可能需要一个包装器 shell 或 Makefile
调用 rpmbuild
并在命令行上定义“mybindir
”,例如rpmbuild --define="mybindir /home/rgate/elasticsearch"
有re-read问题,你想做的事情似乎是 install-time 事情,你无法决定 on-the-fly 像那样。我会说将您的东西安装在标准位置,例如 /usr/share/yourpackage
,然后在 %post
中,在正确的用户主目录中设置指向它的符号链接。在 %post
中,您可以编写脚本来完成您期望的事情。
您不能在 %files
部分使用 shell 脚本。您可以使用宏,例如:
%if
...
%endif
但是这些宏条件语句是在构建时计算的,而不是在安装期间计算的。
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 构建错误:
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
我在 运行 RPM 时收到此错误。如果逻辑我哪里出错了?
你所拥有的%define
并没有按照你的想法去做;他们在定义事物,然后留下无效的 shell 代码。您可能需要一个包装器 shell 或 Makefile
调用 rpmbuild
并在命令行上定义“mybindir
”,例如rpmbuild --define="mybindir /home/rgate/elasticsearch"
有re-read问题,你想做的事情似乎是 install-time 事情,你无法决定 on-the-fly 像那样。我会说将您的东西安装在标准位置,例如 /usr/share/yourpackage
,然后在 %post
中,在正确的用户主目录中设置指向它的符号链接。在 %post
中,您可以编写脚本来完成您期望的事情。
您不能在 %files
部分使用 shell 脚本。您可以使用宏,例如:
%if
...
%endif
但是这些宏条件语句是在构建时计算的,而不是在安装期间计算的。