fdgkldfghjsad规划局热太远了 |
kenvpn 发表于 2019-10-19 01:12 不好意思 因嫌百度更新麻煩已刪除又忘記更新 請從主機下載 |
本帖最后由 江南一根葱 于 2019-8-6 07:52 编辑 hkkitlee 2019-8-6 00:27 共用吧,菜单还得分开写 |
江南一根葱 发表于 2019-8-5 21:57 ipxe script寫得"完整"是bios/uefi通用的,ipxe.efi可以不用折騰 |
江南一根葱 发表于 2019-8-5 21:50 我在Centos7: grub2-install --target=x86_64-efi --efi-directory=efi/ --boot-directory=efi/EFI --removable --recheck grub2-install --target=i386-pc --recheck --boot-directory=efi/EFI /dev/loop8 同一盤安裝兩個啟動,就是grub.cfg會放在不同的資料夾;不是一個cfg共用的.......... 煩人 |
hkkitlee 发表于 2019-8-5 21:39 grub2做一般菜单还是挺简单的, 就是不支持https,启不了github上的文件,ipxe已经可以了。。。 |
江南一根葱 发表于 2019-8-5 20:33 我因為做這U盤,又跳進grub2這苦海 |
lhb9900 发表于 2019-8-4 14:27 其實你可以用這個u盤:根據「本帖2#樓的教學」將你不同架構的引導文件「命名」「放入」在TC的「網絡磁碟」中,就可以使用你自己的引導給客戶機使用。 這個「u 盤」提供的是pxe環境,引導檔這類「軟件」是沒有限制的!!隨你喜歡的 |
本帖最后由 hkkitlee 于 2019-8-4 14:45 编辑 lhb9900 发表于 2019-8-4 14:27 我不會移植的啦 1我的u盤以小巧為主。一般系統最小也得幾百MB!是一定不放u盤內 2我u盤是要可線上更新。 3Grub2從編譯到腳本可真是牛刀。也因為做此u盤才*再*慢慢學習。 4好像沒https支援 論功能說,grub2跟操作系統差不了多小。 |
本帖最后由 lhb9900 于 2019-8-4 14:29 编辑 hkkitlee 发表于 2019-8-4 14:23 是的,你可以慢慢移植 |
lhb9900 发表于 2019-8-4 14:12 這是否grub2的grub.cfg啟動腳本? |
hkkitlee 发表于 2019-8-4 14:05 menuentry "[L]用Linux方式启动ISO" --hotkey="L" --class iso{ echo (正在查找ISO内的Linux启动文件,请等待。。即将菜单末尾列出启动文件) set k="1" GetHotkey regexp -s 1:devstr -s 2:path '\((.*)\)(.*)' "$grub_file" for cfg in /boot/grub/loopback.cfg /efi/boot/loopback.cfg /EFI/BOOT/loopback.cfg; do if ! test -e (isoloop)$cfg; then continue; fi cat -s cfgtext (isoloop)$cfg if regexp '/grub/grub.cfg' "$cfgtext"; then if ! test -e (isoloop)/grub/grub.cfg; then continue; fi fi if regexp '/casper/initrd.lz' "$cfgtext"; then if ! test -e (isoloop)/casper/initrd.lz; then continue; fi fi menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" "$cfg" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) probe -u -s rootuuid $4 export rootuuid set iso_path="$3" export iso_path loopback isoloop "$2" set root=isoloop configfile $5 loopback -d isoloop } unset cfgtext loopback -d isoloop return 0 done for cfg in /boot/grub/grub.cfg /EFI/BOOT/grub.cfg /EFI/boot/grub.cfg /boot/grub2/grub.cfg \ /efi/boot/grub.cfg /isolinux/live.cfg /boot/isolinux/isolinux.cfg /slax/boot/syslinux.cfg /isolinux/txt.cfg; do if ! test -e (isoloop)$cfg; then continue; fi cat -s cfgtext (isoloop)$cfg if regexp 'iso_path' "$cfgtext"; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" "$cfg" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) probe -u -s rootuuid $4 export rootuuid set iso_path="$3" export iso_path loopback isoloop "$2" set root=isoloop configfile $5 loopback -d isoloop } set loopok=1 elif regexp 'boot=casper' "$cfgtext"; then if test -f (isoloop)/casper/filesystem.squashfs -a -f (isoloop)/casper/vmlinu* -a -f (isoloop)/casper/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for preseed in (isoloop)/preseed/*; do regexp -s preseed '\(isoloop\)(.*)' "$preseed" preseed="file=/cdrom/${preseed}" break done for vmlinuz in (isoloop)/casper/vmlinu*; do linux $vmlinuz ${preseed} boot=casper locale=zh_CN locales=zh_CN.UTF-8 iso-scan/filename=${3} quiet splash --- unset vmlinuz break done for initrd in (isoloop)/casper/initr*; do initrd $initrd unset initrd break done } set loopok=1 fi elif regexp 'boot=live' "$cfgtext"; then if test -f (isoloop)/live/filesystem.squashfs -a -f (isoloop)/live/vmlinu* -a -f (isoloop)/live/initr*; then if regexp 'menuentry "Clonezilla' "$cfgtext"; then set params="union=overlay username=user config noswap edd=on nomodeset locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" vga=788 ip= net.ifnames=0 nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1"; elif regexp 'menuentry "GParted' "$cfgtext"; then set params="union=overlay username=user config noswap ip= net.ifnames=0 nosplash"; else set params="splash"; fi menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$params" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for vmlinuz in (isoloop)/live/vmlinu*; do linux $vmlinuz boot=live locale=zh_CN locales=zh_CN.UTF-8 findiso=${3} components quiet ${4} unset vmlinuz break done for initrd in (isoloop)/live/initr*; do initrd $initrd unset initrd break done } set loopok=1 fi elif regexp 'rd.live.image' "$cfgtext"; then if test -d (isoloop)/LiveOS; then set isodev="UUID" if test -f (isoloop)/images/pxeboot/vmlinu* -a -f (isoloop)/images/pxeboot/initr*; then set bootpath="/images/pxeboot"; elif test -f (isoloop)/isolinux/vmlinu* -a -f (isoloop)/isolinux/initr*; then set bootpath="/isolinux"; elif test -f (isoloop)/boot/*/loader/linu* -a -f (isoloop)/boot/*/loader/initr*; then for bootpath in /boot/*/loader; do if test -d (isoloop)$bootpath; then set isodev="CDLABEL"; break; fi done fi fi if [ -n "$bootpath" ]; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$bootpath" "$isodev" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" if [ "$5" == "UUID" ]; then probe -u -s isouuid isoloop; else probe -l -s isouuid isoloop; fi for vmlinuz in (isoloop)${4}/vmlinu* (isoloop)${4}/linu*; do if ! test -e $vmlinuz; then continue; fi linux $vmlinuz root=live:${5}=${isouuid} rd.live.image quiet iso-scan/filename=${3} unset vmlinuz unset isouuid break done for initrd in (isoloop)${4}/initr*; do if ! test -e $initrd; then continue; fi initrd $initrd unset initrd break done } unset isodev unset bootpath set loopok=1 fi elif regexp 'inst.stage2=hd:' "$cfgtext"; then if test -f (isoloop)/images/pxeboot/vmlinu* -a -f (isoloop)/images/pxeboot/initr* -a -d (isoloop)/LiveOS; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s isouuid isoloop for vmlinuz in (isoloop)/images/pxeboot/vmlinu*; do linux $vmlinuz inst.stage2=hd:UUID=${isouuid} rd.live.image quiet iso-scan/filename=${3} unset vmlinuz unset isouuid break done for initrd in (isoloop)/images/pxeboot/initr*; do initrd $initrd unset initrd break done } set loopok=1 fi elif regexp "initrd=/boot/initrd.gz root=/dev/ram0 vga=normal" "$cfgtext"; then if test -f (isoloop)/boot/initrd.gz -a -f (isoloop)/boot/bzImage; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/boot/bzImage root=/dev/ram0 vga=normal initrd (isoloop)/boot/initrd.gz } set loopok=1 fi elif regexp "tinycore.gz" "$cfgtext"; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$cfg" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" set root=isoloop if regexp 'isolinux.cfg' "$3"; then syslinux_configfile $3; else configfile $3; fi } set loopok=1 fi unset cfgtext if [ -n "$loopok" ]; then loopback -d isoloop; unset loopok; return 0; fi done if test -f (isoloop)/casper/filesystem.squashfs -a -f (isoloop)/casper/vmlinu* -a -f (isoloop)/casper/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for preseed in (isoloop)/preseed/*; do regexp -s preseed '\(isoloop\)(.*)' "$preseed" preseed="file=/cdrom/${preseed}" break done for vmlinuz in (isoloop)/casper/vmlinu*; do linux $vmlinuz ${preseed} boot=casper iso-scan/filename=${3} quiet splash --- unset vmlinuz break done for initrd in (isoloop)/casper/initr*; do initrd $initrd unset initrd break done } set loopok=1 elif test -f (isoloop)/live/filesystem.squashfs -a -f (isoloop)/live/vmlinu* -a -f (isoloop)/live/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for vmlinuz in (isoloop)/live/vmlinu*; do linux $vmlinuz boot=live findiso=${3} components quiet splash unset vmlinuz break done for initrd in (isoloop)/live/initr*; do initrd $initrd unset initrd break done } set loopok=1 elif test -f (isoloop)/arch/boot/intel_ucode.img -a -f (isoloop)/arch/boot/*/archiso.img -a -f (isoloop)/arch/boot/*/vmlinuz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s devuuid $4 for vmlinuz in (isoloop)/arch/boot/*/vmlinuz; do linux $vmlinuz img_loop=${3} img_dev=/dev/disk/by-uuid/$devuuid earlymodules=loop unset vmlinuz unset devuuid break done for initrd in (isoloop)/arch/boot/*/archiso.img; do initrd (isoloop)/arch/boot/intel_ucode.img $initrd unset initrd break done } set loopok=1 elif test -f (isoloop)/antiX/vmlinu* -a -f (isoloop)/antiX/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for vmlinuz in (isoloop)/antiX/vmlinu*; do linux $vmlinuz quiet fromiso=${3} from=usb,cd,hd unset vmlinuz break done for initrd in (isoloop)/antiX/initr*; do initrd $initrd unset initrd break done } set loopok=1 elif test -e (isoloop)/rescue/livecd.squashfs -a -e (isoloop)/boot/kernel.x86_64-efi -a -e (isoloop)/boot/initfs.x86_64-efi \ -a -e (isoloop)/boot/kernel.i386-pc -a -e (isoloop)/boot/initfs.i386-pc; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" if cpuid -l; then set arch="x86_64-efi"; else set arch="i386-pc"; fi linux (isoloop)/boot/kernel.${arch} root=/dev/ram0 real_root=/dev/loop0 loop=/rescue/livecd.squashfs cdroot_marker=/rescue/livecd.squashfs initrd udev cdroot scandelay=10 quiet splash isoboot=${3} lang=en initrd (isoloop)/boot/initfs.${arch} } set loopok=1 elif test -e (isoloop)/pmagic/m64.img -a -e (isoloop)/pmagic/m32.img -a -e (isoloop)/pmagic/bzImage64 -a -e (isoloop)/pmagic/bzImage \ -a -e (isoloop)/pmagic/fu.img -a -e (isoloop)/pmagic/initrd.img; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" if cpuid -l; then set bz="bzImage64"; set m="m64.img"; else set bz="bzImage"; set m="m32.img"; fi linux (isoloop)/pmagic/${bz} edd=on vga=normal iso_filename=${3} initrd (isoloop)/pmagic/initrd.img (isoloop)/pmagic/fu.img (isoloop)/pmagic/${m} } set loopok=1 elif test -e (isoloop)/image.squashfs -a -e (isoloop)/livecd -a -e (isoloop)/isolinux/gentoo -a -e (isoloop)/isolinux/gentoo.igz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot vga=791 isoboot=${3} initrd (isoloop)/isolinux/gentoo.igz } set loopok=1 elif test -e (isoloop)/image.squashfs -a -e (isoloop)/livecd -a -e (isoloop)/isolinux/gentoo -a -e (isoloop)/isolinux/gentoo.xz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap aufs looptype=squashfs loop=/image.squashfs cdroot console=tty1 isoboot=${3} initrd (isoloop)/isolinux/gentoo.xz } set loopok=1 elif test -e (isoloop)/slax/boot/vmlinuz -a -e (isoloop)/slax/boot/initrfs.img; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/slax/boot/vmlinuz vga=normal load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 slax.flags=automount from=$3 initrd (isoloop)/slax/boot/initrfs.img } set loopok=1 elif test -e (isoloop)/liveslak -a -e (isoloop)/boot/generic -a -e (isoloop)/boot/initrd.img; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s deviceuuid $4 linux (isoloop)/boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=us tz=localtime locale=us_EN.utf8 livemedia=/dev/disk/by-uuid/${deviceuuid}:$3 initrd (isoloop)/boot/initrd.img } set loopok=1 elif test -e (isoloop)/wifislax64 -a -e (isoloop)/boot/vmlinuz -a -e (isoloop)/boot/initrd.xz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s deviceuuid $4 linux (isoloop)/boot/vmlinuz kbd=us tz=US/Pacific locale=en_US.utf8 xkb= rw livemedia=/dev/disk/by-uuid/${deviceuuid}:$3 initrd (isoloop)/boot/initrd.xz } set loopok=1 elif test -e (isoloop)/wifislax -a -e (isoloop)/boot/vmlinuz -a -e (isoloop)/boot/initrd.xz; then menuentry "[${k}] ${2} (Wifislax With KDE Desktop)" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/boot/vmlinuz noload=000-SMP\;006-Xfce load=English from=${3} initrd (isoloop)/boot/initrd.xz } GetHotkey menuentry "[${k}] ${2} (Wifislax With Xfce Desktop)" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/boot/vmlinuz noload=000-SMP\;005-Kde load=English from=${3} initrd (isoloop)/boot/initrd.xz } set loopok=1 elif test -e (isoloop)/suse -a -e (isoloop)/boot/*/loader/initrd -a -e (isoloop)/boot/*/loader/linux; then for vmlinuz in (isoloop)/boot/*/loader/linux; do if ! test -e $vmlinuz; then continue; fi break done for initrd in (isoloop)/boot/*/loader/initrd; do if ! test -e $initrd; then continue; fi break done submenu "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$vmlinuz" "$initrd" --hotkey="${k}" --class ArrowR { menuentry "[1] Installation" "$2" "$3" "$4" "$5" --hotkey=1 { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux ${4} splash=silent install=hd:${3} initrd ${5} } menuentry "[2] Upgrade" "$grub_file" "$path" "$4" "$5" --hotkey=2 { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux ${4} splash=silent upgrade=1 install=hd:${3} initrd ${5} } } unset vmlinuz unset initrd set loopok=1 fi if [ -n "$loopok" ]; then loopback -d isoloop; unset loopok; return 0; fi loopback -d isoloop } |
lhb9900 发表于 2019-8-4 14:10 这是较完整LINUX启动脚本,看看就头疼,一直在寻找LINUX整体ISO的方法 |
hkkitlee 发表于 2019-8-4 14:05 menuentry "[L]用Linux方式启动ISO" --hotkey="L" --class iso{ echo (正在查找ISO内的Linux启动文件,请等待。。即将菜单末尾列出启动文件) set k="1" GetHotkey regexp -s 1:devstr -s 2:path '\((.*)\)(.*)' "$grub_file" for cfg in /boot/grub/loopback.cfg /efi/boot/loopback.cfg /EFI/BOOT/loopback.cfg; do if ! test -e (isoloop)$cfg; then continue; fi cat -s cfgtext (isoloop)$cfg if regexp '/grub/grub.cfg' "$cfgtext"; then if ! test -e (isoloop)/grub/grub.cfg; then continue; fi fi if regexp '/casper/initrd.lz' "$cfgtext"; then if ! test -e (isoloop)/casper/initrd.lz; then continue; fi fi menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" "$cfg" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) probe -u -s rootuuid $4 export rootuuid set iso_path="$3" export iso_path loopback isoloop "$2" set root=isoloop configfile $5 loopback -d isoloop } unset cfgtext loopback -d isoloop return 0 done for cfg in /boot/grub/grub.cfg /EFI/BOOT/grub.cfg /EFI/boot/grub.cfg /boot/grub2/grub.cfg \ /efi/boot/grub.cfg /isolinux/live.cfg /boot/isolinux/isolinux.cfg /slax/boot/syslinux.cfg /isolinux/txt.cfg; do if ! test -e (isoloop)$cfg; then continue; fi cat -s cfgtext (isoloop)$cfg if regexp 'iso_path' "$cfgtext"; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" "$cfg" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) probe -u -s rootuuid $4 export rootuuid set iso_path="$3" export iso_path loopback isoloop "$2" set root=isoloop configfile $5 loopback -d isoloop } set loopok=1 elif regexp 'boot=casper' "$cfgtext"; then if test -f (isoloop)/casper/filesystem.squashfs -a -f (isoloop)/casper/vmlinu* -a -f (isoloop)/casper/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for preseed in (isoloop)/preseed/*; do regexp -s preseed '\(isoloop\)(.*)' "$preseed" preseed="file=/cdrom/${preseed}" break done for vmlinuz in (isoloop)/casper/vmlinu*; do linux $vmlinuz ${preseed} boot=casper locale=zh_CN locales=zh_CN.UTF-8 iso-scan/filename=${3} quiet splash --- unset vmlinuz break done for initrd in (isoloop)/casper/initr*; do initrd $initrd unset initrd break done } set loopok=1 fi elif regexp 'boot=live' "$cfgtext"; then if test -f (isoloop)/live/filesystem.squashfs -a -f (isoloop)/live/vmlinu* -a -f (isoloop)/live/initr*; then if regexp 'menuentry "Clonezilla' "$cfgtext"; then set params="union=overlay username=user config noswap edd=on nomodeset locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" vga=788 ip= net.ifnames=0 nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1"; elif regexp 'menuentry "GParted' "$cfgtext"; then set params="union=overlay username=user config noswap ip= net.ifnames=0 nosplash"; else set params="splash"; fi menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$params" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for vmlinuz in (isoloop)/live/vmlinu*; do linux $vmlinuz boot=live locale=zh_CN locales=zh_CN.UTF-8 findiso=${3} components quiet ${4} unset vmlinuz break done for initrd in (isoloop)/live/initr*; do initrd $initrd unset initrd break done } set loopok=1 fi elif regexp 'rd.live.image' "$cfgtext"; then if test -d (isoloop)/LiveOS; then set isodev="UUID" if test -f (isoloop)/images/pxeboot/vmlinu* -a -f (isoloop)/images/pxeboot/initr*; then set bootpath="/images/pxeboot"; elif test -f (isoloop)/isolinux/vmlinu* -a -f (isoloop)/isolinux/initr*; then set bootpath="/isolinux"; elif test -f (isoloop)/boot/*/loader/linu* -a -f (isoloop)/boot/*/loader/initr*; then for bootpath in /boot/*/loader; do if test -d (isoloop)$bootpath; then set isodev="CDLABEL"; break; fi done fi fi if [ -n "$bootpath" ]; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$bootpath" "$isodev" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" if [ "$5" == "UUID" ]; then probe -u -s isouuid isoloop; else probe -l -s isouuid isoloop; fi for vmlinuz in (isoloop)${4}/vmlinu* (isoloop)${4}/linu*; do if ! test -e $vmlinuz; then continue; fi linux $vmlinuz root=live:${5}=${isouuid} rd.live.image quiet iso-scan/filename=${3} unset vmlinuz unset isouuid break done for initrd in (isoloop)${4}/initr*; do if ! test -e $initrd; then continue; fi initrd $initrd unset initrd break done } unset isodev unset bootpath set loopok=1 fi elif regexp 'inst.stage2=hd:' "$cfgtext"; then if test -f (isoloop)/images/pxeboot/vmlinu* -a -f (isoloop)/images/pxeboot/initr* -a -d (isoloop)/LiveOS; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s isouuid isoloop for vmlinuz in (isoloop)/images/pxeboot/vmlinu*; do linux $vmlinuz inst.stage2=hd:UUID=${isouuid} rd.live.image quiet iso-scan/filename=${3} unset vmlinuz unset isouuid break done for initrd in (isoloop)/images/pxeboot/initr*; do initrd $initrd unset initrd break done } set loopok=1 fi elif regexp "initrd=/boot/initrd.gz root=/dev/ram0 vga=normal" "$cfgtext"; then if test -f (isoloop)/boot/initrd.gz -a -f (isoloop)/boot/bzImage; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/boot/bzImage root=/dev/ram0 vga=normal initrd (isoloop)/boot/initrd.gz } set loopok=1 fi elif regexp "tinycore.gz" "$cfgtext"; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$cfg" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" set root=isoloop if regexp 'isolinux.cfg' "$3"; then syslinux_configfile $3; else configfile $3; fi } set loopok=1 fi unset cfgtext if [ -n "$loopok" ]; then loopback -d isoloop; unset loopok; return 0; fi done if test -f (isoloop)/casper/filesystem.squashfs -a -f (isoloop)/casper/vmlinu* -a -f (isoloop)/casper/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for preseed in (isoloop)/preseed/*; do regexp -s preseed '\(isoloop\)(.*)' "$preseed" preseed="file=/cdrom/${preseed}" break done for vmlinuz in (isoloop)/casper/vmlinu*; do linux $vmlinuz ${preseed} boot=casper iso-scan/filename=${3} quiet splash --- unset vmlinuz break done for initrd in (isoloop)/casper/initr*; do initrd $initrd unset initrd break done } set loopok=1 elif test -f (isoloop)/live/filesystem.squashfs -a -f (isoloop)/live/vmlinu* -a -f (isoloop)/live/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for vmlinuz in (isoloop)/live/vmlinu*; do linux $vmlinuz boot=live findiso=${3} components quiet splash unset vmlinuz break done for initrd in (isoloop)/live/initr*; do initrd $initrd unset initrd break done } set loopok=1 elif test -f (isoloop)/arch/boot/intel_ucode.img -a -f (isoloop)/arch/boot/*/archiso.img -a -f (isoloop)/arch/boot/*/vmlinuz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s devuuid $4 for vmlinuz in (isoloop)/arch/boot/*/vmlinuz; do linux $vmlinuz img_loop=${3} img_dev=/dev/disk/by-uuid/$devuuid earlymodules=loop unset vmlinuz unset devuuid break done for initrd in (isoloop)/arch/boot/*/archiso.img; do initrd (isoloop)/arch/boot/intel_ucode.img $initrd unset initrd break done } set loopok=1 elif test -f (isoloop)/antiX/vmlinu* -a -f (isoloop)/antiX/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for vmlinuz in (isoloop)/antiX/vmlinu*; do linux $vmlinuz quiet fromiso=${3} from=usb,cd,hd unset vmlinuz break done for initrd in (isoloop)/antiX/initr*; do initrd $initrd unset initrd break done } set loopok=1 elif test -e (isoloop)/rescue/livecd.squashfs -a -e (isoloop)/boot/kernel.x86_64-efi -a -e (isoloop)/boot/initfs.x86_64-efi \ -a -e (isoloop)/boot/kernel.i386-pc -a -e (isoloop)/boot/initfs.i386-pc; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" if cpuid -l; then set arch="x86_64-efi"; else set arch="i386-pc"; fi linux (isoloop)/boot/kernel.${arch} root=/dev/ram0 real_root=/dev/loop0 loop=/rescue/livecd.squashfs cdroot_marker=/rescue/livecd.squashfs initrd udev cdroot scandelay=10 quiet splash isoboot=${3} lang=en initrd (isoloop)/boot/initfs.${arch} } set loopok=1 elif test -e (isoloop)/pmagic/m64.img -a -e (isoloop)/pmagic/m32.img -a -e (isoloop)/pmagic/bzImage64 -a -e (isoloop)/pmagic/bzImage \ -a -e (isoloop)/pmagic/fu.img -a -e (isoloop)/pmagic/initrd.img; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" if cpuid -l; then set bz="bzImage64"; set m="m64.img"; else set bz="bzImage"; set m="m32.img"; fi linux (isoloop)/pmagic/${bz} edd=on vga=normal iso_filename=${3} initrd (isoloop)/pmagic/initrd.img (isoloop)/pmagic/fu.img (isoloop)/pmagic/${m} } set loopok=1 elif test -e (isoloop)/image.squashfs -a -e (isoloop)/livecd -a -e (isoloop)/isolinux/gentoo -a -e (isoloop)/isolinux/gentoo.igz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot vga=791 isoboot=${3} initrd (isoloop)/isolinux/gentoo.igz } set loopok=1 elif test -e (isoloop)/image.squashfs -a -e (isoloop)/livecd -a -e (isoloop)/isolinux/gentoo -a -e (isoloop)/isolinux/gentoo.xz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap aufs looptype=squashfs loop=/image.squashfs cdroot console=tty1 isoboot=${3} initrd (isoloop)/isolinux/gentoo.xz } set loopok=1 elif test -e (isoloop)/slax/boot/vmlinuz -a -e (isoloop)/slax/boot/initrfs.img; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/slax/boot/vmlinuz vga=normal load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 slax.flags=automount from=$3 initrd (isoloop)/slax/boot/initrfs.img } set loopok=1 elif test -e (isoloop)/liveslak -a -e (isoloop)/boot/generic -a -e (isoloop)/boot/initrd.img; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s deviceuuid $4 linux (isoloop)/boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=us tz=localtime locale=us_EN.utf8 livemedia=/dev/disk/by-uuid/${deviceuuid}:$3 initrd (isoloop)/boot/initrd.img } set loopok=1 elif test -e (isoloop)/wifislax64 -a -e (isoloop)/boot/vmlinuz -a -e (isoloop)/boot/initrd.xz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s deviceuuid $4 linux (isoloop)/boot/vmlinuz kbd=us tz=US/Pacific locale=en_US.utf8 xkb= rw livemedia=/dev/disk/by-uuid/${deviceuuid}:$3 initrd (isoloop)/boot/initrd.xz } set loopok=1 elif test -e (isoloop)/wifislax -a -e (isoloop)/boot/vmlinuz -a -e (isoloop)/boot/initrd.xz; then menuentry "[${k}] ${2} (Wifislax With KDE Desktop)" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/boot/vmlinuz noload=000-SMP\;006-Xfce load=English from=${3} initrd (isoloop)/boot/initrd.xz } GetHotkey menuentry "[${k}] ${2} (Wifislax With Xfce Desktop)" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/boot/vmlinuz noload=000-SMP\;005-Kde load=English from=${3} initrd (isoloop)/boot/initrd.xz } set loopok=1 elif test -e (isoloop)/suse -a -e (isoloop)/boot/*/loader/initrd -a -e (isoloop)/boot/*/loader/linux; then for vmlinuz in (isoloop)/boot/*/loader/linux; do if ! test -e $vmlinuz; then continue; fi break done for initrd in (isoloop)/boot/*/loader/initrd; do if ! test -e $initrd; then continue; fi break done submenu "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$vmlinuz" "$initrd" --hotkey="${k}" --class ArrowR { menuentry "[1] Installation" "$2" "$3" "$4" "$5" --hotkey=1 { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux ${4} splash=silent install=hd:${3} initrd ${5} } menuentry "[2] Upgrade" "$grub_file" "$path" "$4" "$5" --hotkey=2 { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux ${4} splash=silent upgrade=1 install=hd:${3} initrd ${5} } } unset vmlinuz unset initrd set loopok=1 fi if [ -n "$loopok" ]; then loopback -d isoloop; unset loopok; return 0; fi loopback -d isoloop } |
hkkitlee 发表于 2019-8-4 14:05 menuentry "[L]用Linux方式启动ISO" --hotkey="L" --class iso{ echo (正在查找ISO内的Linux启动文件,请等待。。即将菜单末尾列出启动文件) set k="1" GetHotkey regexp -s 1:devstr -s 2:path '\((.*)\)(.*)' "$grub_file" for cfg in /boot/grub/loopback.cfg /efi/boot/loopback.cfg /EFI/BOOT/loopback.cfg; do if ! test -e (isoloop)$cfg; then continue; fi cat -s cfgtext (isoloop)$cfg if regexp '/grub/grub.cfg' "$cfgtext"; then if ! test -e (isoloop)/grub/grub.cfg; then continue; fi fi if regexp '/casper/initrd.lz' "$cfgtext"; then if ! test -e (isoloop)/casper/initrd.lz; then continue; fi fi menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" "$cfg" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) probe -u -s rootuuid $4 export rootuuid set iso_path="$3" export iso_path loopback isoloop "$2" set root=isoloop configfile $5 loopback -d isoloop } unset cfgtext loopback -d isoloop return 0 done for cfg in /boot/grub/grub.cfg /EFI/BOOT/grub.cfg /EFI/boot/grub.cfg /boot/grub2/grub.cfg \ /efi/boot/grub.cfg /isolinux/live.cfg /boot/isolinux/isolinux.cfg /slax/boot/syslinux.cfg /isolinux/txt.cfg; do if ! test -e (isoloop)$cfg; then continue; fi cat -s cfgtext (isoloop)$cfg if regexp 'iso_path' "$cfgtext"; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" "$cfg" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) probe -u -s rootuuid $4 export rootuuid set iso_path="$3" export iso_path loopback isoloop "$2" set root=isoloop configfile $5 loopback -d isoloop } set loopok=1 elif regexp 'boot=casper' "$cfgtext"; then if test -f (isoloop)/casper/filesystem.squashfs -a -f (isoloop)/casper/vmlinu* -a -f (isoloop)/casper/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for preseed in (isoloop)/preseed/*; do regexp -s preseed '\(isoloop\)(.*)' "$preseed" preseed="file=/cdrom/${preseed}" break done for vmlinuz in (isoloop)/casper/vmlinu*; do linux $vmlinuz ${preseed} boot=casper locale=zh_CN locales=zh_CN.UTF-8 iso-scan/filename=${3} quiet splash --- unset vmlinuz break done for initrd in (isoloop)/casper/initr*; do initrd $initrd unset initrd break done } set loopok=1 fi elif regexp 'boot=live' "$cfgtext"; then if test -f (isoloop)/live/filesystem.squashfs -a -f (isoloop)/live/vmlinu* -a -f (isoloop)/live/initr*; then if regexp 'menuentry "Clonezilla' "$cfgtext"; then set params="union=overlay username=user config noswap edd=on nomodeset locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" vga=788 ip= net.ifnames=0 nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1"; elif regexp 'menuentry "GParted' "$cfgtext"; then set params="union=overlay username=user config noswap ip= net.ifnames=0 nosplash"; else set params="splash"; fi menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$params" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for vmlinuz in (isoloop)/live/vmlinu*; do linux $vmlinuz boot=live locale=zh_CN locales=zh_CN.UTF-8 findiso=${3} components quiet ${4} unset vmlinuz break done for initrd in (isoloop)/live/initr*; do initrd $initrd unset initrd break done } set loopok=1 fi elif regexp 'rd.live.image' "$cfgtext"; then if test -d (isoloop)/LiveOS; then set isodev="UUID" if test -f (isoloop)/images/pxeboot/vmlinu* -a -f (isoloop)/images/pxeboot/initr*; then set bootpath="/images/pxeboot"; elif test -f (isoloop)/isolinux/vmlinu* -a -f (isoloop)/isolinux/initr*; then set bootpath="/isolinux"; elif test -f (isoloop)/boot/*/loader/linu* -a -f (isoloop)/boot/*/loader/initr*; then for bootpath in /boot/*/loader; do if test -d (isoloop)$bootpath; then set isodev="CDLABEL"; break; fi done fi fi if [ -n "$bootpath" ]; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$bootpath" "$isodev" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" if [ "$5" == "UUID" ]; then probe -u -s isouuid isoloop; else probe -l -s isouuid isoloop; fi for vmlinuz in (isoloop)${4}/vmlinu* (isoloop)${4}/linu*; do if ! test -e $vmlinuz; then continue; fi linux $vmlinuz root=live:${5}=${isouuid} rd.live.image quiet iso-scan/filename=${3} unset vmlinuz unset isouuid break done for initrd in (isoloop)${4}/initr*; do if ! test -e $initrd; then continue; fi initrd $initrd unset initrd break done } unset isodev unset bootpath set loopok=1 fi elif regexp 'inst.stage2=hd:' "$cfgtext"; then if test -f (isoloop)/images/pxeboot/vmlinu* -a -f (isoloop)/images/pxeboot/initr* -a -d (isoloop)/LiveOS; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s isouuid isoloop for vmlinuz in (isoloop)/images/pxeboot/vmlinu*; do linux $vmlinuz inst.stage2=hd:UUID=${isouuid} rd.live.image quiet iso-scan/filename=${3} unset vmlinuz unset isouuid break done for initrd in (isoloop)/images/pxeboot/initr*; do initrd $initrd unset initrd break done } set loopok=1 fi elif regexp "initrd=/boot/initrd.gz root=/dev/ram0 vga=normal" "$cfgtext"; then if test -f (isoloop)/boot/initrd.gz -a -f (isoloop)/boot/bzImage; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/boot/bzImage root=/dev/ram0 vga=normal initrd (isoloop)/boot/initrd.gz } set loopok=1 fi elif regexp "tinycore.gz" "$cfgtext"; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$cfg" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" set root=isoloop if regexp 'isolinux.cfg' "$3"; then syslinux_configfile $3; else configfile $3; fi } set loopok=1 fi unset cfgtext if [ -n "$loopok" ]; then loopback -d isoloop; unset loopok; return 0; fi done if test -f (isoloop)/casper/filesystem.squashfs -a -f (isoloop)/casper/vmlinu* -a -f (isoloop)/casper/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for preseed in (isoloop)/preseed/*; do regexp -s preseed '\(isoloop\)(.*)' "$preseed" preseed="file=/cdrom/${preseed}" break done for vmlinuz in (isoloop)/casper/vmlinu*; do linux $vmlinuz ${preseed} boot=casper iso-scan/filename=${3} quiet splash --- unset vmlinuz break done for initrd in (isoloop)/casper/initr*; do initrd $initrd unset initrd break done } set loopok=1 elif test -f (isoloop)/live/filesystem.squashfs -a -f (isoloop)/live/vmlinu* -a -f (isoloop)/live/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for vmlinuz in (isoloop)/live/vmlinu*; do linux $vmlinuz boot=live findiso=${3} components quiet splash unset vmlinuz break done for initrd in (isoloop)/live/initr*; do initrd $initrd unset initrd break done } set loopok=1 elif test -f (isoloop)/arch/boot/intel_ucode.img -a -f (isoloop)/arch/boot/*/archiso.img -a -f (isoloop)/arch/boot/*/vmlinuz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s devuuid $4 for vmlinuz in (isoloop)/arch/boot/*/vmlinuz; do linux $vmlinuz img_loop=${3} img_dev=/dev/disk/by-uuid/$devuuid earlymodules=loop unset vmlinuz unset devuuid break done for initrd in (isoloop)/arch/boot/*/archiso.img; do initrd (isoloop)/arch/boot/intel_ucode.img $initrd unset initrd break done } set loopok=1 elif test -f (isoloop)/antiX/vmlinu* -a -f (isoloop)/antiX/initr*; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" for vmlinuz in (isoloop)/antiX/vmlinu*; do linux $vmlinuz quiet fromiso=${3} from=usb,cd,hd unset vmlinuz break done for initrd in (isoloop)/antiX/initr*; do initrd $initrd unset initrd break done } set loopok=1 elif test -e (isoloop)/rescue/livecd.squashfs -a -e (isoloop)/boot/kernel.x86_64-efi -a -e (isoloop)/boot/initfs.x86_64-efi \ -a -e (isoloop)/boot/kernel.i386-pc -a -e (isoloop)/boot/initfs.i386-pc; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" if cpuid -l; then set arch="x86_64-efi"; else set arch="i386-pc"; fi linux (isoloop)/boot/kernel.${arch} root=/dev/ram0 real_root=/dev/loop0 loop=/rescue/livecd.squashfs cdroot_marker=/rescue/livecd.squashfs initrd udev cdroot scandelay=10 quiet splash isoboot=${3} lang=en initrd (isoloop)/boot/initfs.${arch} } set loopok=1 elif test -e (isoloop)/pmagic/m64.img -a -e (isoloop)/pmagic/m32.img -a -e (isoloop)/pmagic/bzImage64 -a -e (isoloop)/pmagic/bzImage \ -a -e (isoloop)/pmagic/fu.img -a -e (isoloop)/pmagic/initrd.img; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" if cpuid -l; then set bz="bzImage64"; set m="m64.img"; else set bz="bzImage"; set m="m32.img"; fi linux (isoloop)/pmagic/${bz} edd=on vga=normal iso_filename=${3} initrd (isoloop)/pmagic/initrd.img (isoloop)/pmagic/fu.img (isoloop)/pmagic/${m} } set loopok=1 elif test -e (isoloop)/image.squashfs -a -e (isoloop)/livecd -a -e (isoloop)/isolinux/gentoo -a -e (isoloop)/isolinux/gentoo.igz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot vga=791 isoboot=${3} initrd (isoloop)/isolinux/gentoo.igz } set loopok=1 elif test -e (isoloop)/image.squashfs -a -e (isoloop)/livecd -a -e (isoloop)/isolinux/gentoo -a -e (isoloop)/isolinux/gentoo.xz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap aufs looptype=squashfs loop=/image.squashfs cdroot console=tty1 isoboot=${3} initrd (isoloop)/isolinux/gentoo.xz } set loopok=1 elif test -e (isoloop)/slax/boot/vmlinuz -a -e (isoloop)/slax/boot/initrfs.img; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/slax/boot/vmlinuz vga=normal load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 slax.flags=automount from=$3 initrd (isoloop)/slax/boot/initrfs.img } set loopok=1 elif test -e (isoloop)/liveslak -a -e (isoloop)/boot/generic -a -e (isoloop)/boot/initrd.img; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s deviceuuid $4 linux (isoloop)/boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=us tz=localtime locale=us_EN.utf8 livemedia=/dev/disk/by-uuid/${deviceuuid}:$3 initrd (isoloop)/boot/initrd.img } set loopok=1 elif test -e (isoloop)/wifislax64 -a -e (isoloop)/boot/vmlinuz -a -e (isoloop)/boot/initrd.xz; then menuentry "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$devstr" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" probe -u -s deviceuuid $4 linux (isoloop)/boot/vmlinuz kbd=us tz=US/Pacific locale=en_US.utf8 xkb= rw livemedia=/dev/disk/by-uuid/${deviceuuid}:$3 initrd (isoloop)/boot/initrd.xz } set loopok=1 elif test -e (isoloop)/wifislax -a -e (isoloop)/boot/vmlinuz -a -e (isoloop)/boot/initrd.xz; then menuentry "[${k}] ${2} (Wifislax With KDE Desktop)" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/boot/vmlinuz noload=000-SMP\;006-Xfce load=English from=${3} initrd (isoloop)/boot/initrd.xz } GetHotkey menuentry "[${k}] ${2} (Wifislax With Xfce Desktop)" "$grub_file" "$path" --hotkey="${k}" --class ArrowR { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux (isoloop)/boot/vmlinuz noload=000-SMP\;005-Kde load=English from=${3} initrd (isoloop)/boot/initrd.xz } set loopok=1 elif test -e (isoloop)/suse -a -e (isoloop)/boot/*/loader/initrd -a -e (isoloop)/boot/*/loader/linux; then for vmlinuz in (isoloop)/boot/*/loader/linux; do if ! test -e $vmlinuz; then continue; fi break done for initrd in (isoloop)/boot/*/loader/initrd; do if ! test -e $initrd; then continue; fi break done submenu "[${k}] ${2}立即启动$grub_file" "$grub_file" "$path" "$vmlinuz" "$initrd" --hotkey="${k}" --class ArrowR { menuentry "[1] Installation" "$2" "$3" "$4" "$5" --hotkey=1 { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux ${4} splash=silent install=hd:${3} initrd ${5} } menuentry "[2] Upgrade" "$grub_file" "$path" "$4" "$5" --hotkey=2 { echo (正在后台加载文件,请等待。。) loopback isoloop "$2" linux ${4} splash=silent upgrade=1 install=hd:${3} initrd ${5} } } unset vmlinuz unset initrd set loopok=1 fi if [ -n "$loopok" ]; then loopback -d isoloop; unset loopok; return 0; fi loopback -d isoloop } |
本帖最后由 hkkitlee 于 2019-8-4 14:10 编辑 lhb9900 发表于 2019-8-4 13:41 看來有點誤解了 1啟動方法跟互聯網/內網的「速度」是沒有直接關係的。 2這個方法,我已經在不同的Linux(Centos/Debian/Fedora/Kali/Tinycore/Ubuntu)中 在uefi/bios中測試過,是可以啟動的。些小改變是需要的 3ipxe中整個光盤引導的命令:sanboot,詳細請參閱官網 isoboot.efi在ipxe上chainload啟動有沒有限制?應該需要檢查isoboot.efi和ipxe的文件。因為我未測試過,所以沒有定論。 |
本帖最后由 lhb9900 于 2019-8-4 13:42 编辑 hkkitlee 发表于 2019-8-4 12:26 互联网安装慢呀,这样的方法并不通用于其它LINUX,不同的LINUX要用不同的脚本 |
江南一根葱 发表于 2019-8-4 12:41 看source code不像哦 像是用變量導入所需參數 |
要是能用php脚本控制,类似 https://netboot.xyz/这个就好了。。 |
不是很明白这个用途,不如何能具体解决一些什么场景问题 |
Linux 在ipxe啟動,應該是選取「核心」vmlinuz,「內存盤」initrd.gz。需要時才加入核心啟動參數或額外的檔案,如Live的filesystem.squashfs。 上面的檔名在各發行版有些微不同,但這幾個就是{關鍵字}。 取自ipxe.org的例子: #!ipxe set base http://mirror.centos.org/centos/7/os/x86_64 prompt -k 0x197e -t 2000 Press F12 to install CentOS... || exit kernel ${base}/images/pxeboot/vmlinuz initrd=initrd.img repo=${base} initrd ${base}/images/pxeboot/initrd.img boot |
本帖最后由 lhb9900 于 2019-8-4 11:04 编辑 hkkitlee 发表于 2019-8-4 10:47 走的是http协议 isset ${ip} || dhcp #查询IP,否则分配IP isset ${next-server} || set next-server ${dhcp-server} || set next-server 192.168.7.100 console --picture http://${next-server}/Boot/grub/back.png && set boot-server http://${next-server} || set boot-server #测试http,并设置优先使用http,否则使用TFTP goto EFIstartISO :EFIstartISO initrd ${boot-server}/ISO/my.iso #请教这个文件大于2G时不能启动,1G是可以启动的 chain ${boot-server}/ISO/isoboot.efi || goto ${PXE_MENU} |
本帖最后由 hkkitlee 于 2019-8-4 10:52 编辑 lhb9900 发表于 2019-8-4 10:42 ${xieyi} 走的是什麼協議? 還有就是什麼啟動方式? 不如你完整的放上來看一下 |
lhb9900 发表于 2019-8-4 01:06 是 |
guzhentao 发表于 2019-8-4 00:28 可否詳細說明你怎麼啟動不了? 你有看讀一樓,二樓嗎? 有自己放置啟動檔嗎? 我測試了很久是可以的 |
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.