pxe装机shell脚本,将脚本保存为pxe.sh,将ks.cfg、efi.ks.cfg文件与pxe.sh放在同一目录,挂载centos7安装光盘
#!/bin/bash
#pxe install script
#version:v1.0
#
if [ -f $PWD/ks.cfg ] && [ -f $PWD/efi.ks.cfg ]
then
echo "ks.cfg and efi.ks.cofg file exists!"
break
elif [ -f $PWD/ks.cfg ]
then
echo "ks.cfg file exists!"
break
elif [ -f $PWD/efi.ks.cfg ]
then
echo "efi.ks.cfg file exists!"
break
else
echo "efi.ks.cfg or ks.cfg file does not exist!"
exit
fi
##########function definition##########
#tftp file
TFTP_FILE(){
cat > $PWD/pxe_install/tftp << EOF
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
serve