如何将参数传递给CentOS 7上的启动安装过程?
我需要安装多个具有类似配置的服务器,除了希望在安装之前传递给启动的一些不同之处。
发布于 2019-01-27 07:08:11
一种方法是创建syslinux简单启动菜单,
https://www.syslinux.org/doc/menu.txt
基于菜单选择,调用具有不同参数的内核,例如。
label foo
kernel vmlinuz
append initrd=initrd.img inst.ks=hd:LABEL=DATA:/path machinetype=foo
label bar
kernel vmlinuz
append initrd=initrd.img inst.ks=hd:LABEL=DATA:/path machinetype=bar这样传递的这个内核param可以在你的启动文件中被解析,
%post
machinetype=$(grep -o machinetype=[a-zA-Z]* /proc/cmdline| cut -d '=' -f 2)
# $machinetype now contains the input passed during boot.https://serverfault.com/questions/924467
复制相似问题