如何知道系统当前正在安装ISO

发布于 2024-09-26 16:49:22 字数 166 浏览 3 评论 0原文

我正在创建一个 RPM。该 RPM 将与 CentOS ISO 一起打包,并在安装 CentOs 时安装。也可以使用正常的 rpm 安装方法进行安装。但是,如果从 ISO 安装和通过 rpm 正常安装方法安装,rpm 安装的行为会有所不同。那么,问题是我如何知道系统当前是否正在安装ISO。

提前致谢。

I am creating an RPM. This RPM will be packed with the CentOS ISO and will install when CentOs is installed. This can also be installed using normal rpm installation method. But rpm installation need to behave differently if it is installed from ISO and installed by rpm normal installation method. So, the question is how do I know whether the system is currently installing the ISO.

Thanks in advance.

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

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

发布评论

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

评论(3

憧憬巴黎街头的黎明 2024-10-03 16:49:22

您可以在 %pre /%post 脚本中检查 /dev/cdrom 是否已挂载以及 /mnt/cdrom 是否包含安装光盘。

严格来说,RPM 应该与它们的安装方式无关,因此如果您在 RPM 中需要此功能,则很可能是一个有缺陷的设计,并且您尝试做的事情可以通过其他方式完成。

我建议查看 anaconda / kickstart 脚本。

You could check if /dev/cdrom is mounted and if the /mnt/cdrom contains the installation disc in the %pre /%post scripts.

Strictly speaking, RPMs should be agnostic to how they are installed, so the chances are if you need this in the RPM it's probably a flawed design and what you are trying to do can be done in some other way.

I would suggest looking at anaconda / kickstart scripts.

一场春暖 2024-10-03 16:49:22

绝对是一个有缺陷的设计。

永远不应该与 RPM 安装进行任何用户交互,这就是我打赌您正在尝试做的事情。

Definitely a flawed design.

There should never be any user interaction with an RPM install which is what I bet you are trying to do.

初心未许 2024-10-03 16:49:22

如果您从 live 操作系统安装,您可以在内核命令行中检查 /dev/live 或 liveimg 是否存在,
IE
[[ $(grep -c liveimg /proc/cmdline) != 0 ]] || [ -b readlink -f /dev/live ]

If you are installing from a live OS, you can check the existence of /dev/live or liveimg in kernel command line,
i.e.
[[ $(grep -c liveimg /proc/cmdline) != 0 ]] || [ -b readlink -f /dev/live ]

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