source: client/engine/Inventory.lib @ 3e88cf1

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 3e88cf1 was 35acc61, checked in by adv <adv@…>, 7 years ago

Adapting Inventory.lib library for doxygen

  • Property mode set to 100755
File size: 18.9 KB
Line 
1#!/bin/bash
2#/**
3#@file    Inventory.lib
4#@brief   Librería o clase Inventory
5#@class   Inventory
6#@brief   Funciones para recogida de datos de inventario de hardware y software de los clientes.
7#@version 1.1.0
8#@warning License: GNU GPLv3+
9#*/
10
11
12#/**
13#         ogGetArch
14#@brief   Devuelve el tipo de arquitectura del cliente.
15#@return  str_arch - Arquitectura (i386 para 32 bits, x86_64 para 64 bits).
16#@version 0.9.2 - Primera versión para OpenGnSys.
17#@author  Ramon Gomez, ETSII Universidad de Sevilla
18#@date    2010-07-17
19#*/
20function ogGetArch ()
21{
22if [ "$*" == "help" ]; then
23    ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME  =>  x86_64"
24    return
25fi
26
27[ -d /lib64 ] && echo "x86_64" || echo "i386"
28}
29
30
31#/**
32#         ogGetOsType int_ndisk int_npartition
33#@brief   Devuelve el tipo del sistema operativo instalado.
34#@param   int_ndisk      nº de orden del disco
35#@param   int_npartition nº de orden de la partición
36#@return  OSType - Tipo de sistema operativo.
37#@see     ogGetOsVersion
38#*/ ##
39function ogGetOsType ()
40{
41# Si se solicita, mostrar ayuda.
42if [ "$*" == "help" ]; then
43    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \
44           "$FUNCNAME 1 2  =>  Linux"
45    return
46fi
47ogGetOsVersion "$@" | cut -sf1 -d:
48}
49
50
51#/**
52#         ogGetOsUuid int_ndisk int_nfilesys
53#@brief   Devuelve el UUID del sistema operativo instalado en un sistema de archivos.
54#@param   int_ndisk      nº de orden del disco
55#@param   int_nfilesys   nº de orden de la partición
56#@return  str_uuid -     UUID del sistema operativo.
57#@exception OG_ERR_FORMAT    Formato incorrecto.
58#@exception OG_ERR_NOTFOUND  Disco o partición no corresponden con un dispositiv
59#@version 1.1.0 - Primera versión para OpenGnsys
60#@author  Ramon Gomez, ETSII Universidad de Sevilla
61#@date    2015-09-09
62#*/ ##
63function ogGetOsUuid ()
64{
65# Variables locales.
66local MNTDIR
67# Si se solicita, mostrar ayuda.
68if [ "$*" == "help" ]; then
69    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_nfilesys" \
70           "$FUNCNAME 1 2  =>  540e47c6-8e78-4178-aa46-042e4803fb16"
71    return
72fi
73# Error si no se reciben 2 parametros.
74[ $# = 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
75
76# Montar la particion, si no lo estaba previamente.
77MNTDIR=$(ogMount $1 $2) || return $?
78
79# Obtener UUID según el tipo de sistema operativo.
80case "$(ogGetOsType $1 $2)" in
81    Linux)
82        # Leer el UUID del sistema de ficheros raíz o el fichero de identificador.
83        findmnt -no UUID $MNTDIR 2>/dev/null || cat $MNTDIR/etc/machine-id 2>/dev/null
84        ;;
85    Windows)
86        # Leer identificador en clave de registro.
87        ogGetRegistryValue $MNTDIR SOFTWARE '\Microsoft\Cryptography\MachineGuid' 2>/dev/null
88        ;;
89esac
90}
91
92
93
94#/**
95#         ogGetSerialNumber
96#@brief   Obtiene el nº de serie del cliente.
97#@version 1.1.0 - Primeras versión con OpenGnsys
98#@author  Ramon Gomez, ETSII Universidad de Sevilla
99#@date    2015-06-08
100#*/ ##
101
102function ogGetSerialNumber ()
103{
104# Si se solicita, mostrar ayuda.
105if [ "$*" == "help" ]; then
106    ogHelp "$FUNCNAME" "$FUNCNAME"
107    return
108fi
109
110# Obtener nº de serie (ignorar los no especificados)
111dmidecode -s system-serial-number | egrep -vi "(^[ 0]+$|not specified|filled by o.e.m.)"
112}
113
114
115#/**
116#         ogIsEfiActive
117#@brief   Comprueba si el sistema tiene activo el arranque EFI.
118#*/ ##
119function ogIsEfiActive ()
120{
121test -d /sys/firmware/efi
122}
123
124
125#/**
126#         ogListHardwareInfo
127#@brief   Lista el inventario de hardware de la máquina cliente.
128#@return  TipoDispositivo:Modelo    (por determinar)
129#@warning Se ignoran los parámetros de entrada.
130#@note    TipoDispositivo = { bio, boa, bus, cha, cdr, cpu, dis, fir, mem, mod, mul, net, sto, usb, vga }
131#@note    Requisitos: dmidecode, lshw, awk
132#@version 0.1 - Primeras pruebas con OpenGnSys
133#@author  Ramon Gomez, ETSII Universidad de Sevilla
134#@date    2009-07-28
135#@version 1.1.0 - Incluir nuevos componentes al inventario.
136#@author  Ramon Gomez, ETSII Universidad de Sevilla
137#@date    2014-04-23
138#*/ ##
139function ogListHardwareInfo ()
140{
141# Si se solicita, mostrar ayuda.
142if [ "$*" == "help" ]; then
143    ogHelp "$FUNCNAME" "$FUNCNAME"
144    return
145fi
146
147# Recopilación de dispositivos procesando la salida de \c lshw
148ogEcho info "$MSG_HARDWAREINVENTORY}"
149echo "cha=$(dmidecode -s chassis-type)" | grep -v "Other"
150[ -e /sys/firmware/efi ] && echo "boo=UEFI" || echo "boo=BIOS"
151lshw | awk 'BEGIN {type="mod";}
152       /product:/ {sub(/ *product: */,"");  prod=$0;}
153       /vendor:/  {sub(/ *vendor: */,"");   vend=$0;}
154       /version:/ {sub(/ *version: */,"v.");vers=$0;}
155       /size:/    {size=$2;}
156       /clock:/   {clock=$2;}
157       /slot:/    {sub(/ *slot: */,"");     slot=$0;}
158       /\*-/      {if (type=="mem"){
159                     if (size!=""){
160                       numbank++;
161                       print type"="vend,prod,size,clock" ("slot")";}
162                   }else{
163                     if (type=="totalmem"){
164                       if (size!=""){
165                          totalmemory="mem="size;}
166                     }else{
167                       if (type!="" && prod!=""){
168                         if (prod=="v."vers)
169                           vers="";
170                         print type"="vend,prod,size,vers;} }
171                   }
172                   type=prod=vend=vers=size=clock=slot="";}
173       $1~/-core/    {type="boa";}
174       $1~/-firmware/ {type="bio";}
175       $1~/-cpu/     {type="cpu";}
176       $1~/-bank/    {type="mem";}
177       $1~/-memory/  {type="totalmem";}
178       $1~/-ide/     {type="ide";}
179       $1~/-storage/ {type="sto";}
180       $1~/-disk/    {type="dis";}
181       $1~/-cdrom/   {type="cdr";}
182       $1~/-display/ {type="vga";}
183       $1~/-network/ {type="net";}
184       $1~/-multimedia/ {type="mul";}
185       $1~/-usb/     {type="usb";}
186       $1~/-firewire/ {type="fir";}
187       $1~/-serial/  {type="bus";}
188       END           {if (type!="" && prod!="")
189                        print type"="vend,prod,size,vers;
190                      if (length(numbank)==0 && length(totalmemory)>=4)
191                        print totalmemory; }
192      '
193# */ (comentario para Doxygen)
194}
195
196
197#/**
198#         ogListSoftware int_ndisk int_npartition
199#@brief   Lista el inventario de software instalado en un sistema operativo.
200#@param   int_ndisk      nº de orden del disco
201#@param   int_npartition nº de orden de la partición
202#@return  programa versión ...
203#@warning Se ignoran los parámetros de entrada.
204#@note    Requisitos: ...
205#@todo    Detectar software en Linux
206#@version 0.1 - Primeras pruebas con OpenGnSys
207#@author  Ramon Gomez, ETSII Universidad de Sevilla
208#@date    2009-09-23
209#@version 1.0.5 - Aproximación para inventario de software de Mac OS.
210#@author  Ramon Gomez, ETSII Universidad de Sevilla
211#@date    2013-10-08
212#@version 1.0.6 - Proceso depende del tipo de SO y soporte para FreeBSD.
213#@author  Ramon Gomez, ETSII Universidad de Sevilla
214#@date    2014-11-13
215#@version 1.1.0 - Se muestra el sistema operativo en la primera línea de la salida
216#@author  Irina Gomez, ETSII Universidad de Sevilla
217#@date    2016-04-26
218#*/ ##
219function ogListSoftware ()
220{
221# Variables locales.
222local MNTDIR TYPE DPKGDIR RPMDIR PACMANDIR k
223
224# Si se solicita, mostrar ayuda.
225if [ "$*" == "help" ]; then
226    ogHelp "$FUNCNAME" "$FUNCNAME 1 1"
227    return
228fi
229# Error si no se reciben 2 parametros.
230[ $# = 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
231
232# Obtener tipo de sistema de archivos y montarlo.
233MNTDIR=$(ogMount $1 $2) || return $?
234TYPE=$(ogGetOsType $1 $2) || return $?
235
236# Sistema Operativo en la primera línea de la salida
237ogGetOsVersion $1 $2 | awk -F ':'  '{print $2}'
238
239case "$TYPE" in
240    Linux)          # Software de GNU/Linux.
241        # Procesar paquetes dpkg.
242        DPKGDIR="${MNTDIR}/var/lib/dpkg"
243        if [ -r $DPKGDIR ]; then
244            # Proceso de fichero en sistemas de 64 bits.
245            awk '/Package:/ {if (pack!="") print pack,vers;
246                             sub(/-dev$/,"",$2);
247                             pack=$2}
248                 /Version:/ {sub(/^.*:/,"",$2); sub(/-.*$/,"",$2);
249                             vers=$2}
250                 /Status:/  {if ($2!="install") pack=vers=""}
251                 END        {if (pack!="") print pack,vers}
252                ' $DPKGDIR/status | sort | uniq
253        fi
254        # Procesar paquetes RPM.
255        RPMDIR="${MNTDIR}/var/lib/rpm"
256        if [ -r $RPMDIR ]; then
257            # Listar si está instalado el paquete "rpm" en el cliente.
258            if which rpm &>/dev/null; then
259                rm -f ${RPMDIR}/__db.*
260                rpm --dbpath $RPMDIR -qa --qf "%{NAME} %{VERSION}\n" 2>/dev/null | \
261                    awk '$1!~/-devel$/ {sub(/-.*$/,"",$2); print $0}' | sort | uniq
262                rm -f ${RPMDIR}/__db.*
263            else
264                # Obtener el nombre de cada paquete en la BD de RPM.
265                python <<<"
266import re;
267import bsddb;
268db=bsddb.hashopen('$RPMDIR/Name','r');
269for k in db.keys():
270    print re.sub('-devel$','',k);" | sort | uniq
271            fi
272        fi
273        # Procesar paquetes pacman.
274        PACMANDIR="${MNTDIR}/var/lib/pacman/local"
275        if [ -r $PACMANDIR ]; then
276            ls $PACMANDIR | awk -F- '/-/ {print gensub(/-/, " ", NF-2);}'
277        fi
278        ;;
279    Windows)        # Software de Windows.
280        # Comprobar tipo de proceso del registro de Windows.
281        if which hivexregedit &>/dev/null; then
282            # Nuevo proceso más rápido basado en "hivexregedit".
283            local HIVE TMPFILE
284            HIVE=$(ogGetHivePath $MNTDIR software 2>/dev/null)
285            if [ -n "$HIVE" ]; then
286                # Claves de registro para programas instalados.
287                TMPFILE=/tmp/tmp$$
288                trap "rm -f $TMPFILE" 1 2 3 9 15
289                hivexregedit --unsafe-printable-strings --export "$HIVE" '\Microsoft\Windows\CurrentVersion\Uninstall' > $TMPFILE 2>/dev/null
290                hivexregedit --unsafe-printable-strings --export "$HIVE" '\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall' >> $TMPFILE 2>/dev/null
291                # Mostrar los valores "DisplayName" y "DisplayVersion" para cada clave.
292                awk -F\" '$1~/^\[/ {n=""}
293                          $2~/DisplayName/ {n=$4}
294                          $2~/DisplayVersion/ {print n,$4}
295                         ' $TMPFILE | sort | uniq
296                rm -f $TMPFILE
297            fi
298        else
299            # Compatibilidad con clientes ogLive antiguos.
300            local KEYS KEYS32 PROG VERS
301            # Claves de registro para programas instalados: formato "{clave}".
302            KEYS=$(ogListRegistryKeys $MNTDIR software '\Microsoft\Windows\CurrentVersion\Uninstall')
303            KEYS32=$(ogListRegistryKeys $MNTDIR software '\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall')
304            # Mostrar los valores "DisplayName" y "DisplayVersion" para cada clave.
305            (for k in $KEYS; do
306                PROG=$(ogGetRegistryValue $MNTDIR software "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayName")
307                if [ -n "$PROG" ]; then
308                    VERS=$(ogGetRegistryValue $MNTDIR software "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayVersion")
309                    echo "$PROG $VERS"
310                fi
311             done
312             for k in $KEYS32; do
313                PROG=$(ogGetRegistryValue $MNTDIR software "\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayName")
314                if [ -n "$PROG" ]; then
315                    VERS=$(ogGetRegistryValue $MNTDIR software "\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayVersion")
316                    echo "$PROG $VERS"
317                fi
318             done) | sort | uniq
319        fi
320        ;;
321    MacOS)          # Software de Mac OS.
322        # Listar directorios de aplicaciones e intentar obtener la versión del fichero .plist (tanto original como descomprimido).
323        find "${MNTDIR}/Applications" -type d -name "*.app" -prune -print | \
324                while read k; do
325                    FILE="$k/Contents/version.plist"
326                    [ -s "$FILE" ] || FILE="$k/Contents/version.plist.uncompress"
327                    [ -s "$FILE" ] && VERSION=$(awk -F"[<>]" '/ShortVersionString/ {getline;v=$3}
328                                                              END {print v}' "$FILE")
329                    echo "$(basename "$k" .app) $VERSION"
330                done | sort
331        ;;
332    BSD)            # Software de FreeBSD.
333        sqlite3 $MNTDIR/var/db/pkg/local.sqlite <<<"SELECT name FROM pkg_search;" 2>/dev/null | \
334                sed 's/\(.*\)-\(.*\)/\1 \2/g' | sort
335        ;;
336    *)  ogRaiseError $OG_ERR_PARTITION "$1, $2"
337        return $? ;;
338esac
339}
340
341#/**
342#         ogGetOsVersion int_ndisk int_nfilesys
343#@brief   Devuelve la versión del sistema operativo instalado en un sistema de archivos.
344#@param   int_ndisk      nº de orden del disco
345#@param   int_nfilesys   nº de orden de la partición
346#@return  OSType:OSVersion - tipo y versión del sistema operativo.
347#@note    OSType = { Android, BSD, GrubLoader, Hurd, Linux, MacOS, Solaris, Windows, WinLoader }
348#@note    Requisitos: awk, head, chroot
349#@exception OG_ERR_FORMAT    Formato incorrecto.
350#@exception OG_ERR_NOTFOUND  Disco o partición no corresponden con un dispositiv
351#@exception OG_ERR_PARTITION Fallo al montar el sistema de archivos.
352#@version 0.9 - Primera versión para OpenGnSys
353#@author  Ramon Gomez, ETSII Universidad de Sevilla
354#@date    2009-09-15
355#@version 1.0.4 - Incluir tipos BSD, MacOS y Solaris.
356#@author  Ramon Gomez, ETSII Universidad de Sevilla
357#@date    2012-06-29
358#@version 1.0.5 - Incluir tipos GrubLoader, Hurd y WinLoader, leer por defecto fichero /etc/os-release.
359#@author  Ramon Gomez, ETSII Universidad de Sevilla
360#@date    2013-10-07
361#@version 1.0.6 - Detectar GrubLoader al final y sistemas basados en EFI.
362#@author  Ramon Gomez, ETSII Universidad de Sevilla
363#@date    2014-08-27
364#*/ ##
365function ogGetOsVersion ()
366{
367# Variables locales.
368local MNTDIR TYPE DISTRIB VERSION IS64BIT FILE
369# Si se solicita, mostrar ayuda.
370if [ "$*" == "help" ]; then
371    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_nfilesys" \
372           "$FUNCNAME 1 2  =>  Linux:Ubuntu precise (12.04 LTS) 64 bits"
373    return
374fi
375# Error si no se reciben 2 parametros.
376[ $# = 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
377
378# Montar la particion, si no lo estaba previamente.
379MNTDIR=$(ogMount $1 $2) || return $?
380
381# Buscar tipo de sistema operativo.
382# Para GNU/Linux: leer descripción.
383TYPE="Linux"
384FILE="$MNTDIR/etc/os-release"
385[ -r $FILE ] && VERSION="$(awk -F= '$1~/PRETTY_NAME/ {gsub(/\"/,"",$2); print $2}' $FILE)"
386# Si no se puede obtener, buscar en ficheros del sistema.
387if [ -z "$VERSION" ]; then
388    FILE="$MNTDIR/etc/lsb-release"
389    [ -r $FILE ] && VERSION="$(awk -F= '$1~/DESCRIPTION/ {gsub(/\"/,"",$2); print $2}' $FILE)"
390    for DISTRIB in redhat SuSE mandrake gentoo; do
391        FILE="$MNTDIR/etc/${DISTRIB}-release"
392        [ -r $FILE ] && VERSION="$(head -1 $FILE)"
393    done
394    FILE="$MNTDIR/etc/arch-release"
395    [ -r $FILE ] && VERSION="Arch Linux"
396    FILE="$MNTDIR/etc/slackware-version"
397    [ -r $FILE ] && VERSION="Slackware $(cat $FILE)"
398fi
399# Si no se encuentra, intentar ejecutar "lsb_release".
400[ -z "$VERSION" ] && VERSION=$(chroot $MNTDIR lsb_release -d 2>/dev/null | awk -F":\t" '{print $2}')
401# Comprobar Linux de 64 bits.
402[ -n "$VERSION" ] && [ -e $MNTDIR/lib64 ] && IS64BIT="$MSG_64BIT"
403# Para Android, leer fichero de propiedades.
404if [ -z "$VERSION" ]; then
405    TYPE="Android"
406    FILE="$MNTDIR/android*/system/build.prop"
407    [ -r $FILE ] && VERSION="Android $(awk -F= '$1~/(product.brand|build.version.release)/ {print $2}' $FILE | tr '\n' ' ')"
408    [ -e $MNTDIR/lib64 ] && IS64BIT="$MSG_64BIT"
409fi
410# Para GNU/Hurd, comprobar fichero de inicio (basado en os-prober).
411if [ -z "$VERSION" ]; then
412    TYPE="Hurd"
413    FILE="$MNTDIR/hurd/init"
414    [ -r $FILE ] && VERSION="GNU/Hurd"
415fi
416# Para Windows: leer la version del registro.
417if [ -z "$VERSION" ]; then
418    TYPE="Windows"
419    FILE="$(ogGetHivePath $MNTDIR SOFTWARE)"
420    if [ -n "$FILE" ]; then
421        # Nuevo método más rápido para acceder al registro de Windows..
422        VERSION=$(echo $(hivexsh << EOT 2>/dev/null
423load $FILE
424cd \Microsoft\Windows NT\CurrentVersion
425lsval ProductName
426lsval ReleaseId
427EOT
428        ))
429        [ -n "$(reglookup -H -p "Microsoft/Windows/CurrentVersion/ProgramW6432Dir" "$FILE" 2>/dev/null)" ] && IS64BIT="$MSG_64BIT"
430        if [ -z "$VERSION" ]; then
431            # Compatibilidad con métrodo antiguo y más lento de acceder al registro.
432            VERSION=$(ogGetRegistryValue $MNTDIR software '\Microsoft\Windows NT\CurrentVersion\ProductName' 2>/dev/null)
433            [ -n "$(ogGetRegistryValue $MNTDIR software '\Microsoft\Windows\CurrentVersion\ProgramW6432Dir' 2>/dev/null)" ] && IS64BIT="$MSG_64BIT"
434        fi
435    fi
436fi
437# Para cargador Windows: buscar versión en fichero BCD (basado en os-prober).
438if [ -z "$VERSION" ]; then
439    TYPE="WinLoader"
440    FILE="$(ogGetPath $MNTDIR/boot/bcd)"
441    [ -z "$FILE" ] && FILE="$(ogGetPath $MNTDIR/EFI/Microsoft/boot/bcd)"
442    if [ -n "$FILE" ]; then
443        for DISTRIB in "Windows Recovery" "Windows Boot"; do
444            if grep -aqs "$(echo "$DISTRIB" | sed 's/./&./g')" $FILE; then
445                VERSION="$DISTRIB loader"
446            fi
447        done
448    fi
449fi
450# Para macOS: detectar kernel y completar con fichero plist de información del sistema.
451if [ -z "$VERSION" ]; then
452    TYPE="MacOS"
453    # Kernel de Mac OS (no debe ser fichero de texto).
454    FILE="$MNTDIR/mach_kernel"
455    if [ -z "$(file -b $FILE | grep 'text')" ]; then
456        # Obtener tipo de kernel.
457        [ -n "$(file -b $FILE | grep 'Mach-O')" ] && VERSION="macOS"
458        [ -n "$(file -b $FILE | grep 'Mach-O 64-bit')" ] && IS64BIT="$MSG_64BIT"
459        # Datos de configuración de versión de Mac OS.
460        FILE="$MNTDIR/System/Library/CoreServices/SystemVersion.plist"
461        [ -r $FILE ] && VERSION=$(awk -F"[<>]" '
462                                      /ProductName/ {getline;s=$3}
463                                      /ProductVersion/ {getline;v=$3}
464                                      END {print s,v}' $FILE)
465        # Datos de recuperación de macOS.
466        FILE="$MNTDIR/com.apple.recovery.boot"
467        [ -r $FILE -a -n "$VERSION" ] && VERSION="$VERSION recovery"
468    fi
469fi
470# Para FreeBSD: obtener datos del Kernel.
471### TODO Revisar solución.
472if [ -z "$VERSION" ]; then
473    TYPE="BSD"
474    FILE="$MNTDIR/boot/kernel/kernel"
475    if [ -r $FILE ]; then
476        VERSION="$(strings $FILE|awk '/@.*RELEASE/ {sub(/@\(#\)/,""); print $1,$2}')"
477        [ -n "$(file -b $FILE | grep 'x86-64')" ] && IS64BIT="$MSG_64BIT"
478    fi
479fi
480# Para Solaris: leer el fichero de versión.
481### TODO Revisar solución.
482if [ -z "$VERSION" ]; then
483    TYPE="Solaris"
484    FILE="$MNTDIR/etc/release"
485    [ -r $FILE ] && VERSION="$(head -1 $FILE)"
486fi
487# Para cargador GRUB, comprobar fichero de configuración.
488if [ -z "$VERSION" ]; then
489    TYPE="GrubLoader"
490    for FILE in $MNTDIR/{,boot/}grub/menu.lst; do
491        [ -r $FILE ] && VERSION="GRUB Loader"
492    done
493#/* (comentario Doxygen)   
494    for FILE in $MNTDIR/{,boot/}{grub{,2},EFI/*}/grub.cfg; do
495        [ -r $FILE ] && VERSION="GRUB2 Loader"
496    done   
497fi
498#*/ (Comentario Doxygen)
499# Mostrar resultado y salir sin errores.
500[ -n "$VERSION" ] && echo "$TYPE:$VERSION $IS64BIT"
501return 0
502}
Note: See TracBrowser for help on using the repository browser.