Skip to content

Instantly share code, notes, and snippets.

@zengxs
Last active December 31, 2022 07:38
Show Gist options
  • Save zengxs/df22abbae9b21a68c87e4430054c99f7 to your computer and use it in GitHub Desktop.
Save zengxs/df22abbae9b21a68c87e4430054c99f7 to your computer and use it in GitHub Desktop.
#!ipxe
# AlmaLinux Operating System
# https://almalinux.org/
isset ${dhcp-server} && set ipparam ip=dhcp || set ipparam ip=${ip}::${gateway}:${netmask}:::none nameserver=${dns}
set ipparam BOOTIF=${netX/mac} ${ipparam}
goto ${menu} ||
:almalinux
clear osversion
set os AlmaLinux
set os_arch ${arch}
iseq ${os_arch} x86_64 && set os_arch x86_64 ||
iseq ${os_arch} arm64 && set os_arch aarch64 ||
menu ${os} - ${os_arch}
item 9.1 ${space} ${os} 9.1
item 8.7 ${space} ${os} 8.7
isset ${osversion} || choose osversion || goto linux_menu
echo ${cls}
goto mirror
:mirror
clear almalinux_mirror
menu ${os} - mirror
# 只能使用 http 源
# mirror 列表查看 https://mirrors.almalinux.org/
# mirror 带宽参考 https://mirrors.rockylinux.org/mirrormanager/mirrors
set official_repo http://repo.almalinux.org/almalinux
item ${official_repo} ${official_repo} (DE, Official)
set jaist_repo http://ftp.jaist.ac.jp/pub/Linux/almalinux
item ${jaist_repo} ${jaist_repo} (JP, JAIST, 60G)
set icscoe_repo http://ftp.udx.icscoe.jp/Linux/almalinux
item ${icscoe_repo} ${icscoe_repo} (JP, ICSCoE, 100G)
choose almalinux_mirror
echo ${cls}
set dir ${osversion}/BaseOS/${os_arch}/os
set repo ${almalinux_mirror}/${dir}
goto boottype
:boottype
set ova ${os} ${osversion}
menu ${os} ${os_arch} boot type
item graphical ${ova} graphical installer
item text ${ova} text based installer
item rescue ${ova} rescue
item kickstart ${ova} set kickstart url [ ${ksurl} ]
item kickstart_device ${ova} set ksdevice [ ${ksdevice} ]
isset ${bt} || choose bt || goto almalinux
echo ${cls}
iseq ${bt} text && goto text ||
iseq ${bt} rescue && goto rescue ||
iseq ${bt} kickstart && goto kickstart ||
iseq ${bt} kickstart_device && goto kickstart_device ||
goto bootos_images
# 参数参考:
:text
set params inst.text ||
goto bootos_images
:rescue
set params inst.rescue ||
goto bootos_images
:kickstart
echo -n Specify kickstart URL for ${os} ${osversion}: && read ksurl
set params inst.ks=${ksurl} ||
clear bt
goto boottype
:kickstart_device
echo -n Specify ksdevice param for ${os} ${osversion}: && read ksdevice
set ksdevice ${ksdevice} ||
clear bt
goto boottype
:bootos_images
imgfree
kernel ${almalinux_mirror}/${dir}/images/pxeboot/vmlinuz inst.repo=${repo} ${params} ${ipparam} inst.kdump_addon=off inst.selinux=0 noselinux selinux=0 initrd=initrd.magic ${cmdline}
initrd ${almalinux_mirror}/${dir}/images/pxeboot/initrd.img
echo
echo MD5sums:
md5sum vmlinuz initrd.img
boot
goto linux_menu
:linux_menu
clear menu
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment