英文:
rpm2cpio doesn't show every file included in the RPM package
问题
"whois"软件包使用Linux的"alternatives"系统(因为也许jwhois是一个替代品?)。它似乎将/usr/bin/whois打包为符号链接,但不清楚是如何实现的。运行rpm -qp --list whois-5.5.1-2.el8.x86_64.rpm
会显示以下内容:
/etc/whois.conf
/usr/bin/whois
/usr/bin/whois.md
...更多文件...
但是rpm2cpio whois-5.5.1-2.el8.x86_64.rpm | cpio -itv
显示了前一个命令中的所有文件,除了 /usr/bin/whois。
运行rpm -qf /usr/bin/whois
显示该文件确实由whois软件包提供,这个软件包确实使用了alternatives系统,可以通过运行rpm -qp --scripts whois-5.5.1-2.el8.x86_64.rpm
来查看,其中包括:
postinstall脚本(使用/bin/sh):
/usr/sbin/update-alternatives \
--install /usr/bin/whois \
whois /usr/bin/whois.md 30 \
然而,这并不能解释为什么/usr/bin/whois不会出现在cpio归档中。我有两种理论,但不知道如何确定哪一种是正确的:
- 文件/usr/bin/whois在RPM中是"特殊的",因此它不会出现在rpm2cpio中;或者
- Cpio检测到/usr/bin/whois是一个符号链接,它不指向归档中的另一个文件,因此不会列出它。
这是有关Linux的"alternatives"系统的信息收集。我希望制作自己的"alternative",但我不知道是否应该将符号链接包含在RPM中。
英文:
The "whois" package uses the Linux "alternatives" system (because maybe jwhois is an alternative?) It seems to package /usr/bin/whois as a symlink, but it's not clear how that is done. Running rpm -qp --list whois-5.5.1-2.el8.x86_64.rpm
gives this:
/etc/whois.conf
/usr/bin/whois
/usr/bin/whois.md
...more files...
However rpm2cpio whois-5.5.1-2.el8.x86_64.rpm | cpio -itv
shows all the files from the previous command except /usr/bin/whois.
Running rpm -qf /usr/bin/whois
shows that file is indeed provided by the whois package, which does use the alternatives system as can be seen by running rpm -qp --scripts whois-5.5.1-2.el8.x86_64.rpm
which includes:
postinstall scriptlet (using /bin/sh):
/usr/sbin/update-alternatives \
--install /usr/bin/whois \
whois /usr/bin/whois.md 30 \
However, that does not explain why /usr/bin/whois does not appear in the cpio archive. I have 2 theories, but I don't know how to determine which, if any is the correct one:
- The file /usr/bin/whois is "special" in the RPM so it doesn't appear in rpm2cpio; or
- Cpio detects that /usr/bin/whois is a symlink that doesn't point to another file in the archive, and thus does not list it.
This is information gathering about the Linux "alternatives" system. I wish to make my own "alternative", but I don't know if I should include the symlink in the RPM.
答案1
得分: 2
文件/usr/bin/whois实际上不包括在RPM中。它是通过对/usr/sbin/update-alternatives的调用生成的。
它似乎被包括进来是因为在规范文件中有一个%ghost指令。这确保了在卸载时它将被删除。
多个软件包可以使用%ghost指令指定相同的文件,rpm -qf
将显示它们属于两个软件包,并且只有在两个软件包都被卸载时才会被删除。
英文:
The file /usr/bin/whois is actually not included in the RPM. It is generated by the call to /usr/sbin/update-alternatives.
It appears to be included because of a %ghost directive in the spec file. This ensures that it will be removed on uninstall.
Multiple packages can specify the same file with the %ghost directive, and rpm -qf
will show that they belong to both packages, and thus will be removed only when both packages are uninstalled.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论