From 17286940e4931b9c40d0d68af6939910d42aaec9 Mon Sep 17 00:00:00 2001 From: lgromero Date: Tue, 30 Apr 2024 13:34:08 +0200 Subject: [PATCH] refs #273 adds SERVER IP variable to the template --- installer/ogboot_installer.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/installer/ogboot_installer.sh b/installer/ogboot_installer.sh index 2602d61..f521819 100644 --- a/installer/ogboot_installer.sh +++ b/installer/ogboot_installer.sh @@ -55,13 +55,13 @@ function add_tftpboot_files() { generate_ipxe_script() { echo "Generando script IPXE..." - ip_address=$(ifconfig eth0 | awk '/inet / {print $2}') + ip_address_server=$(ifconfig eth0 | awk '/inet / {print $2}') template="etc/dhcp_boot.ipxe.tmpl" ipxe_output="/opt/opengnsys/tftpboot/ipxe_scripts/dhcp_boot.ipxe" # Reemplazar SERVERIP con la dirección IP en la plantilla y guardarla en el archivo de salida - sed "s/SERVERIP/$ip_address/g" "$template" > "$ipxe_output" + sed "s/SERVERIP/$ip_address_server/g" "$template" > "$ipxe_output" template_default="tftpboot/ipxe_scripts/default.ipxe" @@ -69,7 +69,7 @@ generate_ipxe_script() { mac_script_template="etc/mac_script.ipxe.tmpl" - sed "s/SERVERIP/$ip_address/g" "$template_default" > "$default_output" + sed "s/SERVERIP/$ip_address_server/g" "$template_default" > "$default_output" echo "Creando ficheros MAC script" for client_declaration in "${CLIENTS[@]}"; do # Evaluar la cadena para reconstruir el array asociativo del cliente @@ -80,8 +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" $mac_script_template > "/opt/opengnsys/tftpboot/ipxe_scripts/$filename" - + sed "s/SERVERIP/$ip_address_server/g; 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