无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
查看: 4610|回复: 4

[原创] [史上最伟大网管]miniLinux网启server撒旦单文件版使用技巧和ipxe脚本解释20190814

  [复制链接]
发表于 2019-8-11 09:43:07 | 显示全部楼层 |阅读模式
本帖最后由 江南一根葱 于 2019-8-14 19:27 编辑

工具及下载链接:http://bbs.wuyou.net/forum.php?mod=viewthread&tid=415752&page=1&extra=#pid3836856
前炎:向睾手丸家们致敬,睾手就不需要细看帖子享受我的班门弄腐了,本帖适合入门学习党,比如会问“为什么 启不来pe啊?为什么开机执行不了我指定的批处理啊?”这类菜鸟(我是老菜鸟)新手玩家(95后00后叫萌新)

传统bios:直接用我的tftpboot目录,启动时会chain app/config/tinycore.ipxe,对此脚本文件的建议和解释如下:

#!ipxe
#这句脚本是读取本地文件用,不用管
ifopen net0
#同上
ifstat
#设置pe的路径
set pe64wimfile= /boot/pe64.wim
set pe32wimfile= /boot/pe32.wim
#设置efi和bios下环境的不同菜单
iseq ${platform} pcbios && set mainmenu grub4dos ||
iseq ${platform} efi && set mainmenu grub2 ||

#这个我自己调试用的
set getfile /app/config/tinycore.ipxe
#设置菜单超时时间  
   set menu-timeout 8000
#设置菜单默认选中启动的项
   set menu-default netgrubfm

:boot
#找不到next-server变量就把dhcp-server的变量值给它
isset ${next-server} || set next-server ${dhcp-server}

#找不到proxydhcp/next-server变量就把proxydhcp/dhcp-server的变量值给它
isset ${proxydhcp/next-server} || set proxydhcp/next-server ${proxydhcp/dhcp-server}

#如果proxydhcp/next-server变量值存在,那么赋给booturl,不然就使用next-server的变量值
isset ${proxydhcp/next-server} && set booturl ${proxydhcp/next-server} || set booturl ${next-server}

#备用 prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||

:menu
goto start
#菜单项我就不解释了
:start
  menu Choose An Existing Server!  Serverip:${serverip} bootfile: ${getfile}
   item --gap --             --------------------------------PXE BOOT-----------------------------
   item ${mainmenu}          ${mainmenu} menu
   item win10pex64           win10pe x64
   item win10pex32           win10pe x32
   item gitcloud                   Cloud Boot
   item retry                         set filename   

  item --gap --             ---------------------------- Advanced options -----------------------
  item --key c config       Configure settings                                   -- c
  item --key p pxelinux     Load PXELinux menu                                   -- p
  item shell                Drop to iPXE shell
  item reboot               Reboot computer
  item --key x exit         Exit iPXE and continue BIOS boot                     -- x
  choose --timeout ${menu-timeout} --default ${menu-default} selected
  goto ${selected}


#云启动
:gitcloud
echo Cloud Boot
chain https://raw.githubusercontent.com/zwj4031/netboot/master${getfile} || set menu-default retry ||
goto start

#启动bios版grub2文件管理器
:grub4dos
set next-server ${proxydhcp/next-server} && chain tftp://${booturl}/grub4dos/managerpxe ||
goto retryip

:grub2
isset ${proxydhcp/dhcp-server} && imgexec http://${proxydhcp/dhcp-server}/grub2/grubfmx64.efi proxydhcp=${proxydhcp/dhcp-server} ||
imgexec http://${dhcp-server}/grub2/grubfmx64.efi proxydhcp=${dhcp-server}
goto retryip


:wimboot
#假如取文件失败就换个地址
kernel http://${booturl}/app/wimboot/wimboot || goto retryip

#前方高能!这个ghost.bat最终会出现在你所有pe的X:\windows\system32目录下,不要再问来问去怎么启动pxeautorun.txt了!取不到说明你没放,会继续启动
#如果是我提供的pe,进入系统后会自动执行ghost.bat
initrd http://${booturl}/app/bat/ghost.bat ghost.bat || goto nextg
:nextg
#在bios和efi不同环境取相应的文件
  iseq ${platform} pcbios && initrd http://${booturl}/app/wimboot/bootmgr  bootmgr ||
  iseq ${platform} efi    && initrd http://${booturl}/app/wimboot/bootmgfw.efi bootx64.efi ||

  iseq ${platform} pcbios && initrd http://${booturl}/app/wimboot/biosbcd  bcd ||
  iseq ${platform} efi    && initrd http://${booturl}/app/wimboot/bcd  bcd ||

  initrd http://${booturl}/app/wimboot/boot.sdi   boot.sdi  || goto retry
  initrd -n boot.wim http://${booturl}${wimfile} || goto retry

   boot || goto retry

#设置选择win10pe x64并启动   
:win10pex64
set wimfile ${pe64wimfile=}
goto wimboot

#设置选择win10pe x32并启动   
:win10pex32
set wimfile ${pe32wimfile=}
goto wimboot

#我的云启动   
:retry
console
echo set Filename
read getfile
set menu-default gitcloud
goto start

#如果当前booturl变量值是proxydhcp/next-server,那么就换成next-server,反之亦然,我瞎写的,不知道语法有没有问题
:retryip
issq ${booturl} ${proxydhcp/next-server} && set booturl ${next-server} && goto start ||
set booturl ${proxydhcp/next-server} && goto start



#下面都是些进入命令行模式,重启,退出,关机之类的,还有些备用项目,不用解释
:shell
  echo Type 'exit' to get the back to the menu
  shell
  goto start

:failed
  echo Booting failed, dropping to shell
  goto shell

:reboot
  reboot

:exit
  exit

:config
  config
  goto start





脚本应该还有些错误,待闲时更新














评分

参与人数 1无忧币 +5 收起 理由
sh1688 + 5 赞一个!

查看全部评分

发表于 2019-8-11 11:17:05 | 显示全部楼层
学习了 ,感谢楼主!
回复

使用道具 举报

发表于 2019-8-11 13:04:41 | 显示全部楼层

学习了 ,感谢楼主!
回复

使用道具 举报

发表于 2019-8-11 14:38:31 | 显示全部楼层
学习了 ,感谢楼主       风水   起名   算命  算卦   风水大师   起名大师  算命大师   公司起名  宝宝起名   鱼火锅加盟   鱼火锅  鱼火锅加盟店  酸菜鱼快餐  酸菜鱼加盟   酸菜鱼米饭   铁托盘   钢托盘  托盘厂家  托盘价格   出口托盘   金属托盘   www.tdszx.com  www.jyhxjm.com  www.gztpcj.com
回复

使用道具 举报

发表于 2019-8-20 12:36:08 | 显示全部楼层
楼主真是好,这个对于我这种新手来说绝B是有很大的帮助的,谢谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-4-19 10:08

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表