source: client/engine/Inventory.lib @ 550192f

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 550192f was 58718f5, checked in by ramon <ramongomez@…>, 7 years ago

Cerrar #823: Métodos más rápido para localizar ficheros y para obtener versión en Windows; cambiar Mac OS... por macOS... en función ogGetOsVersion.

git-svn-id: https://opengnsys.es/svn/branches/version1.1@5576 a21b9725-9963-47de-94b9-378ad31fedc9

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