我在rhel5和rhel6上为rpms维护了一些spec文件,但我总是在spec文件中进行更复杂的测试。通常我会在安装时在rpm内执行的perl或bash脚本中重新编写配置逻辑。
现在我在这个简单的不相同的测试中挣扎,我相信脚本逻辑接近bash,但至少有一些工作用于bash。如果我删除它,如果测试一切正常。
echo "verifying base:%{smm_public_base} against %{smm_public}";
# if smm_public is not the same as smm_public_base we must sublink
if [ %{smm_public_base} -ne %{smm_public} ]; then
echo "smm_public_base:%{smm_public_base} is not the same as smm_public:%{smm_public} so we need to soflink it"
if [ -L %{smm_public_base ]; then
rm -rf %{smm_public_base}
fi
ln -s %{smm_public} %{smm_public_base} || :
fi
我试过了:
if [ %{smm_public_base} != %{smm_public} ]; then
和
if [ "%{smm_public_base}" != "%{smm_public}" ]; then
那些给出这样的错误
verifying base:/opt/s3public against /opt/app/s3public
/var/tmp/rpm-tmp.29711: line 60: syntax error: unexpected end of file
error: %post(secana_smm2_SEB_PROD-r250-225.x86_64) scriptlet failed, exit status 2
所以我一直在寻找关于如何在spec文件中编写脚本逻辑的入门知识,但除了在 Fedora RPM guide
任何人都有一些最好的做法。 Opensuse说看看redhat包。
由于
答案 0 :(得分:0)
我发现了错误,如果你注释掉if循环,就不知道它为什么会起作用。
if [ -L %{smm_public_base ]; then
这是一个错误的关闭,一直在错过..
if [ -L %{smm_public_base} ]; then
很抱歉浪费了你的时间,但为什么要在60号线而不是63号上投诉?