Nat*_*Coy 6 scripting centos kickstart
我一直在 CentOS 上使用 Kickstart 设置机器,但我不确定kickstart文件的%pre和%post部分之间的区别.cfg。
预安装脚本的 CentOS 文档指出:
You can add commands to run on the system immediately after the ks.cfg has been parsed.
Run Code Online (Sandbox Code Playgroud)
虽然安装后脚本的部分指出:
You have the option of adding commands to run on the system once the installation is complete.
Run Code Online (Sandbox Code Playgroud)
在阅读了这个问题之后,我注意到该%pre部分似乎无法以某种方式访问文件系统。
我的问题是:
%pre和%post部分有什么区别?%pre部分是否与 kickstart 脚本同时运行(解析后)?%pre在 kickstart 脚本部分是否有可用的持久存储?jsb*_*ngs 11
该%pre部分在 anaconda 评估 kickstart 文件的其余部分之前运行,在安装程序的第二阶段启动之后。这意味着您可以在%pre其中创建可以包含%include /tmp/somefile在 kickstart 配置中的文件。 %post在软件包安装和引导加载程序设置完成后运行。
RHEL 文档说 %pre 在解析 kickstart 后执行,但可以通过 %include 语句动态地为 kickstart 创建附加内容。https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-kickstart2-preinstallconfig.html
通常,您在 中使用可写的 /tmp 目录%pre,该目录对生成的操作系统不具有持久性。它只是一个虚拟磁盘。 %postchrooted 运行到新的安装根目录中,或者它可以在 anaconda 的根目录中运行(使用%post --nochroot),您可以在其中访问您可能在%pre.