centos – rpm2cpio从RPM跳过文件

这些步骤来自运行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文件.

相关文章

文章浏览阅读903次。4.清除缓存目录(/var/cache/yum)下的软件...
文章浏览阅读1.5k次。Python 是一种高级解释性编程语言,已被...
文章浏览阅读2.6k次。打开终端或控制台,以root或具有sudo权...
文章浏览阅读744次,点赞24次,收藏26次。目标:通过AppSrv为...
文章浏览阅读1.1w次,点赞8次,收藏26次。chmod命令来自于英...
文章浏览阅读1.2k次。yum源的URL地址,本例中是文件系统的路...