#573: Camino del fichero de configuración de red compatible con Kernel 3.7 manteniendo enlace simbólico para retrocompatiblidad; formatear código para una mejor lectura.

git-svn-id: https://opengnsys.es/svn/branches/version1.0@3651 a21b9725-9963-47de-94b9-378ad31fedc9
remotes/github/main
ramon 2013-02-27 15:58:32 +00:00
parent 31dbe1f5ab
commit f803f6586b
1 changed files with 46 additions and 47 deletions

View File

@ -47,14 +47,15 @@ local DRIVER MODE
DRIVER="$(echo $video|cut -f1 -d:)"
MODE="$(echo $video|cut -f2 -d:)"
case "$DRIVER" in
# Cambiar resolución para driver "uvesafb".
uvesafb)
grep ":$(echo $MODE|cut -f1 -d-)p" /sys/class/graphics/fb0/modes | head -1 > /sys/class/graphics/fb0/mode 2>&1 || MODE="640x480-16"
echo "$(echo $MODE|cut -f2 -d-)" > /sys/class/graphics/fb0/bits_per_pixel 2>&1
echo "Screen mode: $(cat /sys/class/graphics/fb0/mode),$(cat /sys/class/graphics/fb0/bits_per_pixel)bpp."
;;
*) echo "Unknown video driver, using default mode."
;;
# Cambiar resolución para driver "uvesafb".
uvesafb)
grep ":$(echo $MODE|cut -f1 -d-)p" /sys/class/graphics/fb0/modes | head -1 > /sys/class/graphics/fb0/mode 2>&1 || MODE="640x480-16"
echo "$(echo $MODE|cut -f2 -d-)" > /sys/class/graphics/fb0/bits_per_pixel 2>&1
echo "Screen mode: $(cat /sys/class/graphics/fb0/mode),$(cat /sys/class/graphics/fb0/bits_per_pixel)bpp."
;;
# Resolución por defecto para el resto de casos.
*) echo "Unknown video driver, using default mode."
;;
esac
}
@ -190,15 +191,13 @@ ogPostConfigureFS()
echo "order hosts,bind" > /etc/host.conf
echo "multi on" >> /etc/host.conf
#configuramos el dns anterior ubuntu 12.04
#####echo "nameserver $ogdns" > /etc/resolv.conf
#configuramos el dns posterior ubuntu 12.04
#####echo "nameserver $ogdns" > /etc/resolvconf/resolv.conf.d/tail
[ -n "${ogdns}" ] && mkdir -p /run/resolvconf
[ -n "${ogdns}" ] && touch /run/resolvconf/resolv.conf
[ -n "${ogdns}" ] && echo "nameserver $ogdns" > /run/resolvconf/resolv.conf
#configuramos el dns anterior ubuntu 12.04 (parámetro del Kernel "ogdns=IP_DNS")
if [ -n "$ogdns" ]; then
mkdir -p /run/resolvconf
echo "nameserver $ogdns" > /run/resolvconf/resolv.conf
fi
#configuramos el uso del servicio http proxy
#configuramos el uso del servicio http proxy (parámetro del Kernel "ogproxy=URL_Proxy")
[ -n "${ogproxy}" ] && export http_proxy="$ogproxy"
# configuramos el /etc/networks
@ -213,15 +212,14 @@ ogPostConfigureFS()
#echo "ogLive1.0.2" > /etc/debian_chroot
#enlace si iniciamos desde ogprotocolo=local { cdrom, usb, cache } .
# monta el raiz del dispositivo local en /opt/og2fs/tftpboot - acceso al fichero .sqfs
# y monta el sistema root sqfs en /opt/og2fs/2ndfs
# monta el raiz del dispositivo local en /opt/og2fs/tftpboot - acceso al fichero .sqfs
# y monta el sistema root sqfs en /opt/og2fs/2ndfs
[ "$LOCALMEDIA" == "CACHE" ] && ln -s $DSTOGLIVE /opt/opengnsys/cache
[ "$ogprotocol" == "local" ] && ln -s ${OGLIVEROOTFS}/opt/opengnsys/* /opt/opengnsys/
#Montamos un directorio temporal para el apt-get
mount tmpfs /var/cache/apt/archives -t tmpfs -o size=15M
mkdir -p /var/cache/apt/archives/partial
#Montamos un directorio temporal para el apt-get
mount tmpfs /var/cache/apt/archives -t tmpfs -o size=15M
mkdir -p /var/cache/apt/archives/partial
}
@ -529,20 +527,20 @@ else
#echo "variable BOOTIF no exportada, intentamos detectar que interfaz se ha iniciado"
IP=$ip
#TODO Detectar que interfaz se ha iniciado
case ${IP} in
case "$IP" in
none|off)
return 0
;;
""|on|any)
# Bring up device
DEVICE=eth0
;;
dhcp|bootp|rarp|both)
DEVICE=eth0
;;
*)
DEVICE=`echo $IP | cut -f6 -d:`
;;
return 0
;;
""|on|any)
# Bring up device
DEVICE=eth0
;;
dhcp|bootp|rarp|both)
DEVICE=eth0
;;
*)
DEVICE=`echo $IP | cut -f6 -d:`
;;
esac
fi
if [ -z "${DEVICE}" ]; then
@ -550,12 +548,12 @@ if [ -z "${DEVICE}" ]; then
ogConfigureNetworking
fi
[ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0
#if [ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ]; then
# echo "variable DEVICE con valor $DEVICE y fichero /tmp/net-$DEVICE encontrados"
[ -n "${DEVICE}" ] && [ -e /run/net-"${DEVICE}".conf ] && return 0
#if [ -n "${DEVICE}" ] && [ -e /run/net-"${DEVICE}".conf ]; then
# echo "variable DEVICE con valor $DEVICE y fichero /run/net-$DEVICE encontrados"
# return 0
#else
# echo "variable DEVICE con valor $DEVICE encontrada, procedemos a configurala y a crear el fichero /tmp/net-$DEVICE"
# echo "variable DEVICE con valor $DEVICE encontrada, procedemos a configurala y a crear el fichero /run/net-$DEVICE"
#fi
# Activamos la interfaz antes de configurar.
@ -576,10 +574,10 @@ for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do
# The NIC is to be configured if this file does not exist.
# Ip-Config tries to create this file and when it succeds
# creating the file, ipconfig is not run again.
if [ -e /tmp/net-"${DEVICE}".conf ]; then
if [ -e /run/net-"${DEVICE}".conf ]; then
break;
fi
case ${IP} in
case "$IP" in
none|off)
return 0
;;
@ -612,16 +610,17 @@ done
# source ipconfig output
if [ -n "${DEVICE}" ]; then
. /tmp/net-${DEVICE}.conf
DEVICECFG="/tmp/net-${DEVICE}.conf"
export DEVICECFG
export DEVICE
export DEVICECFG="/run/net-${DEVICE}.conf"
source $DEVICECFG
echo "DEVICE=$DEVICE" >> $CFGINITRD
echo "DEVICECFG=$DEVICECFG" >> $CFGINITRD
echo "exportando variable DEVICE con valor = $DEVICE y el DEVICECFG con valor $DEVICECFG"
echo "exportando variable DEVICE con valor = $DEVICE y DEVICECFG con valor $DEVICECFG"
# Compatibilidad con versiones anteriores.
ln -fs $DEVICECFG /tmp
else
# source any interface as not exaclty specified
. /tmp/net-*.conf
# source any interface as not exaclty specified
source /run/net-*.conf
fi
}