给定最小的RPM规范文件,该文件应仅执行一个%post
节:
$ cat ~/RPMBUILD/SPECS/test.spec Name: None Version: 1.0 Release: 1 Summary: Bla License: Proprietary %description Bla %prep %build %install %clean %post echo ">>> Inside post <<<" %files
然而,从回声%post
是不执行:
$ rpmbuild -v -bb ~/RPMBUILD/SPECS/test.spec Executing(%prep): /bin/sh -e /home/ronbarak/RPMBUILD/tmp/rpm-tmp.IvhCZs + umask 022 + cd /home/ronbarak/RPMBUILD/BUILD + LANG=C + export LANG + unset DISPLAY + exit 0 Executing(%build): /bin/sh -e /home/ronbarak/RPMBUILD/tmp/rpm-tmp.yCLpOK + umask 022 + cd /home/ronbarak/RPMBUILD/BUILD + LANG=C + export LANG + unset DISPLAY + exit 0 Executing(%install): /bin/sh -e /home/ronbarak/RPMBUILD/tmp/rpm-tmp.uEbSD2 + umask 022 + cd /home/ronbarak/RPMBUILD/BUILD + '[' /home/ronbarak/RPMBUILD/BUILDROOT/None-1.0-1.x86_64 '!=' / ']' + rm -rf /home/ronbarak/RPMBUILD/BUILDROOT/None-1.0-1.x86_64 ++ dirname /home/ronbarak/RPMBUILD/BUILDROOT/None-1.0-1.x86_64 + mkdir -p /home/ronbarak/RPMBUILD/BUILDROOT + mkdir /home/ronbarak/RPMBUILD/BUILDROOT/None-1.0-1.x86_64 + LANG=C + export LANG + unset DISPLAY + /usr/lib/rpm/check-buildroot + /usr/lib/rpm/redhat/brp-compress + /usr/lib/rpm/redhat/brp-strip /usr/bin/strip + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip + /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump + /usr/lib/rpm/brp-python-bytecompile + /usr/lib/rpm/redhat/brp-python-hardlink + /usr/lib/rpm/redhat/brp-java-repack-jars Processing files: None-1.0-1.x86_64 Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/ronbarak/RPMBUILD/BUILDROOT/None-1.0-1.x86_64 Wrote: /home/ronbarak/RPMBUILD/RPMS/x86_64/None-1.0-1.x86_64.rpm Executing(%clean): /bin/sh -e /home/ronbarak/RPMBUILD/tmp/rpm-tmp.wLCv3C + umask 022 + cd /home/ronbarak/RPMBUILD/BUILD + exit 0
我应该更改什么%post
才能执行?
%post
是安装/卸载时间脚本部分,因此仅在尝试安装或卸载生成的rpm时才执行。
从文档中:
安装软件包后,将执行%post脚本。需要%post脚本的最常见原因之一是在安装新的共享库后,运行ldconfig来更新可用共享库的列表。当然,其他功能也可以在%post脚本中执行。例如,安装shell的软件包使用%post脚本将shell名称添加到/ etc / shells。
如果要在构建时执行其他任务,则需要依赖%build
或%install
部分。