diff options
author | ramon <ramongomez@us.es> | 2013-09-26 08:10:53 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2013-09-26 08:10:53 +0000 |
commit | 336557d232576ff198e64dc527d9954446850594 (patch) | |
tree | fa106edc851471a6bcdb361c2be16d248f94ca53 /client/engine/Net.lib | |
parent | aaf78bd4c302b7b45e34f4bebb65ce3f32f8de6f (diff) |
Solucionada una errata de función {{{ogGetMacAddress}}}; nueva función {{{ogMakeGroupDir}}} para crear en repositorio el directorio común para los clientes del mismo grupo.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4048 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/engine/Net.lib')
-rwxr-xr-x | client/engine/Net.lib | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/client/engine/Net.lib b/client/engine/Net.lib index 1e026aa5..10f55abd 100755 --- a/client/engine/Net.lib +++ b/client/engine/Net.lib @@ -148,9 +148,9 @@ if [ "$*" == "help" ]; then fi # Obtener direcciones Ethernet. if [ -n "$DEVICE" ]; then - MAC=$(ip -o address show up dev "$DEVICE" 2>/dev/null | awk '{sub (/.*\\/, ""); if ($1~/ether/) printf ("%s ", toupper($2));}') + MAC=$(ip -o link show up dev "$DEVICE" 2>/dev/null | awk '{sub (/.*\\/, ""); if ($1~/ether/) printf ("%s ", toupper($2));}') else - MAC=$(ip -o address show up | awk '$2!~/lo/ {sub (/.*\\/, ""); if ($1~/ether/) printf ("%s ", toupper($2));}') + MAC=$(ip -o link show up | awk '$2!~/lo/ {sub (/.*\\/, ""); if ($1~/ether/) printf ("%s ", toupper($2));}') fi # Mostrar sólo la primera. echo ${MAC%% *} @@ -231,3 +231,39 @@ if [ -n "$OPENGNSYS" ]; then fi } + +#/** +# ogMakeGroupDir [ str_repo ] +#@brief Crea el directorio para el grupo del cliente. +#@param str_repo repositorio de imágenes (opcional) +#@return (nada) +#@note repo = { REPO, CACHE } REPO por defecto +#@exception OG_ERR_FORMAT formato incorrecto. +#@version 1.0.5 - Primera versión para OpenGnSys. +#@author Ramon Gomez, ETSII Universidad de Sevilla +#@date 2013-09-26 +#*/ +function ogMakeGroupDir () +{ +local REPO DIR GROUP +if [ "$*" == "help" ]; then + ogHelp "$FUNCNAME" "$FUNCNAME str_repo" \ + "$FUNCNAME" "$FUNCNAME REPO" + return +fi +# Error si se recibe más de 1 parámetro. +case $# in + 0) REPO="REPO" ;; + 1) REPO="$1" ;; + *) ogRaiseError $OG_ERR_FORMAT "$*" + return $? ;; +esac +# Comprobar tipo de repositorio. +DIR=$(ogGetPath "$REPO" / 2>/dev/null) +[ -n "$DIR" ] || ogRaiseError $OG_ERR_FORMAT "$1" +GROUP="$(ogGetGroupName)" +if [ -n "$GROUP" ]; then + mkdir -p "$DIR/groups/$GROUP" 2>/dev/null +fi +} + |