鉴于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
执行?
答案 0 :(得分:4)
%post
是一个安装/卸载时间脚本部分,因此只有在尝试安装或卸载生成的rpm时才会执行。
安装软件包后执行%post脚本。之一 需要%post脚本的最常见原因是运行ldconfig 在新的共享库具有之后更新可用共享库的列表 已安装。当然,其他功能可以在%post中执行 脚本。例如,安装shell的软件包使用%post脚本 将shell名称添加到/ etc / shells。
如果您想在构建时执行其他内容,则需要依赖%build
或%install
部分。
答案 1 :(得分:1)