parent
1d4f293da4
commit
bd16356183
|
@ -0,0 +1,16 @@
|
|||
#!ipxe
|
||||
echo Booting by ipxe
|
||||
echo MAC Address: ${net0/mac}
|
||||
set macaddress ${net0/mac}
|
||||
set prefix http://SERVERIP/ipxe_scripts
|
||||
echo Prefix: ${prefix}
|
||||
set configfile ${prefix}/01-${net0/mac}
|
||||
echo Config File: ${configfile}
|
||||
ifopen net0
|
||||
route
|
||||
# Intentar cargar la configuración personalizada por MAC
|
||||
sleep 5
|
||||
chain ${configfile} ||
|
||||
|
||||
# Si no se encuentra la configuración personalizada, cargar la configuración por defecto
|
||||
chain $prefix/default.ipxe
|
|
@ -3,6 +3,7 @@
|
|||
echo "Hello world"
|
||||
touch "Hello world"
|
||||
BRANCH=$1
|
||||
MAC_ADDRESSES=$2
|
||||
if [[ -z $BRANCH ]]; then
|
||||
BRANCH="main"
|
||||
fi
|
||||
|
@ -50,9 +51,40 @@ function add_tftpboot_files() {
|
|||
fi
|
||||
|
||||
# Volver al directorio original
|
||||
cd ..
|
||||
|
||||
}
|
||||
|
||||
generate_ipxe_script() {
|
||||
|
||||
# Obtener la dirección IP de eth0
|
||||
ip_address=$(ifconfig eth0 | awk '/inet / {print $2}')
|
||||
cd ogboot
|
||||
ls -lha
|
||||
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"
|
||||
|
||||
echo "Archivo creado con éxito en $ipxe_output"
|
||||
|
||||
template_default="etc/default.ipxe"
|
||||
|
||||
default_output="/opt/opengnsys/tftpboot/ipxe_scripts/default.ipxe"
|
||||
|
||||
sed "s/SERVERIP/$ip_address/g" "$template_default" > "$default_output"
|
||||
echo "Creando ficheros MAC script"
|
||||
ls -lh
|
||||
for mac_address in $MAC_ADDRESSES; do
|
||||
filename="01-${mac_address//:/-}"
|
||||
echo "Creando archivo $filename..."
|
||||
cp /ogboot/tftpboot/ipxe_scripts/default.ipxe /ogboot/tftpboot/ipxe_scripts/$filename
|
||||
done
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Definir la función
|
||||
|
@ -114,3 +146,12 @@ if [ $? -ne 0 ]; then
|
|||
echo "Error en el montaje NFS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mount_NFS
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error en el montaje NFS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
generate_ipxe_script
|
||||
|
|
|
@ -1,35 +1,12 @@
|
|||
#!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=192.168.2.11:192.168.2.1:192.168.2.1:255.255.255.0:pc11: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
|
||||
|
||||
#kernel tftp://172.17.8.71/ogclient/ogvmlinuz ${kernelargs}
|
||||
#route
|
||||
|
||||
#echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
|
||||
#isset ${net} || set net 0
|
||||
#echo -n IP: && read net${net}/ip
|
||||
#echo -n Subnet mask: && read net${net}/netmask
|
||||
#echo -n Gateway: && read net${net}/gateway
|
||||
#echo -n DNS: && read dns
|
||||
#ifopen net0
|
||||
#route
|
||||
|
||||
#echo Comprobando la conectividad con el servidor 172.17.8.71
|
||||
#ping 172.17.8.71
|
||||
#kernel http://172.17.8.71/ogclient/ogvmlinuz
|
||||
#echo Verificando la conectividad con el servidor 172.17.8.71
|
||||
#imgfetch tftp://172.17.8.71/ogclient/testfile || goto fail
|
||||
#imgfetch tftp://172.17.8.71/ogclient/ogvmlinuz || goto fail
|
||||
#sleep 10
|
||||
# Si no existe el ogLive de ISODIR en la red, inicio ogLive por defecto
|
||||
#kernel tftp://172.17.8.71/ogclient/ogvmlinuz 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=192.168.2.11:192.168.2.1:192.168.2.1:255.255.255.0:pc11: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
|
||||
time kernel tftp://172.17.8.71/ogLive/ogvmlinuz ${kernelargs}
|
||||
#sleep 10
|
||||
time initrd tftp://172.17.8.71/ogLive/oginitrd.img
|
||||
kernel tftp://172.17.8.71/ogLive/ogvmlinuz ${kernelargs}
|
||||
initrd tftp://172.17.8.71/ogLive/oginitrd.img
|
||||
boot
|
||||
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
#!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=192.168.2.11:192.168.2.1:192.168.2.1:255.255.255.0:pc11: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
|
||||
|
||||
#kernel tftp://172.17.8.71/ogclient/ogvmlinuz ${kernelargs}
|
||||
echo "OgLive $ISODIR"
|
||||
echo "-----------------------TEST------------------------------------"
|
||||
#route
|
||||
|
||||
#echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
|
||||
#isset ${net} || set net 0
|
||||
#echo -n IP: && read net${net}/ip
|
||||
#echo -n Subnet mask: && read net${net}/netmask
|
||||
#echo -n Gateway: && read net${net}/gateway
|
||||
#echo -n DNS: && read dns
|
||||
ifopen net0
|
||||
route
|
||||
|
||||
#echo Comprobando la conectividad con el servidor 172.17.8.71
|
||||
#ping 172.17.8.71
|
||||
#kernel http://172.17.8.71/ogclient/ogvmlinuz
|
||||
#echo Verificando la conectividad con el servidor 172.17.8.71
|
||||
#imgfetch tftp://172.17.8.71/ogclient/testfile || goto fail
|
||||
#imgfetch tftp://172.17.8.71/ogclient/ogvmlinuz || goto fail
|
||||
#sleep 10
|
||||
# Si no existe el ogLive de ISODIR en la red, inicio ogLive por defecto
|
||||
#kernel tftp://172.17.8.71/ogclient/ogvmlinuz 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=192.168.2.11:192.168.2.1:192.168.2.1:255.255.255.0:pc11: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
|
||||
time kernel tftp://172.17.8.71/ogLive/ogvmlinuz ${kernelargs}
|
||||
#sleep 10
|
||||
time initrd tftp://172.17.8.71/ogLive/oginitrd.img
|
||||
|
||||
sleep 10
|
||||
boot
|
||||
|
||||
|
|
@ -1,39 +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=192.168.2.11:192.168.2.1:192.168.2.1:255.255.255.0:pc11: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
|
||||
|
||||
#kernel tftp://172.17.8.71/ogclient/ogvmlinuz ${kernelargs}
|
||||
echo "OgLive $ISODIR"
|
||||
echo "-----------------------TEST------------------------------------"
|
||||
#route
|
||||
|
||||
#echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
|
||||
#isset ${net} || set net 0
|
||||
#echo -n IP: && read net${net}/ip
|
||||
#echo -n Subnet mask: && read net${net}/netmask
|
||||
#echo -n Gateway: && read net${net}/gateway
|
||||
#echo -n DNS: && read dns
|
||||
ifopen net0
|
||||
route
|
||||
|
||||
#echo Comprobando la conectividad con el servidor 172.17.8.71
|
||||
#ping 172.17.8.71
|
||||
#kernel http://172.17.8.71/ogclient/ogvmlinuz
|
||||
#echo Verificando la conectividad con el servidor 172.17.8.71
|
||||
#imgfetch tftp://172.17.8.71/ogclient/testfile || goto fail
|
||||
#imgfetch tftp://172.17.8.71/ogclient/ogvmlinuz || goto fail
|
||||
#sleep 10
|
||||
# Si no existe el ogLive de ISODIR en la red, inicio ogLive por defecto
|
||||
#kernel tftp://172.17.8.71/ogclient/ogvmlinuz 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=192.168.2.11:192.168.2.1:192.168.2.1:255.255.255.0:pc11: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
|
||||
time kernel tftp://172.17.8.71/ogLive/ogvmlinuz ${kernelargs}
|
||||
#sleep 10
|
||||
time initrd tftp://172.17.8.71/ogLive/oginitrd.img
|
||||
|
||||
sleep 10
|
||||
boot
|
||||
kernel tftp://SERVERIP/ogLive/ogvmlinuz ${kernelargs}
|
||||
initrd tftp://SERVERIP/ogLive/oginitrd.img
|
||||
boot
|
||||
|
||||
|
||||
|
|
|
@ -8,12 +8,7 @@ set configfile ${prefix}/01-${net0/mac}
|
|||
echo Config File: ${configfile}
|
||||
ifopen net0
|
||||
route
|
||||
#echo Comprobando la conectividad con el servidor 172.17.8.71
|
||||
#ping 172.17.8.71
|
||||
#
|
||||
# Intentar cargar la configuración personalizada por MAC
|
||||
|
||||
sleep 5
|
||||
chain ${configfile} ||
|
||||
|
||||
# Si no se encuentra la configuración personalizada, cargar la configuración por defecto
|
||||
chain $prefix/default.ipxe
|
||||
|
|
Loading…
Reference in New Issue