summaryrefslogtreecommitdiffstats
path: root/client/engine/Inventory.lib
diff options
context:
space:
mode:
Diffstat (limited to 'client/engine/Inventory.lib')
-rwxr-xr-xclient/engine/Inventory.lib16
1 files changed, 10 insertions, 6 deletions
diff --git a/client/engine/Inventory.lib b/client/engine/Inventory.lib
index 853f0d18..f3a779d7 100755
--- a/client/engine/Inventory.lib
+++ b/client/engine/Inventory.lib
@@ -90,7 +90,6 @@ esac
}
-
#/**
# ogGetSerialNumber
#@brief Obtiene el nº de serie del cliente.
@@ -98,17 +97,22 @@ esac
#@author Ramon Gomez, ETSII Universidad de Sevilla
#@date 2015-06-08
#*/ ##
-
function ogGetSerialNumber ()
{
+# Variables locales.
+local SERIALNO
# Si se solicita, mostrar ayuda.
if [ "$*" == "help" ]; then
- ogHelp "$FUNCNAME" "$FUNCNAME"
+ ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => 123456"
return
fi
-# Obtener nº de serie (ignorar los no especificados)
-dmidecode -s system-serial-number | egrep -vi "(^[ 0]+$|not specified|filled by o.e.m.)"
+# Obtener nº de serie (ignorar los no especificados).
+SERIALNO=$(dmidecode -s system-serial-number | egrep -vi "(^[ 0]+$|not specified|to be filled|invalid entry|default string)")
+# Truncar cadena si >25 caracteres.
+[ ${#SERIALNO} -gt 25 ] && SERIALNO="${SERIALNO:0:22}..."
+[ -n "$SERIALNO" ] && echo "$SERIALNO"
+return 0
}
@@ -499,4 +503,4 @@ fi
# Mostrar resultado y salir sin errores.
[ -n "$VERSION" ] && echo "$TYPE:$VERSION $IS64BIT"
return 0
-} \ No newline at end of file
+}