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
remotes/github/master
Antonio Doblas Viso 2011-05-25 13:34:50 +00:00
parent 56427ba53a
commit 89b5d40a35
1 changed files with 27 additions and 15 deletions

View File

@ -240,12 +240,11 @@ ifconfig lo 127.0.0.1
ogconfigure_networking() ogconfigure_networking()
{ {
IP=$IPOPTS echo "ogconfigure_networking: Buscando interfaz a configurar DEVICE"
#Buscando interfaz a configurar DEVICE
#BOOTIF lo exporte el pxelinux.0. con valor tipo 01-$mac_address
if [ -n "${BOOTIF}" ] if [ -n "${BOOTIF}" ]
then then
echo " variable BOOTIF exportada con pxelinux.0 con valor $BOOTIF"
IP=$IPOPTS
temp_mac=${BOOTIF#*-} temp_mac=${BOOTIF#*-}
# convert to typical mac address format by replacing "-" with ":" # convert to typical mac address format by replacing "-" with ":"
bootif_mac="" bootif_mac=""
@ -270,12 +269,12 @@ then
fi fi
done done
else 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 IP=$ip
#TODO Detectar que interfaz se ha iniciado #TODO Detectar que interfaz se ha iniciado
case ${IP} in case ${IP} in
none|off) none|off)
# Do nothing return 0
;; ;;
""|on|any) ""|on|any)
# Bring up device # Bring up device
@ -289,9 +288,19 @@ else
;; ;;
esac esac
fi fi
# FIN de Busqueda de la interfaz $DEVICE if [ -z "${DEVICE}" ]; then
# networking already configured thus bail out echo "variable DEVICE con valor $DEVICE no encontrada, llamamos de nuevo a ogconfigure_networking"
[ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0 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 # support ip options see linux sources
# Documentation/filesystems/nfsroot.txt # Documentation/filesystems/nfsroot.txt
# Documentation/frv/booting.txt # Documentation/frv/booting.txt
@ -304,19 +313,19 @@ for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do
fi fi
case ${IP} in case ${IP} in
none|off) none|off)
# Do nothing return 0
;; ;;
""|on|any) ""|on|any)
# Bring up device # 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} ipconfig -t ${ROUNDTTT} ${DEVICE}
;; ;;
dhcp|bootp|rarp|both) 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} 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 ipconfig -t ${ROUNDTTT} -d $IP
# grab device entry from ip option # grab device entry from ip option
NEW_DEVICE=${IP#*:*:*:*:*:*} NEW_DEVICE=${IP#*:*:*:*:*:*}
@ -335,8 +344,11 @@ done
# source ipconfig output # source ipconfig output
if [ -n "${DEVICE}" ]; then if [ -n "${DEVICE}" ]; then
# source specific bootdevice
. /tmp/net-${DEVICE}.conf . /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 else
# source any interface as not exaclty specified # source any interface as not exaclty specified
. /tmp/net-*.conf . /tmp/net-*.conf