refs #273 changes CLIENTS to a array of commands
parent
4043928bed
commit
a5ac3cb637
|
@ -69,16 +69,20 @@ generate_ipxe_script() {
|
|||
|
||||
sed "s/SERVERIP/$ip_address/g" "$template_default" > "$default_output"
|
||||
echo "Creando ficheros MAC script"
|
||||
for client in "${CLIENTS[@]}"; do
|
||||
hostname="${client[hostname]}"
|
||||
mac_address="${client[mac_address]}"
|
||||
ip_address="${client[ip_address]}"
|
||||
for client_declaration in "${CLIENTS[@]}"; do
|
||||
# Evaluar la cadena para reconstruir el array asociativo del cliente
|
||||
eval "$client_declaration"
|
||||
|
||||
hostname="${CLIENT[hostname]}"
|
||||
mac_address="${CLIENT[mac_address]}"
|
||||
ip_address="${CLIENT[ip_address]}"
|
||||
filename="01-${mac_address//:/-}"
|
||||
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" /opt/opengnsys/tftpboot/ipxe_scripts/default.ipxe > "/opt/opengnsys/tftpboot/ipxe_scripts/$filename"
|
||||
|
||||
echo "Archivo $filename creado con los parámetros modificados."
|
||||
done
|
||||
|
||||
|
||||
echo "Archivos creados correctamente."
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue