refs #273 adds mac_script template

ipxe-study
Luis Gerardo Romero Garcia 2024-04-30 12:41:18 +02:00
parent f1b1fd7713
commit 766c113fbb
2 changed files with 17 additions and 1 deletions

14
etc/mac_script.ipxe.tmpl Normal file
View File

@ -0,0 +1,14 @@
#!ipxe
set timeout 0
set timeout-style hidden
set ISODIR ogLive
set default 0
set kernelargs ro boot=oginit quiet splash irqpoll acpi=on og2nd=sqfs ogprotocol=smb ogactiveadmin=true ogdebug=true ogtmpfs=15 oglivedir=${ISODIR} LANG=es_ES.UTF-8 ip=IP_ADDRESS:192.168.2.1:192.168.2.1:255.255.255.0:HOSTNAME:eth0:none group=Aula_virtual ogrepo=192.168.2.1 oglive=192.168.2.1 oglog=192.168.2.1 ogshare=192.168.2.1 ogprof=false vga=788
echo "OgLive $ISODIR"
ifopen net0
route
kernel tftp://SERVERIP/ogLive/ogvmlinuz ${kernelargs}
initrd tftp://SERVERIP/ogLive/oginitrd.img
boot

View File

@ -67,6 +67,8 @@ generate_ipxe_script() {
default_output="/opt/opengnsys/tftpboot/ipxe_scripts/default.ipxe"
mac_script_template="etc/mac_script.ipxe.tmpl"
sed "s/SERVERIP/$ip_address/g" "$template_default" > "$default_output"
echo "Creando ficheros MAC script"
for client_declaration in "${CLIENTS[@]}"; do
@ -78,7 +80,7 @@ generate_ipxe_script() {
ip_address="${CLIENT[ip_address]}"
mac_address_lower=$(echo "$mac_address" | tr '[:upper:]' '[:lower:]')
filename="01-${mac_address_lower}"
sed "s/IP_ADDRESS/$ip_address/g; s/HOSTNAME/$hostname/g; s/MAC_ADDRESS/$mac_address/g" /opt/opengnsys/tftpboot/ipxe_scripts/default.ipxe > "/opt/opengnsys/tftpboot/ipxe_scripts/$filename"
sed "s/IP_ADDRESS/$ip_address/g; s/HOSTNAME/$hostname/g; s/MAC_ADDRESS/$mac_address/g" $mac_script_template > "/opt/opengnsys/tftpboot/ipxe_scripts/$filename"
echo "Archivo $filename creado con los parámetros modificados."
done