|
|
发表于 2025-9-4 07:52:47
|
显示全部楼层
本帖最后由 mygamexxx 于 2025-9-4 13:14 编辑
请葱大指点一下,合并了两个脚本(肯定有哪里不对,现在TFTP读取autoexec.ipxe后显示英文成功,就到了BOOT MANAGER):
#!ipxe
ifopen net0
ifstat
set quiet 1 #静默启动,1打开,注释掉不打开
##################################
#判断是否存在DHCP代理,如果存在代理,使用代理next-server地址
set mode dhcp
isset ${proxydhcp/next-server} && set mode proxy && sleep 10 && goto proxy
:no_prxoy
#默认HTTP,不通时TFTP
#默认参数为通过HTTP网启
set s_boot http://${next-server}
#如果存在proxydhcp/next-server,判断是否DHCP真代理,如果真代理,转到:proxy
isset ${proxydhcp/next-server} && iseq ${next-server} ${proxydhcp/next-server} && set mode dhcp_proxy
isset ${proxydhcp/next-server} && iseq ${next-server} ${proxydhcp/next-server} || goto proxy
sleep 10
#判断HTTP服务器是否开启,如果未开启,转为TFTP网启
isset http://${next-server}/autoexec.ipxe || set s_boot tftp://${next-server} && echo HTTP_DHCP_OFF && sleep 10
goto menu2
:proxy
#默认TFTP,有HTTP时使用HTTP
#默认参数为通过TFTP网启
set s_boot tftp://${proxydhcp/next-server}
#判断HTTP服务器是否开启,如果未开启,转为TFTP网启
isset http://${proxydhcp/next-server}/autoexec.ipxe && set s_boot http://${proxydhcp/next-server} && echo HTTP_proxy_ON && sleep 10
##################################
:menu2
isset ${ip} || dhcp
:start
menu iPXE Boot Menu --${s_boot}-${mode}
item --key 1 winpe 1.Boot WinPE 64 (wimboot)
item --key 2 local 2.Boot from local drive
item --key 3 config 3.Configure settings
item --key 4 shell 4.Drop to iPXE shell
item --key 5 reboot 5.Reboot computer
item --key 6 exit 6.Exit iPXE and continue BIOS boot
choose --timeout 10000 selected
goto ${selected}
:shell
echo Type 'exit' to get the back to the menu
shell
goto start
:reboot
reboot
:exit
exit
:config
config
goto start
:winpe
iseq ${platform} efi && set wbm bootmgfw.efi || set wbm bootmgr.exe
# kernel ${s_boot}/boot/wimboot
initrd ${s_boot}/boot/${wbm} ${wbm}
initrd ${s_boot}/boot/bcdpxe bcd
initrd ${s_boot}/boot/boot.sdi boot.sdi
initrd ${s_boot}/boot/boot.wim boot.wim
boot ${s_boot}/boot/wimboot
#从本地硬盘启动
:local
sanboot --no-describe --drive 0x80
:retry
imgfree
prompt Error! press any key to back menu
goto start
pxe
e
|
|