refs #809 debug init scripts

lgromero-tests
Natalia Serrano 2024-11-15 16:05:29 +01:00
parent 0e5d83c501
commit 6dddc6ba8b
2 changed files with 21 additions and 3 deletions

View File

@ -19,6 +19,7 @@
#*/ ##
ogGetNetworkDevice ()
{
echo "nati: in ogGetNetworkDevice()"
# Mantener retrocompatibilidad con interfaces antiguas tipo eth.
case "$1" in
eth0) ind=1 ;;
@ -26,12 +27,13 @@ case "$1" in
eth2) ind=3 ;;
*) ind="$1" ;;
esac
echo "nati: ind ($ind)"
# Buscar el dispositivo del índice.
dev=""
for f in /sys/class/net/*/uevent; do
source $f
let aux=$IFINDEX-1
[ "$ind" = "$INTERFACE" -o "$ind" = $aux ] && dev="$INTERFACE"
if [ "$ind" = "$INTERFACE" -o "$ind" = $aux ]; then echo "nati: ind ($ind) == INTERFACE ($INTERFACE) -o ind ($ind) == aux ($aux), setting dev to ($INTERFACE)"; dev="$INTERFACE"; fi
done
[ -n "$dev" ] && echo "$dev"
}
@ -50,18 +52,28 @@ done
#*/ ##
ogExportKernelParameters ()
{
echo "nati: in ogExportKernelParameters()"
GLOBAL="cat /proc/cmdline"
for i in `${GLOBAL}`
do
echo $i | grep "=" > /dev/null && export $i
echo "nati: considering ($i)"
if echo $i | grep "=" > /dev/null; then
if echo $i | grep '\..*=' > /dev/null; then echo "nati: skipping ($i)"; continue; fi
echo "nati: exporting ($i)"
export $i
fi
done
# Sustituir índice de interfaz de red por su dispositivo.
DEVIND=$(echo "$ip" | cut -f6 -d:)
echo "nati: DEVIND ($DEVIND)"
if [ -n "$DEVIND" ]; then
PRE=$(echo "$ip" | cut -f1-5 -d:)
POST=$(echo "$ip" | cut -f7- -d:)
echo "nati: PRE ($PRE) POST ($POST)"
echo "nati: calling ogGetNetworkDevice()"
DEVICE=$(ogGetNetworkDevice $DEVIND)
[ -n "$DEVICE" ] && export ip="$PRE:$DEVICE:${POST:-none}"
echo "nati: got DEVICE ($DEVICE)"
[ -n "$DEVICE" ] && echo "nati: DEVICE is true, exporting ip ($PRE:$DEVICE:${POST:-none})" && export ip="$PRE:$DEVICE:${POST:-none}"
fi
return 0
}
@ -119,6 +131,7 @@ fi
#*/ ##
ogExportVarEnvironment ()
{
echo "nati: in ogExportVarEnvironment"
export CFGINITRD="/tmp/initrd.cfg"
OGPROTOCOL="${ogprotocol:-smb}"
[ "$ogunit" != "" ] && OGUNIT="/$ogunit"
@ -178,6 +191,7 @@ ogExportVarEnvironment ()
#$OGSERVERSHARE
#$OGSERVERLOG
#$OGSERVERIMAGES
echo "nati: exiting ogExportVarEnvironment"
return 0
}

View File

@ -54,14 +54,18 @@ mountroot ()
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before get OG variables: y/N "
[ $? == 0 ] && sh || echo " "
echo "nati: Checking kernel parameters: calling ogExportKernelParameters"
set -a
log_success_msg "Checking kernel parameters"
ogExportKernelParameters
# Cambiar resolución de vídeo para kernels que usan el parámetro "video".
echo "nati: calling ogChangeVideoResolution"
[ -n "$video" ] && ogChangeVideoResolution
echo "nati: Checking OpenGnsys Environmnet: calling ogExportVarEnvironment"
log_success_msg "Checking OpenGnsys Environmnet"
ogExportVarEnvironment
echo "nati: stayin alive"
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before configure ramfs structure for OG: y/N "
[ $? == 0 ] && sh || echo " "
ogConfigureRamfs