pxe-ignition-generator/pxelinux-generator.sh

66 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
echo "Generating pxelinux for your configs"
rm pxeconfigs/*
#rm /var/lib/tftpboot/pxelinux/pxelinux.cfg/01*
function gen_file_config {
role=$1
mac=$(echo $2 | sed 's/\:/\-/g')
arp_type="01"
image=$3
disk_type=$4
echo "#$2
timeout 1200
ui menu.c32
menu title Infidel's PXE boot Manager
# Background image *must* be the same resolution as the resolution here.
#MENU RESOLUTION 640 480
#MENU BACKGROUND bg.png
# White on a black/transparent background.
MENU COLOR screen * #ffffffff #00000000 std
# Blue borders on a black/transparent background.
# Borders have padding, so that background matters.
MENU COLOR border * #ff0000ff #00000000 std
# Title bar is cyan on a black/transparent background.
MENU COLOR title * #ff00ffff #00000000 std
# Selection bar is white on a magenta/opaque background.
MENU COLOR sel * #ffffffff #ffff00ff none
# Unselected menu items are white on black/transparent.
MENU COLOR unsel * #ffffffff #00000000 std
# menu resolution 604 455
# menu background bg.png
# default $role
default localboot
prompt 0
label $role
menu label Ignite Openshift: $role < $2 >
KERNEL boot/rhcos-live-kernel-x86_64
APPEND initrd=boot/rhcos-live-initramfs.x86_64.img coreos.live.rootfs_url=http://192.169.22.1:8080/boot/rhcos/rhcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/$disk_type coreos.inst.ignition_url=http://192.169.22.1:8080/boot/auth/$role.ign
label localboot
menu label Boot from Local Drive
localboot 0
menu end
" > pxeconfigs/$arp_type'-'$mac
}
while IFS="," read -r role mac image disk_type
do
echo $role ' ---> ' $mac ' Finished '
gen_file_config $role $mac $image $disk_type
done < <( cat mac-lists.csv )
#cp -R pxeconfigs/* /var/lib/tftpboot/pxelinux/pxelinux.cfg/