diff options
author | Ramón M. Gómez <ramongomez@us.es> | 2019-07-25 13:25:55 +0200 |
---|---|---|
committer | Ramón M. Gómez <ramongomez@us.es> | 2019-07-25 13:25:55 +0200 |
commit | c0c7fa311f4dfc9da58a30fcb94b323bf458ff32 (patch) | |
tree | fda460b23177c7e7c5a60ce1e30732a7d9dd61eb /client/engine | |
parent | c9ecf0dca24450875b55fd14dbe6407640d4109a (diff) |
#920: Truncate a long serial number.
Diffstat (limited to 'client/engine')
-rwxr-xr-x | client/engine/Inventory.lib | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/client/engine/Inventory.lib b/client/engine/Inventory.lib index 1dd7173c..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|to be filled|invalid entry)" +# 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 } |