Show Table of Contents
33.11. 安装后脚本

图 33.14. 安装后脚本
还可以添加系统在安装结束后要执行的命令。如果在 kickstart 文件中正确地配置了网络,则会启用该网络,同时该脚本中就可以包含访问网络资源的命令。如果您想包括一个安装后脚本,在文本区域内输入。
重要
Red Hat Enterprise Linux 之前的发行本中的 anaconda 版本包含可在预安装和后安装环境中提供 shell 命令的 busybox 版本。 Red Hat Enterprise Linux 6 中的 anaconda 不再包含 busybox,而使用 GNU bash 命令。
更多详情请参考 附录 G, 备选 busybox 命令。
重要
不要包括
%post,系统会自动添加。
例如,要改变新安装系统的欢迎信息(message of the day),请在
%post 部分加入下面的命令:
echo "Hackers will be punished" > /etc/motd注意
更多示例请参考 第 32.7.1 节 “示例”。
33.11.1. chroot 环境
要在 chroot 环境之外执行安装后脚本,请在 安装后脚本 窗口顶部点击选项后的复选框。这和在
%post 部分使用 --nochroot 命令是一样。
要在“安装后脚本”部分,但在 chroot 环境之外修改新安装的系统,必须使用基于
/mnt/sysimage/ 的目录名。
例如,如果选择 在 chroot 环境之外执行,前面的示例必须改成下面这样:
echo "Hackers will be punished" > /mnt/sysimage/etc/motd
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.