奇怪的是在这里倾覆。 我正在构build一个rpm包,这里是我的spec文件:
[root@localhost rpmbuild]# cat SPECS/generated.spec # The name of your package Name: sotoolkit # A short summary of your package Summary: Toolkit # The version of your package Version: 1.5 # The release number of your package Release: 1 #URL URL: https://github.blah blah blah # Any license you wish to list License: GPLv2 # What group this RPM would typically reside in Group: Development/Tools # Who packaged this RPM Packager: Me # The build architecture of this RPM (noarch/x86_64/i386/etc) Buildarch: noarch # You generally should not need to mess with this setting Buildroot: %{_tmppath}/%{name} # Change this extension to change the compression level in your RPM # tar / tar.gz / tar.bz2 Source0: %{name}.tar.gz # If you are having trouble building a package and need to disable # automatic dependency/provides checking, uncomment this: AutoReqProv: no # If this package has prerequisites, uncomment this line and # list them here - examples are already listed #Requires: bash, python >= 2.7 # A more verbose description of your package %description Toolkit v.1.5 # You probably do not need to change this %define debug_package %{nil} %prep %setup -q -c %build %install rsync -a . %{buildroot}/ ln -sf /integration/scripts/sotoolkit1.5/start.sh /usr/bin/sotoolkit %clean rm -rf %{buildroot} #%pre #%post #%preun %postun unlink /usr/bin/sotoolkit #%trigger #%triggerin #%triggerun %changelog * Tue Jul 18 2017 L.Popovski <l.pop@blah.com> - 1.5-1 %files %attr(0644, root, root) "/README" %attr(0755, root, root) %dir "/integration/scripts/sotoolkit1.5/changelog" %attr(0644, root, root) "/integration/scripts/sotoolkit1.5/changelog/fixes1.5.txt" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/check_if_single_or_multinode.sh" %attr(0755, root, root) %dir "/integration/scripts/sotoolkit1.5/log" %attr(0755, root, root) %dir "/integration/scripts/sotoolkit1.5/multinode" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/exp" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/firmware_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/fm_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/fs_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/functions_multi" %attr(0755, root, root) %dir "/integration/scripts/sotoolkit1.5/multinode/log_tools" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/log_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/log_tools/collectl_perf.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/log_tools/crashdump.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/log_tools/exp" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/log_tools/timediff.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/log_tools/vsp_collect.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/menu.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/node_tools.sh" %attr(0755, root, root) %dir "/integration/scripts/sotoolkit1.5/multinode/other_tools" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/other_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/other_tools/b6200_missing_cluster.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/other_tools/exp" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/other_tools/relaxhw.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/other_tools/syscheck.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/sset_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/multinode/sys_tools.sh" %attr(0755, root, root) %dir "/integration/scripts/sotoolkit1.5/multinode/tmp" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/replay_last_session.sh" %attr(0755, root, root) %dir "/integration/scripts/sotoolkit1.5/singlenode" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/exp" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/firmware_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/fm_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/fs_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/functions_single" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/guideme.sh" %attr(0755, root, root) %dir "/integration/scripts/sotoolkit1.5/singlenode/log_tools" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/log_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/log_tools/crashdump.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/log_tools/exp" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/menu.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/node_tools.sh" %attr(0755, root, root) %dir "/integration/scripts/sotoolkit1.5/singlenode/other_tools" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/other_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/other_tools/exp" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/other_tools/relaxhw.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/other_tools/syscheck.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/sset_tools.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/singlenode/sys_tools.sh" %attr(0755, root, root) %dir "/integration/scripts/sotoolkit1.5/singlenode/tmp" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/sotoolkit.sh" %attr(0755, root, root) "/integration/scripts/sotoolkit1.5/start.sh" %doc README
奇怪的是:
[root @ localhost rpmbuild]#rpm -e sotoolkit-1.5-1.noarch unlink:不能取消连接'/ usr / bin / sotoolkit':没有这样的文件或目录警告:%postun(sotoolkit-1.5-1.noarch)scriptlet失败,退出状态1 [root @ localhost rpmbuild]#
使用rpmlint进行检查时,没有发现与rpm相关的错误或警告
任何想法可能导致这一点?
我发现了这个问题:
在%install部分我错误地做了:
ln -sf /integration/scripts/sotoolkit1.5/start.sh /usr/bin/sotoolkit
然后在%postun我错了:
unlink /usr/bin/sotoolkit
相反,正确的做法是在%install:
mkdir -p %{buildroot}/usr/bin/ ln -s /integration/scripts/sotoolkit1.5/start.sh %{buildroot}/usr/bin/sotoolkit
然后将链接添加到%文件
/usr/bin/sotoolkit
%postun可以被删除,因为符号链接是文件的一部分,如果工具被卸载,将会被删除。