source: client/engine/PostConfEAC.lib @ 1d1e06d

Last change on this file since 1d1e06d was 305c256, checked in by irina <irinagomez@…>, 7 years ago

Se corrigen erratas por usar el código de error de ogGetPath

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

  • Property mode set to 100755
File size: 17.4 KB
Line 
1#!/bin/bash
2
3#         ogLoadHiveWindows int_ndisk int_partiton
4#@brief   Localiza los hive del registro de windows (de sistema y usuarios)
5#@param   int_ndisk      nº de orden del disco
6#@param   int_partition     nº de particion
7#@return 
8#@exception OG_ERR_FORMAT    Formato incorrecto.
9#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
10#@version 0.9 - Adaptación a OpenGNSys.
11#@author  Antonio J. Doblas Viso. Universidad de Málaga
12#@date    2009-09-24
13#*/ ##
14
15
16function ogLoadHiveWindows () {
17# Variables locales.
18local PART DISK
19
20# Si se solicita, mostrar ayuda.
21if [ "$*" == "help" ]; then
22    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_partition" \
23           "$FUNCNAME 1 1 "
24    return
25fi     
26
27# Error si no se reciben 2 parámetros.
28[ $# == 2 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
29
30DISK=$1; PART=$2;
31
32#Comprobaciones redundantes: borrar"
33#ogDiskToDev $DISK $PART || return $(ogRaiseError $OG_ERR_PARTITION "particion de windows no detectada"; echo $?)
34#ogGetOsType $DISK $PART | grep "Windows" || return $(ogRaiseError $OG_ERR_NOTOS "no es windows"; echo $?)
35#VERSION=$(ogGetOsVersion $DISK $PART)
36#Fin Comprobaciones redundantes: borrar"
37
38
39# primera fase, carga de los hive del sistema
40if ogGetPath $DISK $PART WINDOWS
41then
42        SYSTEMROOT="Windows"
43elif ogGetPath $DISK $PART WINNT
44then
45        SYSTEMROOT="winnt"
46else
47        return $(ogRaiseError $OG_ERR_NOTOS "version windows no detectada"; echo $?)
48fi
49
50hiveSAM=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/SAM)
51[ -n "$hiveSAM" ] && export hiveSAM || return $(ogRaiseError $OG_ERR_NOTOS " hive SAM  no detectada"; echo $?)
52hiveSYSTEM=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/system)
53[ -n "$hiveSYSTEM" ] && export hiveSYSTEM || return $(ogRaiseError $OG_ERR_NOTOS "hive SYSTEM  no detectada"; echo $?)
54hiveSOFTWARE=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/software)
55[ -n "$hiveSOFTWARE" ] && export hiveSOFTWARE || return $(ogRaiseError $OG_ERR_NOTOS "hive SOFTWARE no detectada"; echo $?)
56export TEMPhive=/tmp/tmpregistry
57
58# segunda fase, carga de los hive de usuarios windows.
59declare -i COUNT
60COUNT=3
61#TODO WINDOWS XP WINDOWS7
62BASEHOMEDIR=$(ogGetPath $DISK $PART /"Documents and Settings")
63TMPUSERFILE="/tmp/WuserRegAndDAT.tmp"
64find "$BASEHOMEDIR/" -type f -name NTUSER.DAT > $TMPUSERFILE 
65LISTUSERS=$(drbl-chntpw -l $hiveSAM | grep RID | awk -F"<" '{print $2}' | awk -F">" '{print $1}')
66#echo "$BASEHOMEDIR" $LISTUSERS
67for user in $LISTUSERS
68do                     
69        # Comprobamos que el usuario registrado tiene .DAT
70                if HOMEDIR=$(cat $TMPUSERFILE | grep -w $user) 
71                then
72                        #echo "$user exportamos los usuarios de windows como variables, y como valor hiveUSERX; donde la X es 3 4 5 6 ... X"
73                        export `echo $user=hiveUSER$COUNT`
74                        #echo "$user exportamos la variable hiveUSERX con el valor del home de la variable-usuario_windows"
75                        ##export `echo hiveUSER$COUNT`="$(echo $HOMEDIR | sed -e 's/ /\\ /'g | sed -e 's/\\/\\\\/g')"
76                        export `echo hiveUSER$COUNT`="$(echo $HOMEDIR)"
77                        #echo " estas variables \$USUARIO -> Identificador del HIVE ; \${!USUARIO} -> path del HIVE "
78                        COUNT=${COUNT}+1
79                fi
80               
81done
82COUNT=0
83}
84
85
86#         ogUpdateHiveWindows 
87#@brief   Actualiza los hive de windows.
88#@param   int_ndisk       
89#@param   int_partition     
90#@return 
91#@exception OG_ERR_FORMAT    Formato incorrecto.
92#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
93#@version 0.9 - Adaptación a OpenGNSys.
94#@author  Antonio J. Doblas Viso. Universidad de Málaga
95#@date    2009-09-24
96#*/ ##
97
98
99function ogUpdateHiveWindows (){
100# Variables locales.
101local PART DISK FILE
102
103#TODO detectar llamada a ogLoadHiveWindows
104
105# Si se solicita, mostrar ayuda.
106if [ "$*" == "help" ]; then
107    ogHelp "$FUNCNAME" "$FUNCNAME " \
108           "$FUNCNAME  "
109    return
110fi     
111
112echo drbl-chntpw -f $TEMPhive $hiveSAM $hiveSYSTEM $hiveSOFTWARE \"${hiveUSER3}\" \"${hiveUSER4}\" \"${hiveUSER5}\" \"${hiveUSER6}\" \"${hiveUSER7}\" \"${hiveUSER8}\" \"${hiveUSER9}\" > /tmp/run.sh
113cat /tmp/run.sh; sh /tmp/run.sh; rm -fr $TEMPhive; rm /tmp/run.sh
114
115unset hiveSAM hiveSYSTEM hiveSOFTWARE TEMPhive hiveUSER3 hiveUSER4 hiveUSER5 hiveUSER6 hiveUSER7 hiveUSER8 hiveUSER9
116 
117
118}
119
120
121
122function ogHiveNTRunMachine () {
123#echo sintaxis:  PathScripts idScripts
124#echo ejemplo:   c:\\\\WINDOSWS\\\\crearusuarios.bat  scripts1
125#echo IMPORTANTE: el path debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\
126#echo "identifica 0=$hiveSAM 1=$hiveSystem 2=$hiveSoftware 3=$HiveUser3"
127
128local PART DISK FILE
129
130# Si se solicita, mostrar ayuda.
131if [ "$*" == "help" ]; then
132    ogHelp "$FUNCNAME" "$FUNCNAME PathScripts|command keyName " \
133           "$FUNCNAME c:\\\\Windows\\\\crearusuarios.cmd scripts_crearUsuarios "\
134           "$FUNCNAME "cmd /c del c:\ogboot.*" ogcleanboot "\
135           "$FUNCNAME Requiere la previa ejecución de ogLoadHive int_disk int_part"\
136           "$FUNCNAME Despues requiere el ogUpdateHive"
137    return
138fi     
139       
140
141# Error si no se reciben al menos 1 parámetros.
142[ $# == 2 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)   
143
144
145cat >> $TEMPhive << EOF
146h 2
147cd \Microsoft\Windows\CurrentVersion\Run
148nv 1 $2
149ed $2
150$1
151EOF
152#ogGetRegistryValue /mnt/sda1 software '\Microsoft\Windows\CurrentVersion\Run\og3'
153}
154
155function ogNTPolUserOn () {
156
157# Si se solicita, mostrar ayuda.
158if [ "$*" == "help" ]; then
159    ogHelp "$FUNCNAME" "$FUNCNAME id_hive_user " \
160           "$FUNCNAME NombreUsuario"\
161           "$FUNCNAME "
162    return
163fi             
164
165# TODO: error si no se ha llamado previamente a ogLoadHiveWindows
166[ -n $hiveSAM ] || return $(ogRaiseError $OG_ERR_FORMAT "se debe utilizar primero la utilidad ogLoadHiveWindows"; echo $?)
167
168# TODO: error si el usuario no tiene cuenta en windows.
169drbl-chntpw -l $hiveSAM | grep RID | grep -w $1 || return $(ogRaiseError $OG_ERR_FORMAT "el usuario $1 no tiene cuenta en este windows: Compruebe mayusculas o minusculas"; echo $?)
170
171# TODO: error si no el usario no no tiene HIVE asociado.
172[ -n "${!1}" ] || return $(ogRaiseError $OG_ERR_FORMAT "el usuario no tiene hive creado"; echo $?)
173
174
175HIVEID=$(echo ${!1} | tr -d "hiveUSER")
176
177
178#echo "IMPORTANTE:  la variable HiveUser3=/mnt/windows/Document/\ and/\ Seeting\alumnmos\NTUSER.dat"
179echo $HIVEID
180#cp /var/EAC/admin/utilswin/Fondo.BMP ${particion}/WINDOWS/
181
182cat >> $TEMPhive << EOF
183h $HIVEID
184cd \Control Panel\Desktop
185ed Wallpaper
186C:\\WINDOWS\\fondo.bmp
187
188cd \Software\Microsoft\Windows\CurrentVersion\Policies
189nk Explorer
190cd Explorer
191
192nv 4 NoDesktop
193ed NoDesktop
1941
195
196nv 4 NoSimpleStartMenu
197ed NoSimpleStartMenu
1981
199nv 4 NoWindowsUpdate
200ed NoWindowsUpdate
2011
202
203nv 4 NoSMConfigurePrograms
204ed NoSMConfigurePrograms
2051
206
207nv 4 NoChangeStartMenu
208ed NoChangeStartMenu
2091
210
211nv 4 Intellimenus
212ed Intellimenus
2131
214
215nv 4 NoRun
216ed NoRun
2171
218
219nv 4 NoRecentDocsHistory
220ed NoRecentDocsHistory
2211
222EOF
223}
224
225
226
227
228
229##########################################################
230##########################################################
231#####librerias de PostConfiguracion v0.1para Advanced Deploy enViorenment###########
232# Liberado bajo licencia GPL <http://www.gnu.org/licenses/gpl.html>################
233############# 2008 Antonio Jes�s Doblas Viso  adv@uma.es ##########################
234########### Universidad de Malaga (Spain)############################
235##########################################################
236
237
238
239
240
241function NTChangeName () {
242if [ $# = 0 ]
243then
244echo sintaxis: NTChangeNAME str_$var
245echo ejemplos: NTCHangeName adi${IPcuatro}-xp
246fi
247cat >> $temporal << EOF
248h 1
249ed ControlSet001\Control\ComputerName\ComputerName\ComputerName
250$1
251ed ControlSet001\Services\Tcpip\Parameters\Hostname
252$1
253ed ControlSet001\Services\Tcpip\Parameters\NV Hostname
254$1
255h 2
256cd \Microsoft\Windows NT\CurrentVersion\Winlogon
257ed DefaultDomainName
258$1
259EOF
260}
261
262
263
264function NTSetGroupName () {
265if [ $# = 0 ]
266then
267echo sintaxis: NTSetGroupName str_$var
268echo ejemplos: NTSetGroupName adi
269fi
270cat >> $temporal << EOF
271h 2
272ed \Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName
273$1
274EOF
275}
276
277
278function NTSetOwner (){
279if [ $# = 0 ]
280then
281echo sintaxis: NtSetOwner str_propietario str_organizacion
282echo ejemplos: NTSetOwner eu\ politecnica universidad\ de\ malaga
283fi
284cat >> $temporal << EOF
285h 2
286ed \Microsoft\Windows NT\CurrentVersion\RegisteredOwner
287$1
288ed \Microsoft\Windows NT\CurrentVersion\RegisteredOrganization
289$2
290EOF
291}
292
293
294function NTAutoLogon (){
295if [ $# = 0 ]
296then
297echo sintaxis: Int_Activar Int_nves str_usuario str_passwd str_equipo
298echo ejemplos: 1 2 administrador 3451 $equipo
299echo IMPORTANTE: cuando AutoLogonCount llegue a 0, activa el AutoAdminLogon a 0. Pero no borra los valores de DefaultPassword
300return 2
301fi
302#echo la pass es $4
303export temporal=/tmp/tmpregistry
304cat >> $temporal << EOF
305hive 2
306cd \Microsoft\Windows NT\CurrentVersion\Winlogon
307nv 1 AutoAdminLogon
308ed AutoAdminLogon
309$1
310nv 1 AutoLogonCount
311ed AutoLogonCount
312$2
313nv 1 DefaultUserName
314ed DefaultUserName
315$3
316nv 1 DefaultDomainName
317ed DefaultDomainName
318$5
319EOF
320if [ "$4" == none ]
321then
322echo "debe aparecer done" $4
323cat >> $temporal << EOF
324dv DefaultPassword
325
326
327EOF
328else
329cat >> $temporal << EOF
330nv 1 DefaultPassword
331ed DefaultPassword
332$4
333EOF
334fi
335}
336
337function NTStatusRatonTeclado (){
338if [ $# = 0 ]
339then
340echo sintaxis: Int-StatusRaton Int-StatusTeclado
341echo ejemplos:  int=1 activo   int=4 desactivado
342return 2
343fi
344cat >> $temporal << EOF
345hive 1
346cd \ControlSet001\Services\Mouclass
347ed Start
348$1
349cd \ControlSet001\Services\Kbdclass
350ed Start
351$2
352EOF
353}
354
355function NTRunOnceMachine () {
356if [ $# = 0 ]
357then
358echo sintaxis:  PathScripts idScripts
359echo "ejemplo:   c:\\\\WINDOSWS\\\\crearusuarios.bat  scripts1"
360echo "IMPORTANTE: el path debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\"
361return 2
362fi
363export temporal=/tmp/tmpregistry
364cat >> $temporal << EOF
365h 2
366cd \Microsoft\Windows\CurrentVersion\RunOnce
367nv 1 $2
368ed $2
369$1
370EOF
371}
372
373function NTRunMachine () {
374if [ $# = 0 ]
375then
376echo sintaxis:  PathScripts idScripts
377echo ejemplo:   c:\\\\WINDOSWS\\\\crearusuarios.bat  scripts1
378echo IMPORTANTE: el path debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\
379return 2
380fi
381export temporal=/tmp/tmpregistry
382cat >> $temporal << EOF
383h 2
384cd \Microsoft\Windows\CurrentVersion\Run
385nv 1 $2
386ed $2
387$1
388EOF
389}
390
391function NTRunUser () {
392if [ $# = 0 ]
393then
394echo sintaxis:  str_PathWINScripts str_idScripts Int_hive||\$usuario
395echo ejemplo:   c:\\\\WINDOSWS\\\\crearusuarios.bat  scripts1 3
396echo IMPORTANTE: el pathWIN debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\
397echo IMPORTANTE: el pathLinux si lleva espacios debe escaparse con una barra \\
398echo IMPORTANTE Int_hive: 3 para el primer usuario, 4 para el segundo usuario
399echo requiere export un HiveUser3=/mnt/windows/Document\ and\ Seeting\alumnmos\NTUSER.dat
400return 2
401fi
402cat >> $temporal << EOF
403h $3
404cd \Software\Microsoft\Windows\CurrentVersion\Run
405nv 1 $2
406ed $2
407$1
408EOF
409}
410
411
412
413function NTPolUserOn () {
414if [ $# = 0 ]
415then
416Msg "requiere LoadRegistryUser str_user1 str_user2..." orange
417echo "sintaxis:  Int_hive"
418echo "ejemplo: NTPolUserOn 3"
419echo "IMPORTANTE:  la variable HiveUser3=/mnt/windows/Document/\ and/\ Seeting\alumnmos\NTUSER.dat"
420return 2
421fi
422cp /var/EAC/admin/utilswin/Fondo.BMP ${particion}/WINDOWS/
423cat >> $temporal << EOF
424h $1
425cd \Control Panel\Desktop
426ed Wallpaper
427C:\\WINDOWS\\fondo.bmp
428
429cd \Software\Microsoft\Windows\CurrentVersion\Policies
430nk Explorer
431cd Explorer
432
433nv 4 NoDesktop
434ed NoDesktop
4351
436
437nv 4 NoSimpleStartMenu
438ed NoSimpleStartMenu
4391
440nv 4 NoWindowsUpdate
441ed NoWindowsUpdate
4421
443
444nv 4 NoSMConfigurePrograms
445ed NoSMConfigurePrograms
4461
447
448nv 4 NoChangeStartMenu
449ed NoChangeStartMenu
4501
451
452nv 4 Intellimenus
453ed Intellimenus
4541
455
456nv 4 NoRun
457ed NoRun
4581
459
460nv 4 NoRecentDocsHistory
461ed NoRecentDocsHistory
4621
463EOF
464}
465
466function NTPolUserOFF () {
467if [ $# = 0 ]
468then
469Msg "requiere LoadRegistryUser str_user1 str_user2..." orange
470echo "sintaxis:  Int_hive"
471echo "ejemplo: NTPolUserOFF 3"
472echo "IMPORTANTE:  la variable HiveUser3=/mnt/windows/Document/\ and/\ Seeting\alumnmos\NTUSER.dat"
473return 2
474fi
475cat >> $temporal << EOF
476h $1
477cd \Control Panel\Desktop
478ed Wallpaper
479C:\\WINDOWS\\web\\wallpaper\\Felicidad.bmp
480
481cd \Software\Microsoft\Windows\CurrentVersion\
482rdel Policies
483nk Policies
4841
485EOF
486}
487
488
489function ogSetWindowsChkdisk() {
490if [ $# = 0 ]
491then
492echo sintaxis: true|TRUE|0 false|false|1
493echo ejemplos:  int=0 desactivado int=1 activado
494return 2
495fi
496case $1 in
497        0|true|TRUE)
498                valor="autocheck autochk *";;
499        1|false|FALSE)         
500                valor="none";;
501        *)
502                return 0 ;;
503esac
504
505cat >> $TEMPhive << EOF
506hive 1
507cd \ControlSet001\Control\Session Manager
508ed BootExecute
509$valor
510--n
511EOF
512}
513
514
515
516### FASE DE PRUEBAS  NO FUNCIONA
517function NTStartRecovery () {
518if [ $# = 0 ]
519then
520        echo sintaxis: Int-Status
521        echo ejemplos:  int=0 desactivado int=1 activado
522        return 2
523fi
524
525[ $1 = 0 ] && valor="none"
526[ $1 = 1 ] && valor="00000000"
527
528
529cat >> $TEMPhive << EOF
530hive 2
531#cd \Policies\Microsoft\Windows\WinRE
532#ed DisableSetup
533cd \Policies\Microsoft\Windows
534nk WinRE
535nv 4 DisableSetup
536ed DisableSetup
537$valor
538--n
539EOF
540
541
542#Activado
543#[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRE]
544#"DisableSetup"=-
545
546# Desactivado
547#[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRE]
548#"DisableSetup"=dword:00000000
549
550
551}
552
553
554function ogSchrootLinux () {
555
556# Variables locales.
557local PART DISK DIRCONF SCHROOTDEVICE
558
559# Si se solicita, mostrar ayuda.
560if [ "$*" == "help" ]; then
561    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_partition" \
562           "$FUNCNAME 1 1 "
563    return
564fi     
565
566# Error si no se reciben 2 parámetros.
567[ $# == 2 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
568
569DISK=$1; PART=$2; DIRCONF="/etc/schroot"
570
571
572VERSION=$(ogGetOsVersion $DISK $PART)
573echo $VERSION | grep "Linux" || return $(ogRaiseError $OG_ERR_NOTOS "no es linux"; echo $?)
574
575ogUnmount $DISK $PART || return $(ogRaiseError $OG_ERR_NOTOS "no es linux"; echo $?)
576
577SCHROOTDEVICE=$(ogDiskToDev $DISK $PART)
578
579
580rm ${DIRCONF}/mount-defaults
581rm ${DIRCONF}/schroot.conf
582
583cat >> ${DIRCONF}/mount-defaults << EOF
584# <file system> <mount point>   <type>  <options>       <dump>  <pass>
585proc            /proc           proc    defaults        0       0
586/dev            /dev            none    rw,bind         0       0
587/dev/pts        /dev/pts        none    rw,bind         0       0
588/dev/shm        /dev/shm        none    rw,bind         0       0
589EOF
590
591
592cat >> ${DIRCONF}/schroot.conf << EOF
593[linux]
594description=$VERSION
595type=block-device
596device=$SCHROOTDEVICE
597EOF
598
599
600
601
602schroot -c linux
603
604schroot -end-sessiona --all-sessions
605}
606
607
608#/**  @function ogDiskToRelativeDev: @brief Traduce los ID de discos o particiones EAC a ID Linux relativos, es decir 1 1 => sda1
609#@param  Admite 1 parametro:   $1  int_numdisk
610#@param  Admite 2 parametro:   $1   int_numdisk                    $2  int_partition
611#@return  Para 1 parametros traduce Discos Duros: Devuelve la ruta relativa linux del disco duro indicado con nomenclatura EAC.........ejemplo: IdPartition 1 => sda
612#@return  Para 2 parametros traduce Particiones: Devuelve la ruta relativa linux de la particion indicado con nomenclatura EAC...........  ejemplo: IdPartition  2 1 => sdb1
613#@warning  No definidas
614#@attention
615#@note    Notas sin especificar
616#@version 0.1 -  Integracion para Opengnsys  -  EAC:  IdPartition en ATA.lib
617#@author  Antonio J. Doblas Viso. Universidad de Malaga
618#@date    27/10/2008
619#*/
620function ogDiskToRelativeDev () {
621if [ $# = 0 ]
622then
623        Msg "Info: Traduce el identificador del dispositivo EAC a dispositivo linux \n" info
624        Msg "Sintaxis1: IdPartition int_disk -----------------Ejemplo1: IdPartition 1 -> sda " example
625        Msg "Sintaxis2: IdPartition int_disk int_partition  --Ejemplo2: IdPartition 1 2 -> sda2 " example
626
627return
628fi
629#PART="$(Disk|cut -f$1 -d' ')$2"    # se comenta esta linea porque doxygen no reconoce la funcion disk y no crea los enlaces y referencias correctas.
630PART=$(ogDiskToDev|cut -f$1 -d' ')$2
631echo $PART | cut -f3 -d \/
632}
633
634
635#/**  @function ogDeletePartitionsLabels: @brief Elimina la informacion que tiene el kernel del cliente og sobre los labels de los sistemas de archivos
636#@param  No requiere
637#@return   Nada
638#@warning
639#@attention Requisitos:  comando interno linux rm
640#@note
641#@version 0.1 -  Integracion para Opengnsys  -  EAC:   DeletePartitionTable()  en ATA.lib
642#@author  Antonio J. Doblas Viso. Universidad de Malaga
643#@date    27/10/2008
644#*/
645function ogDeletePartitionsLabels () {
646# Si se solicita, mostrar ayuda.
647if [ "$*" == "help" ]; then
648    ogHelp "$FUNCNAME" "$FUNCNAME " \
649           "$FUNCNAME "
650    return
651fi
652
653rm /dev/disk/by-label/*    # */ COMENTARIO OBLIGATORIO PARA DOXYGEN
654}
655
656
657#/**  @function ogInfoCache: @brief muestra la informacion de la CACHE.
658#@param  sin parametros
659#@return  texto que se almacena en $IP.-InfoCache.  punto_montaje, tama?oTotal, TamanioOcupado, TaminioLibre, imagenes dentro de la cahce
660#@warning  Salidas de errores no determinada
661#@warning   printf no soportado por busybox
662#@attention
663#@version 0.1   Date: 27/10/2008 Author Antonio J. Doblas Viso. Universidad de Malaga
664#*/
665function ogInfoCache ()
666{
667local info infoFilesystem infoSize infoUsed infoUsedPorcet infoMountedOn content
668if ogMountCache
669then
670        info=`df -h | grep $OGCAC`
671        infoFilesystem=`echo $info | cut -f1 -d" "`
672        infoSize=`echo $info | cut -f2 -d" "`
673        infoUsed=`echo $info | cut -f3 -d" "`
674        infoAvail=`echo $info | cut -f4 -d" "`
675        infoUsedPorcet=`echo $info | cut -f5 -d" "`
676        infoMountedOn=`echo $info | cut -f2 -d" "`
677        if `ls  ${OGCAC}$OGIMG > /dev/null 2>&1`
678        then
679               cd ${OGCAC}${OPENGNSYS}
680                #content=`find images/ -type f -printf "%h/  %f  %s \n"`   busybox no soporta printf
681                content=`find images/ -type f`
682                cd /
683                echo $info
684                echo -ne $content
685                echo " "
686                #echo "$info" > ${OGLOG}/${IP}-InfoCache
687                #echo "$content" >> {$OGLOG}/${IP}-InfoCache
688        else
689                echo $info
690                #echo "$info" > {$OGLOG}/${IP}-InfoCache
691        fi
692        ogUnmountCache
693else
694        echo " "
695        #echo " " > {$OGLOG}/${IP}-InfoCache
696
697fi
698}
699
Note: See TracBrowser for help on using the repository browser.