From 89b5d40a353fb52bc4f246ddac7d2bac5a80bcae Mon Sep 17 00:00:00 2001 From: adv Date: Wed, 25 May 2011 13:34:50 +0000 Subject: [PATCH] version 1.0.2 #404 boot-tools control de interfaz activa para pxe git-svn-id: https://opengnsys.es/svn/branches/version1.0@2029 a21b9725-9963-47de-94b9-378ad31fedc9 --- .../etc/initramfs-tools/scripts/ogfunctions | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/clientstructure/etc/initramfs-tools/scripts/ogfunctions b/clientstructure/etc/initramfs-tools/scripts/ogfunctions index b5f48fd..a97450a 100644 --- a/clientstructure/etc/initramfs-tools/scripts/ogfunctions +++ b/clientstructure/etc/initramfs-tools/scripts/ogfunctions @@ -240,12 +240,11 @@ ifconfig lo 127.0.0.1 ogconfigure_networking() { -IP=$IPOPTS - -#Buscando interfaz a configurar DEVICE -#BOOTIF lo exporte el pxelinux.0. con valor tipo 01-$mac_address +echo "ogconfigure_networking: Buscando interfaz a configurar DEVICE" if [ -n "${BOOTIF}" ] then + echo " variable BOOTIF exportada con pxelinux.0 con valor $BOOTIF" + IP=$IPOPTS temp_mac=${BOOTIF#*-} # convert to typical mac address format by replacing "-" with ":" bootif_mac="" @@ -270,12 +269,12 @@ then fi done else - # Si no bootif, intentamos buscar que interfaz se ha iniciado. + echo "variable BOOTIF no exportada, intentamos detectar que interfaz se ha iniciado" IP=$ip #TODO Detectar que interfaz se ha iniciado case ${IP} in none|off) - # Do nothing + return 0 ;; ""|on|any) # Bring up device @@ -289,9 +288,19 @@ else ;; esac fi -# FIN de Busqueda de la interfaz $DEVICE -# networking already configured thus bail out -[ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0 +if [ -z "${DEVICE}" ]; then + echo "variable DEVICE con valor $DEVICE no encontrada, llamamos de nuevo a ogconfigure_networking" + ogconfigure_networking +fi + +if [ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ]; then + echo "variable DEVICE con valor $DEVICE y fichero /tmp/net-$DEVICE encontrados" + return 0 +else + echo "variable DEVICE con valor $DEVICE no encontrada y fichero /tmp/net-$DEVICE encontrados , llamamos de nuevo a ogconfigure_networking" + ogconfigure_networking +fi + # support ip options see linux sources # Documentation/filesystems/nfsroot.txt # Documentation/frv/booting.txt @@ -304,19 +313,19 @@ for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do fi case ${IP} in none|off) - # Do nothing + return 0 ;; ""|on|any) # Bring up device - echo "Setting $DEVICE with kernel params $IP: ipconfig -t ${ROUNDTTT} ${DEVICE} " + echo "Setting $DEVICE with option:on|any and Variable IP= $IP: ipconfig -t ${ROUNDTTT} ${DEVICE} " ipconfig -t ${ROUNDTTT} ${DEVICE} ;; dhcp|bootp|rarp|both) - echo "Setting $DEVICE with (dhcp) kernel params $IP: ipconfig -t ${ROUNDTTT} -c ${IP} -d ${DEVICE} " + echo "Setting $DEVICE with option:dhcp|bootp|rarp|both and Variable IP= $IP: ipconfig -t ${ROUNDTTT} -c ${IP} -d ${DEVICE} " ipconfig -t ${ROUNDTTT} -c ${IP} -d ${DEVICE} ;; *) - echo "Setting $DEVICE with kernel params $IP: ipconfig -t ${ROUNDTTT} -d $IP " + echo "Setting $DEVICE with option * and Variable IP= $IP: ipconfig -t ${ROUNDTTT} -d $IP " ipconfig -t ${ROUNDTTT} -d $IP # grab device entry from ip option NEW_DEVICE=${IP#*:*:*:*:*:*} @@ -334,9 +343,12 @@ for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do done # source ipconfig output -if [ -n "${DEVICE}" ]; then - # source specific bootdevice +if [ -n "${DEVICE}" ]; then . /tmp/net-${DEVICE}.conf + DEVICECFG="/tmp/net-${DEVICE} + export DEVICECFG + export DEVICE + echo "exportando variable DEVICE con valor = $DEVICE y el DEVICECFG con valor $DEVICECFG" else # source any interface as not exaclty specified . /tmp/net-*.conf