diff options
author | adv <adv@uma.es> | 2011-02-24 10:25:22 +0000 |
---|---|---|
committer | adv <adv@uma.es> | 2011-02-24 10:25:22 +0000 |
commit | 8368c0d7bc9203ee8b55d6f4e440f17e16010bf0 (patch) | |
tree | 40ecc9eaabc45a468217af252c5093b62a7a9dac /client/engine | |
parent | 810f631967b85fbd8e3765abc95d7b3bab4b39a3 (diff) |
ogGetIpAddress() 1.0
git-svn-id: https://opengnsys.es/svn/branches/version1.0@1494 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/engine')
-rwxr-xr-x | client/engine/Net.lib | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/client/engine/Net.lib b/client/engine/Net.lib index 3bb03175..f8145e8f 100755 --- a/client/engine/Net.lib +++ b/client/engine/Net.lib @@ -41,14 +41,23 @@ echo $HOST #@version 0.10 - Integración en OpenGnSys 0.10 #@author Ramon Gomez, ETSII Universidad de Sevilla #@date 2010-02-11 +#@version 1.0 - Integración OpenGnSys 0.10 Opengnsys 0.10-testing +#@note Usa las variables utilizadas por el initrd "/etc/net-ethx +#@author Antonio J. Doblas Viso. Universidad de Malaga. +#@date 2011-02-24 #*/ ## function ogGetIpAddress () { local IP -# Obtener direcciones IP. /* (comentario para Doxygen) -IP=$(ip address show | awk '$2!~/lo/ { readline; if ($1~/inet$/) {sub (/\/.*/, ""); printf ("%s ", $2)}}') -# Mostrar sólo la primera. (comentario para Doxygen) */ -echo ${IP%% *} +if [ -n $IPV4ADDR ] +then + echo $IPV4ADDR +else + # Obtener direcciones IP. /* (comentario para Doxygen) + IP=$(ip address show | awk '$2!~/lo/ { readline; if ($1~/inet$/) {sub (/\/.*/, ""); printf ("%s ", $2)}}') + # Mostrar sólo la primera. (comentario para Doxygen) */ + echo ${IP%% *} +fi } |