From c2b03eb3c234218d8984300dc452f08c06275f12 Mon Sep 17 00:00:00 2001 From: ramon Date: Tue, 20 Oct 2009 08:42:53 +0000 Subject: Función ogListSoftware detecta packetes deb en 64 bits. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://opengnsys.es/svn/trunk@393 a21b9725-9963-47de-94b9-378ad31fedc9 --- client/engine/Inventory.lib | 97 +++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 42 deletions(-) (limited to 'client/engine/Inventory.lib') diff --git a/client/engine/Inventory.lib b/client/engine/Inventory.lib index a7076fe0..816adf00 100755 --- a/client/engine/Inventory.lib +++ b/client/engine/Inventory.lib @@ -97,11 +97,11 @@ lshw | awk 'BEGIN {type="mod";} /version:/ {sub(/ *version: */,"v.");vers=$0;} /size:/ {sub(/ *size: */,""); size=$0;} /\*-/ {if (type=="mem") - print type"="size; - else - if (type!="" && prod!="") - print type"="vend,prod,size,vers; - type=prod=vend=vers=size="";} + print type"="size; + else + if (type!="" && prod!="") + print type"="vend,prod,size,vers; + type=prod=vend=vers=size="";} /-core/ {type="boa";} /-firmware/ {type="bio";} /-cpu/ {type="cpu";} @@ -116,7 +116,7 @@ lshw | awk 'BEGIN {type="mod";} /-firewire/ {type="fir";} /-serial/ {type="bus";} END {if (type!="" && prod!="") - print type"="vend,prod,size,vers;} + print type"="vend,prod,size,vers;} ' # */ (necesario para Doxygen) } @@ -151,42 +151,55 @@ TYPE=$(ogGetFsType $1 $2) || return $? MNTDIR=$(ogMount $1 $2) || return $? case "$TYPE" in - EXT[234]|REISERFS|REISER4) - # Procesar paquetes dpkg. - DPKGDIR="${MNTDIR}/var/lib/dpkg" - if [ -r $DPKGDIR ]; then - # dpkg --admindir=$DPKGDIR -l | \ - # FIXME Sólo 32 bits - chroot "$MNTDIR" /usr/bin/dpkg -l | \ - awk '$1~/ii/ {sub(/-dev$/,"",$2); sub(/^.*:/,"",$3); - sub(/-.*$/,"",$3); print $2,$3}' | sort | uniq - fi - # Procesar paquetes RPM. - RPMDIR="${MNTDIR}/var/lib/rpm" - if [ -r $RPMDIR ]; then - # Correccion inconsistencia de version de base de datos. - # rm -f ${RPMDIR}/__db.* - # rpm --dbpath $RPMDIR -qa --qf "%{NAME} %{VERSION}\n" | \ - # FIXME Sólo 32 bits - chroot $MNTDIR /bin/rpm -qa --qf "%{NAME} %{VERSION}\n" | \ - awk '$1!~/-devel$/ {sub(/-.*$/,"",$2); print $0}' | \ - sort | uniq - # rm -f ${RPMDIR}/__db.* - fi - ;; - NTFS|HNTFS|FAT32|HFAT32) - # Claves de registro para programas instalados: formato "{clave}". - KEYS=$(ogListRegistryKeys $MNTDIR software '\Microsoft\Windows\CurrentVersion\Uninstall') - # Mostrar los valores "DisplayName" y "DisplayVersion" para cada clave. - (for k in $KEYS; do - PROG=$(ogGetRegistryValue $MNTDIR software "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayName") - if [ -n "$PROG" ]; then - VERS=$(ogGetRegistryValue $MNTDIR software "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayVersion") - echo "$PROG $VERS" - fi - done) | sort | uniq - ;; - *) ogRaiseError $OG_ERR_PARTITION "$1,$2" + EXT[234]|REISERFS|REISER4) + # Procesar paquetes dpkg. + DPKGDIR="${MNTDIR}/var/lib/dpkg" + if [ -r $DPKGDIR ]; then + # dpkg --admindir=$DPKGDIR -l | \ + # Proceso de fichero en sistemas de 64 bits. + if [ -e $MNTDIR/lib64 ]; then + awk '/Package:/ {if (pack!="") print pack,vers; + sub(/-dev$/,"",$2); + pack=$2} + /Version:/ {sub(/^.*:/,"",$2); sub(/-.*$/,"",$2); + vers=$2} + /Status:/ {if ($2!="install") pack=vers=""} + END {if (pack!="") print pack,vers} + ' $MNTDIR/var/lib/dpkg/status | sort | uniq + else + # FIXME Sólo 32 bits + chroot "$MNTDIR" /usr/bin/dpkg -l | \ + awk '$1~/ii/ {sub(/-dev$/,"",$2); sub(/^.*:/,"",$3); + sub(/-.*$/,"",$3); print $2,$3} + ' | sort | uniq + fi + fi + # Procesar paquetes RPM. + RPMDIR="${MNTDIR}/var/lib/rpm" + if [ -r $RPMDIR ]; then + # Correccion inconsistencia de version de base de datos. + # rm -f ${RPMDIR}/__db.* + # rpm --dbpath $RPMDIR -qa --qf "%{NAME} %{VERSION}\n" | \ + # FIXME Sólo 32 bits + chroot $MNTDIR /bin/rpm -qa --qf "%{NAME} %{VERSION}\n" | \ + awk '$1!~/-devel$/ {sub(/-.*$/,"",$2); print $0}' | \ + sort | uniq + # rm -f ${RPMDIR}/__db.* + fi + ;; + NTFS|HNTFS|FAT32|HFAT32) + # Claves de registro para programas instalados: formato "{clave}". + KEYS=$(ogListRegistryKeys $MNTDIR software '\Microsoft\Windows\CurrentVersion\Uninstall') + # Mostrar los valores "DisplayName" y "DisplayVersion" para cada clave. + (for k in $KEYS; do + PROG=$(ogGetRegistryValue $MNTDIR software "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayName") + if [ -n "$PROG" ]; then + VERS=$(ogGetRegistryValue $MNTDIR software "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayVersion") + echo "$PROG $VERS" + fi + done) | sort | uniq + ;; + *) ogRaiseError $OG_ERR_PARTITION "$1, $2" return $? ;; esac } -- cgit v1.2.3-18-g5258