[b550747] | 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. |
---|
[825dd06] | 7 | #@version 1.0.5 |
---|
[b550747] | 8 | #@warning License: GNU GPLv3+ |
---|
| 9 | #*/ |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | #/** |
---|
[cb5997b] | 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 | #*/ |
---|
[e4dafd6] | 20 | function ogGetArch () |
---|
| 21 | { |
---|
| 22 | if [ "$*" == "help" ]; then |
---|
| 23 | ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => x86_64" |
---|
| 24 | return |
---|
| 25 | fi |
---|
| 26 | |
---|
| 27 | [ -d /lib64 ] && echo "x86_64" || echo "i386" |
---|
[cb5997b] | 28 | } |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | #/** |
---|
[4d2b852] | 32 | # ogGetOsVersion int_ndisk int_nfilesys |
---|
[1d531f9] | 33 | #@brief Devuelve la versión del sistema operativo instalado en un sistema de archivos. |
---|
[42669ebf] | 34 | #@param int_ndisk nº de orden del disco |
---|
[4d2b852] | 35 | #@param int_nfilesys nº de orden de la partición |
---|
[f35fadc] | 36 | #@return OSType:OSVersion - tipo y versión del sistema operativo. |
---|
[4d2b852] | 37 | #@note OSType = { Android, BSD, GrubLoader, Hurd, Linux, MacOS, Solaris, Windows, WinLoader } |
---|
[1d531f9] | 38 | #@note Requisitos: awk, head, chroot |
---|
| 39 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
| 40 | #@exception OG_ERR_NOTFOUND Disco o partición no corresponden con un dispositiv |
---|
| 41 | #@exception OG_ERR_PARTITION Fallo al montar el sistema de archivos. |
---|
[f35fadc] | 42 | #@version 0.9 - Primera versión para OpenGnSys |
---|
[1d531f9] | 43 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 44 | #@date 2009-09-15 |
---|
[f35fadc] | 45 | #@version 1.0.4 - Incluir tipos BSD, MacOS y Solaris. |
---|
| 46 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 47 | #@date 2012-06-29 |
---|
[4d2b852] | 48 | #@version 1.0.5 - Incluir tipos GrubLoader, Hurd y WinLoader, leer por defecto fichero /etc/os-release. |
---|
[988438f] | 49 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
[6f4e407] | 50 | #@date 2013-10-07 |
---|
[1e7eaab] | 51 | #*/ ## |
---|
[42669ebf] | 52 | function ogGetOsVersion () |
---|
| 53 | { |
---|
[1d531f9] | 54 | # Variables locales. |
---|
[988438f] | 55 | local MNTDIR TYPE DISTRIB VERSION IS64BIT FILE |
---|
[42669ebf] | 56 | # Si se solicita, mostrar ayuda. |
---|
[be74e2d] | 57 | if [ "$*" == "help" ]; then |
---|
[4d2b852] | 58 | ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_nfilesys" \ |
---|
| 59 | "$FUNCNAME 1 2 => Linux:Ubuntu precise (12.04 LTS) 64 bits" |
---|
[1d531f9] | 60 | return |
---|
| 61 | fi |
---|
[42669ebf] | 62 | # Error si no se reciben 2 parametros. |
---|
[055adcf] | 63 | [ $# = 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
[1d531f9] | 64 | |
---|
| 65 | # Montar la particion, si no lo estaba previamente. |
---|
| 66 | MNTDIR=$(ogMount $1 $2) || return $? |
---|
| 67 | |
---|
[988438f] | 68 | # Buscar tipo de sistema operativo. |
---|
| 69 | # Para GNU/Linux: leer descripción. |
---|
| 70 | TYPE="Linux" |
---|
[825dd06] | 71 | FILE="$MNTDIR/etc/os-release" |
---|
| 72 | [ -r $FILE ] && VERSION="$(awk -F= '$1~/PRETTY_NAME/ {gsub(/\"/,"",$2); print $2}' $FILE)" |
---|
[988438f] | 73 | # Si no se puede obtener, buscar en ficheros del sistema. |
---|
| 74 | if [ -z "$VERSION" ]; then |
---|
| 75 | FILE="$MNTDIR/etc/lsb-release" |
---|
[825dd06] | 76 | [ -r $FILE ] && VERSION="$(awk -F= '$1~/DESCRIPTION/ {gsub(/\"/,"",$2); print $2}' $FILE)" |
---|
[988438f] | 77 | for DISTRIB in redhat SuSE mandrake gentoo; do |
---|
| 78 | FILE="$MNTDIR/etc/${DISTRIB}-release" |
---|
[f35fadc] | 79 | [ -r $FILE ] && VERSION="$(head -1 $FILE)" |
---|
[988438f] | 80 | done |
---|
| 81 | FILE="$MNTDIR/etc/arch-release" |
---|
| 82 | [ -r $FILE ] && VERSION="Arch Linux" |
---|
| 83 | FILE="$MNTDIR/etc/slackware-version" |
---|
| 84 | [ -r $FILE ] && VERSION="Slackware $(cat $FILE)" |
---|
| 85 | fi |
---|
[825dd06] | 86 | # Si no se encuentra, intentar ejecutar "lsb_release". |
---|
| 87 | [ -z "$VERSION" ] && VERSION=$(chroot $MNTDIR lsb_release -d 2>/dev/null | awk -F":\t" '{print $2}') |
---|
| 88 | # Comprobar Linux de 64 bits. |
---|
| 89 | [ -n "$VERSION" ] && [ -e $MNTDIR/lib64 ] && IS64BIT="$MSG_64BIT" |
---|
[4d2b852] | 90 | # Para cargador GRUB, comprobar fichero de configuración. |
---|
| 91 | if [ -z "$VERSION" ]; then |
---|
| 92 | TYPE="GrubLoader" |
---|
| 93 | for FILE in $MNTDIR/{,boot/}grub/menu.lst; do |
---|
| 94 | [ -r $FILE ] && VERSION="GRUB Loader" |
---|
| 95 | done |
---|
| 96 | for FILE in $MNTDIR/{,boot/}grub{,2}/grub.cfg; do |
---|
| 97 | [ -r $FILE ] && VERSION="GRUB2 Loader" |
---|
| 98 | done |
---|
| 99 | fi |
---|
[988438f] | 100 | # Para Android, leer fichero de propiedades. |
---|
| 101 | if [ -z "$VERSION" ]; then |
---|
| 102 | TYPE="Android" |
---|
| 103 | FILE="$MNTDIR/android*/system/build.prop" |
---|
| 104 | [ -r $FILE ] && VERSION="Android $(awk -F= '$1~/(product.brand|build.version.release)/ {print $2}' $FILE | tr '\n' ' ')" |
---|
| 105 | [ -e $MNTDIR/lib64 ] && IS64BIT="$MSG_64BIT" |
---|
| 106 | fi |
---|
| 107 | # Para GNU/Hurd, comprobar fichero de inicio (basado en os-prober). |
---|
| 108 | if [ -z "$VERSION" ]; then |
---|
| 109 | TYPE="Hurd" |
---|
| 110 | FILE="$MNTDIR/hurd/init" |
---|
| 111 | [ -r $FILE ] && VERSION="GNU/Hurd" |
---|
| 112 | fi |
---|
| 113 | # Para Windows: leer la version del registro. |
---|
| 114 | if [ -z "$VERSION" ]; then |
---|
| 115 | TYPE="Windows" |
---|
| 116 | VERSION=$(ogGetRegistryValue $MNTDIR software '\Microsoft\Windows NT\CurrentVersion\ProductName') |
---|
| 117 | [ -n "$(ogGetRegistryValue $MNTDIR software '\Microsoft\Windows\CurrentVersion\ProgramW6432Dir' 2>/dev/null)" ] && IS64BIT="$MSG_64BIT" |
---|
| 118 | fi |
---|
| 119 | # Para cargador Windows: buscar versión en fichero BCD (basado en os-prober). |
---|
| 120 | if [ -z "$VERSION" ]; then |
---|
| 121 | TYPE="WinLoader" |
---|
| 122 | FILE="$(ogGetPath $MNTDIR/boot/bcd)" |
---|
| 123 | if [ -n "$FILE" ]; then |
---|
| 124 | for DISTRIB in "Windows 8" "Windows 7" "Windows Vista" \ |
---|
| 125 | "Windwos Server 2008" "Windwos Server 2008 R2" \ |
---|
| 126 | "Windwos Recovery Environment"; do |
---|
| 127 | if grep -qs "$(echo "$DISTRIB" | sed 's/./&./g')" $FILE; then |
---|
| 128 | VERSION="$DISTRIB loader" |
---|
| 129 | fi |
---|
| 130 | done |
---|
| 131 | fi |
---|
| 132 | fi |
---|
[6f4e407] | 133 | # Para MacOS: detectar kernel y completar con fichero plist de información del sistema. |
---|
[988438f] | 134 | if [ -z "$VERSION" ]; then |
---|
| 135 | TYPE="MacOS" |
---|
[6f4e407] | 136 | # Kernel de Mac OS. |
---|
| 137 | FILE="$MNTDIR/mach_kernel" |
---|
| 138 | [ -n "$(file -b $FILE | grep 'Mach-O')" ] && VERSION="Mac OS" |
---|
| 139 | [ -n "$(file -b $FILE | grep 'Mach-O 64-bit')" ] && IS64BIT="$MSG_64BIT" |
---|
| 140 | # Datos de configuración de versión de Mac OS. |
---|
| 141 | FILE="$MNTDIR/System/Library/CoreServices/SystemVersion.plist" |
---|
| 142 | [ -r $FILE ] && VERSION=$(awk -F"[<>]" ' |
---|
| 143 | /ProductName/ {getline;s=$3} |
---|
| 144 | /ProductVersion/ {getline;v=$3} |
---|
| 145 | END {print s,v}' $FILE) |
---|
| 146 | # Datos de recuperación de Mac OS. |
---|
| 147 | FILE="$MNTDIR/com.apple.recovery.boot" |
---|
| 148 | [ -r $FILE -a -n "$VERSION" ] && VERSION="$VERSION recovery" |
---|
[988438f] | 149 | fi |
---|
| 150 | # Para FreeBSD: obtener datos del Kernel. |
---|
| 151 | ### TODO Revisar solución. |
---|
| 152 | if [ -z "$VERSION" ]; then |
---|
| 153 | TYPE="BSD" |
---|
| 154 | FILE="$MNTDIR/boot/kernel/kernel" |
---|
| 155 | if [ -r $FILE ]; then |
---|
| 156 | VERSION="$(strings $FILE|awk '/@.*RELEASE/ {print $1,$2}')" |
---|
| 157 | [ -n "$(file -b $FILE | grep 'x86-64')" ] && IS64BIT="$MSG_64BIT" |
---|
| 158 | fi |
---|
| 159 | fi |
---|
| 160 | # Para Solaris: leer el fichero de versión. |
---|
| 161 | ### TODO Revisar solución. |
---|
| 162 | if [ -z "$VERSION" ]; then |
---|
| 163 | TYPE="Solaris" |
---|
| 164 | FILE="$MNTDIR/etc/release" |
---|
| 165 | [ -r $FILE ] && VERSION="$(head -1 $FILE)" |
---|
| 166 | fi |
---|
[1d531f9] | 167 | |
---|
[42669ebf] | 168 | # Mostrar resultado y salir sin errores. |
---|
[988438f] | 169 | [ -n "$VERSION" ] && echo "$TYPE:$VERSION $IS64BIT" |
---|
[d071d9b] | 170 | return 0 |
---|
[1d531f9] | 171 | } |
---|
| 172 | |
---|
| 173 | |
---|
| 174 | #/** |
---|
[1c04494] | 175 | # ogGetOsType int_ndisk int_npartition |
---|
| 176 | #@brief Devuelve el tipo del sistema operativo instalado. |
---|
[42669ebf] | 177 | #@param int_ndisk nº de orden del disco |
---|
| 178 | #@param int_npartition nº de orden de la partición |
---|
[f35fadc] | 179 | #@return OSType - Tipo de sistema operativo. |
---|
| 180 | #@note OSType = { Android, BSD, Linux, MacOS, Windows } |
---|
[1c04494] | 181 | #@see ogGetOsVersion |
---|
[1e7eaab] | 182 | #*/ ## |
---|
[42669ebf] | 183 | function ogGetOsType () |
---|
| 184 | { |
---|
[e4dafd6] | 185 | # Si se solicita, mostrar ayuda. |
---|
| 186 | if [ "$*" == "help" ]; then |
---|
| 187 | ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \ |
---|
| 188 | "$FUNCNAME 1 2 => Linux" |
---|
| 189 | return |
---|
| 190 | fi |
---|
[1c04494] | 191 | ogGetOsVersion "$@" | cut -sf1 -d: |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | |
---|
| 195 | #/** |
---|
[b550747] | 196 | # ogListHardwareInfo |
---|
| 197 | #@brief Lista el inventario de hardware de la máquina cliente. |
---|
| 198 | #@return TipoDispositivo:Modelo (por determinar) |
---|
| 199 | #@warning Se ignoran los parámetros de entrada. |
---|
| 200 | #@note TipoDispositivo = { ata, bio, boa, cdr, cpu, dis, fir, mem, mod, mul, net, ser, vga } |
---|
| 201 | #@note Requisitos: lshw, awk |
---|
[f35fadc] | 202 | #@version 0.1 - Primeras pruebas con OpenGnSys |
---|
[b550747] | 203 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 204 | #@date 2009-07-28 |
---|
[1e7eaab] | 205 | #*/ ## |
---|
[42669ebf] | 206 | function ogListHardwareInfo () |
---|
| 207 | { |
---|
| 208 | # Si se solicita, mostrar ayuda. |
---|
[be74e2d] | 209 | if [ "$*" == "help" ]; then |
---|
[b550747] | 210 | ogHelp "$FUNCNAME" "$FUNCNAME" |
---|
| 211 | return |
---|
| 212 | fi |
---|
| 213 | |
---|
[42669ebf] | 214 | # Recopilación de disposibivos procesando la salida de \c lshw |
---|
[b550747] | 215 | ogEcho info "$MSG_HARDWAREINVENTORY}" |
---|
| 216 | lshw | awk 'BEGIN {type="mod";} |
---|
| 217 | /product:/ {sub(/ *product: */,""); prod=$0;} |
---|
| 218 | /vendor:/ {sub(/ *vendor: */,""); vend=$0;} |
---|
| 219 | /version:/ {sub(/ *version: */,"v.");vers=$0;} |
---|
| 220 | /size:/ {sub(/ *size: */,""); size=$0;} |
---|
| 221 | /\*-/ {if (type=="mem") |
---|
[c2b03eb] | 222 | print type"="size; |
---|
| 223 | else |
---|
| 224 | if (type!="" && prod!="") |
---|
| 225 | print type"="vend,prod,size,vers; |
---|
| 226 | type=prod=vend=vers=size="";} |
---|
[b550747] | 227 | /-core/ {type="boa";} |
---|
| 228 | /-firmware/ {type="bio";} |
---|
| 229 | /-cpu/ {type="cpu";} |
---|
| 230 | /-memory/ {type="mem";} |
---|
| 231 | /-ide/ {type="ide";} |
---|
| 232 | /-disk/ {type="dis";} |
---|
| 233 | /-cdrom/ {type="cdr";} |
---|
| 234 | /-display/ {type="vga";} |
---|
| 235 | /-network/ {type="net";} |
---|
| 236 | /-multimedia/ {type="mul";} |
---|
| 237 | /-usb/ {type="usb";} |
---|
| 238 | /-firewire/ {type="fir";} |
---|
| 239 | /-serial/ {type="bus";} |
---|
| 240 | END {if (type!="" && prod!="") |
---|
[c2b03eb] | 241 | print type"="vend,prod,size,vers;} |
---|
[b550747] | 242 | ' |
---|
[42669ebf] | 243 | # */ (comentario para Doxygen) |
---|
[b550747] | 244 | } |
---|
| 245 | |
---|
| 246 | |
---|
[50a094c] | 247 | #/** |
---|
[42669ebf] | 248 | # ogListSoftware int_ndisk int_npartition |
---|
[50a094c] | 249 | #@brief Lista el inventario de software instalado en un sistema operativo. |
---|
[42669ebf] | 250 | #@param int_ndisk nº de orden del disco |
---|
| 251 | #@param int_npartition nº de orden de la partición |
---|
| 252 | #@return programa versión ... |
---|
[50a094c] | 253 | #@warning Se ignoran los parámetros de entrada. |
---|
| 254 | #@note Requisitos: ... |
---|
| 255 | #@todo Detectar software en Linux |
---|
[f35fadc] | 256 | #@version 0.1 - Primeras pruebas con OpenGnSys |
---|
[50a094c] | 257 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 258 | #@date 2009-09-23 |
---|
[89a5166] | 259 | #@version 1.0.5 - Aproximación para inventario de software de Mac OS. |
---|
| 260 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 261 | #@date 2013-10-08 |
---|
[1e7eaab] | 262 | #*/ ## |
---|
[42669ebf] | 263 | function ogListSoftware () |
---|
| 264 | { |
---|
[50a094c] | 265 | # Variables locales. |
---|
[e4dafd6] | 266 | local MNTDIR TYPE DPKGDIR RPMDIR PACMANDIR KEYS KEYS32 k PROG VERS |
---|
[50a094c] | 267 | |
---|
[42669ebf] | 268 | # Si se solicita, mostrar ayuda. |
---|
[be74e2d] | 269 | if [ "$*" == "help" ]; then |
---|
[50a094c] | 270 | ogHelp "$FUNCNAME" "$FUNCNAME 1 1" |
---|
| 271 | return |
---|
| 272 | fi |
---|
[42669ebf] | 273 | # Error si no se reciben 2 parametros. |
---|
[50a094c] | 274 | [ $# = 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 275 | |
---|
[42669ebf] | 276 | # Obtener tipo de sistema de archivos y montarlo. |
---|
[50a094c] | 277 | TYPE=$(ogGetFsType $1 $2) || return $? |
---|
| 278 | MNTDIR=$(ogMount $1 $2) || return $? |
---|
| 279 | |
---|
| 280 | case "$TYPE" in |
---|
[89a5166] | 281 | EXT[234]|REISERFS|REISER4) # Software de GNU/Linux. |
---|
[c2b03eb] | 282 | # Procesar paquetes dpkg. |
---|
| 283 | DPKGDIR="${MNTDIR}/var/lib/dpkg" |
---|
| 284 | if [ -r $DPKGDIR ]; then |
---|
| 285 | # dpkg --admindir=$DPKGDIR -l | \ |
---|
| 286 | # Proceso de fichero en sistemas de 64 bits. |
---|
| 287 | if [ -e $MNTDIR/lib64 ]; then |
---|
| 288 | awk '/Package:/ {if (pack!="") print pack,vers; |
---|
| 289 | sub(/-dev$/,"",$2); |
---|
| 290 | pack=$2} |
---|
| 291 | /Version:/ {sub(/^.*:/,"",$2); sub(/-.*$/,"",$2); |
---|
| 292 | vers=$2} |
---|
| 293 | /Status:/ {if ($2!="install") pack=vers=""} |
---|
| 294 | END {if (pack!="") print pack,vers} |
---|
| 295 | ' $MNTDIR/var/lib/dpkg/status | sort | uniq |
---|
| 296 | else |
---|
| 297 | # FIXME Sólo 32 bits |
---|
| 298 | chroot "$MNTDIR" /usr/bin/dpkg -l | \ |
---|
| 299 | awk '$1~/ii/ {sub(/-dev$/,"",$2); sub(/^.*:/,"",$3); |
---|
| 300 | sub(/-.*$/,"",$3); print $2,$3} |
---|
| 301 | ' | sort | uniq |
---|
| 302 | fi |
---|
| 303 | fi |
---|
| 304 | # Procesar paquetes RPM. |
---|
| 305 | RPMDIR="${MNTDIR}/var/lib/rpm" |
---|
| 306 | if [ -r $RPMDIR ]; then |
---|
| 307 | # Correccion inconsistencia de version de base de datos. |
---|
| 308 | # rm -f ${RPMDIR}/__db.* |
---|
| 309 | # rpm --dbpath $RPMDIR -qa --qf "%{NAME} %{VERSION}\n" | \ |
---|
| 310 | # FIXME Sólo 32 bits |
---|
| 311 | chroot $MNTDIR /bin/rpm -qa --qf "%{NAME} %{VERSION}\n" | \ |
---|
| 312 | awk '$1!~/-devel$/ {sub(/-.*$/,"",$2); print $0}' | \ |
---|
| 313 | sort | uniq |
---|
| 314 | # rm -f ${RPMDIR}/__db.* |
---|
| 315 | fi |
---|
[2e472ef3] | 316 | # Procesar paquetes pacman. |
---|
| 317 | PACMANDIR="${MNTDIR}/var/lib/pacman/local" |
---|
| 318 | if [ -r $PACMANDIR ]; then |
---|
| 319 | # FIXME Separar nombre y versión de los paquetes |
---|
| 320 | ls -A $PACMANDIR |
---|
| 321 | fi |
---|
[c2b03eb] | 322 | ;; |
---|
[89a5166] | 323 | NTFS|HNTFS|FAT32|HFAT32) # Software de Windows. |
---|
[c2b03eb] | 324 | # Claves de registro para programas instalados: formato "{clave}". |
---|
| 325 | KEYS=$(ogListRegistryKeys $MNTDIR software '\Microsoft\Windows\CurrentVersion\Uninstall') |
---|
[180f43e] | 326 | KEYS32=$(ogListRegistryKeys $MNTDIR software '\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall') |
---|
[c2b03eb] | 327 | # Mostrar los valores "DisplayName" y "DisplayVersion" para cada clave. |
---|
| 328 | (for k in $KEYS; do |
---|
| 329 | PROG=$(ogGetRegistryValue $MNTDIR software "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayName") |
---|
| 330 | if [ -n "$PROG" ]; then |
---|
| 331 | VERS=$(ogGetRegistryValue $MNTDIR software "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayVersion") |
---|
| 332 | echo "$PROG $VERS" |
---|
| 333 | fi |
---|
[180f43e] | 334 | done |
---|
| 335 | for k in $KEYS32; do |
---|
| 336 | PROG=$(ogGetRegistryValue $MNTDIR software "\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayName") |
---|
| 337 | if [ -n "$PROG" ]; then |
---|
| 338 | VERS=$(ogGetRegistryValue $MNTDIR software "\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayVersion") |
---|
| 339 | echo "$PROG $VERS" |
---|
| 340 | fi |
---|
[c2b03eb] | 341 | done) | sort | uniq |
---|
| 342 | ;; |
---|
[89a5166] | 343 | HFS|HFSPLUS) # Software de Mac OS. |
---|
| 344 | # Listar directorios de aplicaciones (falta buscar versiones en ficheros .plist). |
---|
| 345 | find "${MNTDIR}/Applications" -type d -name "*.app" -prune -print | \ |
---|
| 346 | while read k; do |
---|
| 347 | echo "$(basename "$k" .app)" |
---|
| 348 | done | sort |
---|
| 349 | ;; |
---|
[c2b03eb] | 350 | *) ogRaiseError $OG_ERR_PARTITION "$1, $2" |
---|
[50a094c] | 351 | return $? ;; |
---|
| 352 | esac |
---|
| 353 | } |
---|
| 354 | |
---|
[be74e2d] | 355 | #/** @function ogInfoCache: @brief muestra la informacion de la CACHE. |
---|
| 356 | #@param sin parametros |
---|
| 357 | #@return texto que se almacena en $IP.-InfoCache. punto_montaje, tama?oTotal, TamanioOcupado, TaminioLibre, imagenes dentro de la cahce |
---|
| 358 | #@warning Salidas de errores no determinada |
---|
| 359 | #@warning printf no soportado por busybox |
---|
| 360 | #@attention |
---|
| 361 | #@version 0.1 Date: 27/10/2008 Author Antonio J. Doblas Viso. Universidad de Malaga |
---|
| 362 | #*/ |
---|
[e4dafd6] | 363 | function ogInfoCache () |
---|
| 364 | { |
---|
| 365 | local info infoFilesystem infoSize infoUsed infoUsedPorcet infoMountedOn content |
---|
[be74e2d] | 366 | if ogMountCache |
---|
| 367 | then |
---|
| 368 | info=`df -h | grep $OGCAC` |
---|
| 369 | infoFilesystem=`echo $info | cut -f1 -d" "` |
---|
| 370 | infoSize=`echo $info | cut -f2 -d" "` |
---|
| 371 | infoUsed=`echo $info | cut -f3 -d" "` |
---|
| 372 | infoAvail=`echo $info | cut -f4 -d" "` |
---|
| 373 | infoUsedPorcet=`echo $info | cut -f5 -d" "` |
---|
| 374 | infoMountedOn=`echo $info | cut -f2 -d" "` |
---|
| 375 | if `ls ${OGCAC}$OGIMG > /dev/null 2>&1` |
---|
| 376 | then |
---|
| 377 | cd ${OGCAC}${OPENGNSYS} |
---|
| 378 | #content=`find images/ -type f -printf "%h/ %f %s \n"` busybox no soporta printf |
---|
| 379 | content=`find images/ -type f` |
---|
| 380 | cd / |
---|
| 381 | echo $info |
---|
| 382 | echo -ne $content |
---|
| 383 | echo " " |
---|
| 384 | #echo "$info" > ${OGLOG}/${IP}-InfoCache |
---|
| 385 | #echo "$content" >> {$OGLOG}/${IP}-InfoCache |
---|
| 386 | else |
---|
| 387 | echo $info |
---|
| 388 | #echo "$info" > {$OGLOG}/${IP}-InfoCache |
---|
| 389 | fi |
---|
| 390 | ogUnmountCache |
---|
| 391 | else |
---|
| 392 | echo " " |
---|
| 393 | #echo " " > {$OGLOG}/${IP}-InfoCache |
---|
| 394 | |
---|
| 395 | fi |
---|
| 396 | } |
---|
[e4dafd6] | 397 | |
---|