You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kickstart技术咨询:如何通过%pre逻辑确定%packages的包选择?

Conditional Package Selection in Kickstart's %packages Section

I've done extensive digging and haven't come across any existing examples of using logical conditions to select packages or package groups directly in the %packages section of a Kickstart file.

My goal is to make Kickstart install packages based on criteria I gather in the %pre section, but since conditional logic in %packages seems to be uncharted territory, I thought I could generate a dynamic package list file in %pre and pull it into %packages using %include. Unfortunately, this approach hits snags when using %include inside %packages on Red Hat-based systems.

Potential Workarounds to Explore

  • Modify the Kickstart file directly in %pre: Instead of relying on %include, write a %pre script that appends or edits the package list in the active Kickstart file (usually located at /root/anaconda-ks.cfg during installation). When the installer reaches the %packages section, it will process the updated list automatically.
  • Use custom package groups with conditional flags: If your selection criteria map to specific system roles, define custom package groups in a local file or repository. Then use %pre to set environment variables that tell the installer to enable or disable these groups during the package selection phase.
  • Defer conditional installs to %post: If the packages don't need to be part of the initial system image, handle conditional installations in the %post section using dnf or yum commands. This method is simpler but adds a post-installation step rather than integrating with the core package selection process.

内容的提问来源于stack exchange,提问作者Michael Moser

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 04:20:37