这些步骤来自运行CentOS 6.5的盒子.我只是尝试将RPM包转换为CPIO存档,并且惊讶地发现RPM中列出的文件但存档中没有.以下是采取的步骤.
列出RPM中的路径:
$rpm -qlp sssd-1.9.2-82.4.el6_4.x86_64.rpm | sort > rpm.lst
将RPM转换为CPIO存档:
$rpm2cpio sssd-1.9.2-82.4.el6_4.x86_64.rpm > sssd-1.9.2-82.4.el6_4.x86_64.cpio
保存存档中的文件列表.需要使用sed过滤器从路径名中删除前导点条目. RPM列表不需要这样做.
$cpio -i -t < sssd-1.9.2-82.4.el6_4.x86_64.cpio | sed -e 's|^.||' | sort > cpio.lst
最后,diff显示丢失的文件:
$diff -u cpio.lst rpm.lst --- cpio.lst 2015-07-16 19:54:06.020494348 +0530 +++ rpm.lst 2015-07-16 19:53:38.012494371 +0530 @@ -2,6 +2,7 @@ /etc/rc.d/init.d/sssd /etc/rwtab.d/sssd /etc/sssd +/etc/sssd/sssd.conf /usr/bin/sss_ssh_authorizedkeys /usr/bin/sss_ssh_knownhostsproxy /usr/lib64/ldb/modules/ldb/memberof.so @@ -102,6 +103,8 @@ /var/lib/sss /var/lib/sss/db /var/lib/sss/mc +/var/lib/sss/mc/group +/var/lib/sss/mc/passwd /var/lib/sss/pipes /var/lib/sss/pipes/private /var/lib/sss/pubconf
为什么RPM中存在文件但CPIO存档中缺少?我特别感兴趣的是/etc/sssd/sssd.conf,因为我想查看一个示例配置文件.我们使用的是比CentOS更早的sssd软件包.我使用CentOS的软件包重复了上述步骤.结果是一样的.
sssd spec文件中sssd.conf的条目是:
%ghost %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sssd/sssd.conf
从Maximum RPM引用%ghost指令:
By adding this directive to the line containing a file,RPM will know about the ghosted file,but will not add it to the package. However it still needs to be in the buildroot.
因此,转换为CPIO存档时,与rpm相同的包的rpm2cpio会跳过ghost文件.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。