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

View File

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