diff options
author | Irina Gómez <irinagomez@us.es> | 2022-03-09 10:02:16 +0100 |
---|---|---|
committer | Irina Gómez <irinagomez@us.es> | 2022-03-09 10:02:16 +0100 |
commit | 62633be332b9db977cfb1568c18795d7d5b359c9 (patch) | |
tree | 43fa3033f8583589d3891ea4940afa39f4137534 | |
parent | fa1c10d7f0c4b43088e510fe00a2f340b81c7149 (diff) |
#1071 ogNvramPxeEntryFirst New function that sets network as the default boot of NVRAM.
-rwxr-xr-x | client/engine/UEFI.lib | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/client/engine/UEFI.lib b/client/engine/UEFI.lib index 1a8bb952..ae9e0db0 100755 --- a/client/engine/UEFI.lib +++ b/client/engine/UEFI.lib @@ -376,6 +376,37 @@ efibootmgr |awk '{if($1~/Boot[[:digit:]]/) ; active="" ;if ($1~/*/) active="*" #/** +# ogNvramPxeEntryFirst +#@brief Sitúa la entrada de la tarjeta de red en el primer lugar en la NVRAM. +#@return (nada) +#@exception OG_ERR_NOTUEFI UEFI no activa. +#*/ ## +function ogNvramPxeEntryFirst (){ +local NUMENTRY ORDER + +# Si se solicita, mostrar ayuda. +if [ "$*" == "help" ]; then + ogHelp "$FUNCNAME" "$FUNCNAME" \ + "$FUNCNAME" + return +fi + +# Si no es equipo UEFI salir con error +ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $? + +NUMENTRY=$(printf %04X 0x$(efibootmgr|awk '/IP[vV]{0,1}4/ {print gensub(/^0{1,3}/,"",1,substr($1,5,4))}')) + +# Si la entrada es la primera nos salimos. +[[ $(ogNvramGetOrder) =~ ^$NUMENTRY ]] && return + +# Si la entrada ya existe la borramos. +ORDER="$NUMENTRY $(ogNvramGetOrder| sed -e s/$NUMENTRY//g -e s/,/' '/g)" + +ogNvramSetOrder $ORDER +} + + +#/** # ogRestoreEfiBootLoader int_ndisk str_repo #@brief Copia el cargador de arranque de la partición de sistema a la partición EFI. #@param int_ndisk nº de orden del disco |