如何阻止在 RedHat 系统上安装 SUSE RPM

发布于 2024-12-07 06:03:46 字数 468 浏览 1 评论 0原文

我们有一个通过 RPM 分发的产品。我们创建 SUSE SLES10 SP1 RPM 和 RedHat 5.5 RPM。两者之间存在差异,如果您在 RedHat 计算机上安装 SUSE RPM,则事情将无法正常工作(通常是神秘的),反之亦然。

有没有办法防止 RedHay RPM 安装在 SUSE 系统上,反之亦然?我用谷歌搜索了一下,发现 http://www.rpm.org/ max-rpm/ch-rpm-multi.html 但这里的所有约束似乎都基于命令 uname 的输出,该命令不会告诉您是否正在运行 RedHat或苏塞。操作系统是Linux,架构是一样的。

我们有想法在安装脚本中添加检查,可以在 /etc/issue 文件中查找“Red Hat”或“SUSE”,但我真的希望有比这更好的选择。

We have a product that is distributed via RPMs. We create both SUSE SLES10 SP1 RPMs and RedHat 5.5 RPMs. There are differences between the two, things will not work correctly (often mysteriosly) if you install a SUSE RPM on a RedHat machine and vice versa.

Is there a way to prevent a RedHay RPM from being installed on a SUSE system and vice versa? I googled around for this and found http://www.rpm.org/max-rpm/ch-rpm-multi.html but all the constraints here seem to be based on the output from the command uname which doesn't tell you if you're running RedHat or Suse. The os is Linux, and the architecture is the same.

We have ideas to add checks in the install script that can look for 'Red Hat' or 'SUSE' in the /etc/issue file but I'm really hoping there is a better option than this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迷迭香的记忆 2024-12-14 06:03:46

由于您只是想检测 RedHat,因此请查找是否存在名为 /etc/redhat-release 的文件。如果存在,则表明您正在安装 RedHat 的某个版本。

Since you're specifically just looking to detect RedHat, look for the presence of a file named /etc/redhat-release. If it's there, you're installing on some version of RedHat.

笑,眼淚并存 2024-12-14 06:03:46

您可以依赖特定于 redhat 的软件包(尽管 SuSE 可能提供版本)。

您还可以让 %pre 检查 /etc/redhat-release (或 lsb-release 等)是否支持操作系统。

在 %pre 而不是 %post 中进行任何预安装检查,因为否则它们会在软件包安装后发生(%post 不会真正失败)

You can place a dependency on a redhat-specific package (although SuSE may provide a version).

You could also have your %pre check /etc/redhat-release (or lsb-release etc) for supported OS.

Do any pre-install checks in %pre, not %post, because otherwise they will happen after the package is already installed (%post cannot really fail usefully)

乱世争霸 2024-12-14 06:03:46

另外,您可以检查 %{rhel} 宏是否在规范文件中定义。

Also, you can check if the %{rhel} macro is defined in the spec file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文