diff options
author | albertogp <albertogp@uma.es> | 2021-04-27 21:37:56 +0200 |
---|---|---|
committer | albertogp <albertogp@uma.es> | 2021-05-04 13:07:50 +0200 |
commit | 00cf45421042d623dc0602b82f925823abaddcd5 (patch) | |
tree | 62056e685dd45858a9fde1b677336ce6c46ae6c1 | |
parent | 56c079ad5c48e367f8c37d901de72c1e38f5a104 (diff) |
"#ID-1037 Preparando todos los ficheros para versión 1.2.1"
-rw-r--r-- | admin/Database/ogAdmBD-1.0.6b-1.1.0a.sql | 1 | ||||
-rw-r--r-- | admin/Database/ogAdmBD-1.1.0a-1.1.1c.sql | 7 | ||||
-rw-r--r-- | admin/Database/ogAdmBD-1.1.0pre-1.1.0a.sql | 14 | ||||
-rw-r--r-- | admin/Database/ogAdmBD-1.1.1c-1.2.0.sql | 7 | ||||
-rw-r--r-- | admin/Database/ogAdmBD.sql | 1 | ||||
-rwxr-xr-x | admin/Interface/getConfiguration | 16 | ||||
-rw-r--r-- | admin/WebConsole/includes/pintaParticiones.php | 78 | ||||
-rw-r--r-- | admin/WebConsole/varios/menucliente.php | 29 | ||||
-rwxr-xr-x | client/shared/scripts/generateMenuDefault | 3 |
9 files changed, 148 insertions, 8 deletions
diff --git a/admin/Database/ogAdmBD-1.0.6b-1.1.0a.sql b/admin/Database/ogAdmBD-1.0.6b-1.1.0a.sql index 8db4d183..6b59f300 100644 --- a/admin/Database/ogAdmBD-1.0.6b-1.1.0a.sql +++ b/admin/Database/ogAdmBD-1.0.6b-1.1.0a.sql @@ -70,6 +70,7 @@ INSERT INTO usuarios (idusuario, pasguor) # evitar errores "TEXT NOT NULL" y "NO_ZERO_DATE" (ticket #730). ALTER TABLE ordenadores_particiones MODIFY cache TEXT, + ADD tdisk VARCHAR(4) DEFAULT NULL, ADD revision SMALLINT UNSIGNED NOT NULL DEFAULT 0 AFTER idimagen, ADD uso TINYINT NOT NULL DEFAULT 0; ALTER TABLE acciones diff --git a/admin/Database/ogAdmBD-1.1.0a-1.1.1c.sql b/admin/Database/ogAdmBD-1.1.0a-1.1.1c.sql index ba206053..f0d5c1f6 100644 --- a/admin/Database/ogAdmBD-1.1.0a-1.1.1c.sql +++ b/admin/Database/ogAdmBD-1.1.0a-1.1.1c.sql @@ -22,6 +22,13 @@ CREATE PROCEDURE addcols() BEGIN DROP passguor, DROP puertorepo; END IF; + # Add tipodisco (ticket #1037). + IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS + WHERE COLUMN_NAME='tdisk' AND TABLE_NAME='ordenadores_particiones' AND TABLE_SCHEMA=DATABASE()) + THEN + ALTER TABLE ordenadores_particiones + ADD tdisk VARCHAR(4) DEFAULT NULL AFTER idordenador; + END IF; END// # Ejecutar actualización condicional. DELIMITER ';' diff --git a/admin/Database/ogAdmBD-1.1.0pre-1.1.0a.sql b/admin/Database/ogAdmBD-1.1.0pre-1.1.0a.sql index 131e7ba7..8992109c 100644 --- a/admin/Database/ogAdmBD-1.1.0pre-1.1.0a.sql +++ b/admin/Database/ogAdmBD-1.1.0pre-1.1.0a.sql @@ -42,6 +42,13 @@ CREATE PROCEDURE addcols() BEGIN ALTER TABLE ordenadores_particiones ADD uso TINYINT NOT NULL DEFAULT 0; END IF; + # Add tipodisco (ticket #1037). + IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS + WHERE COLUMN_NAME='tdisk' AND TABLE_NAME='ordenadores_particiones' AND TABLE_SCHEMA=DATABASE()) + THEN + ALTER TABLE ordenadores_particiones + ADD tdisk VARCHAR(4) DEFAULT NULL AFTER idordenador; + END IF; # Añadir nº de serie (ticket #713) IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS WHERE COLUMN_NAME='numserie' AND TABLE_NAME='ordenadores' AND TABLE_SCHEMA=DATABASE()) @@ -125,6 +132,13 @@ CREATE PROCEDURE addcols() BEGIN ALTER TABLE ordenadores_particiones ADD revision SMALLINT UNSIGNED NOT NULL DEFAULT 0 AFTER idimagen; END IF; + # Add tipodisco (ticket #1037). + IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS + WHERE COLUMN_NAME='tdisk' AND TABLE_NAME='ordenadores_particiones' AND TABLE_SCHEMA=DATABASE()) + THEN + ALTER TABLE ordenadores_particiones + ADD tdisk VARCHAR(4) DEFAULT NULL AFTER idordenador; + END IF; # Incluir campo sistema operativo en el perfil de software (tickets #738 #713) IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS WHERE COLUMN_NAME='idnombreso' AND TABLE_NAME='perfilessoft' AND TABLE_SCHEMA=DATABASE()) diff --git a/admin/Database/ogAdmBD-1.1.1c-1.2.0.sql b/admin/Database/ogAdmBD-1.1.1c-1.2.0.sql index e281ae4e..ab1a9c20 100644 --- a/admin/Database/ogAdmBD-1.1.1c-1.2.0.sql +++ b/admin/Database/ogAdmBD-1.1.1c-1.2.0.sql @@ -46,6 +46,13 @@ CREATE PROCEDURE altercols() BEGIN ADD filesystem varchar(100) NOT NULL DEFAULT '', ADD datasize bigint NOT NULL DEFAULT 0; END IF; + # Add tipodisco (ticket #1037). + IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS + WHERE COLUMN_NAME='tdisk' AND TABLE_NAME='ordenadores_particiones' AND TABLE_SCHEMA=DATABASE()) + THEN + ALTER TABLE ordenadores_particiones + ADD tdisk VARCHAR(4) DEFAULT NULL AFTER idordenador; + END IF; END// # Run conditional update. DELIMITER ';' diff --git a/admin/Database/ogAdmBD.sql b/admin/Database/ogAdmBD.sql index 07080a1c..931fc220 100644 --- a/admin/Database/ogAdmBD.sql +++ b/admin/Database/ogAdmBD.sql @@ -557,6 +557,7 @@ CREATE TABLE `ordenadores` ( DROP TABLE IF EXISTS `ordenadores_particiones`; CREATE TABLE `ordenadores_particiones` ( `idordenador` int(11) NOT NULL DEFAULT '0', + `tdisk` varchar(4) DEFAULT NULL, `numdisk` smallint NOT NULL DEFAULT '0', `numpar` smallint NOT NULL DEFAULT '0', `codpar` int(8) NOT NULL DEFAULT '0', diff --git a/admin/Interface/getConfiguration b/admin/Interface/getConfiguration index ddfc3821..b58dcbd6 100755 --- a/admin/Interface/getConfiguration +++ b/admin/Interface/getConfiguration @@ -12,6 +12,9 @@ export DEBUG="no" ser=$(ogGetSerialNumber) cfg="" +#AGP ----- +cfgd="" +#AGP ----- disks=$(ogDiskToDev | wc -w) for ((dsk=1; dsk<=$disks; dsk++)); do particiones=$(ogGetPartitionsNumber $dsk) @@ -25,6 +28,11 @@ for ((dsk=1; dsk<=$disks; dsk++)); do ZPOOL) ptt=4 ;; *) ptt=0 ;; esac + #AGP ----------------------------------------------------------------------- + # Información Tipo de Disco DISK o NVM + tdisk=$(ogDiskToDev $dsk) + cfgd="$cfgd$dsk:0:$ptt:::$(ogGetDiskSize $dsk):0:$(ogGetDiskType $tdisk);" + #AGP ----------------------------------------------------------------------- # Información de disco (partición 0) cfg="$cfg$dsk:0:$ptt:::$(ogGetDiskSize $dsk):0;" for ((par=1;par<=$particiones;par++)); do @@ -64,6 +72,11 @@ done # Guardar salida en fichero temporal. cfgfile=/tmp/getconfig echo "${ser:+$ser;}$cfg" > $cfgfile +#AGP ---------------------------------- +# Guardar salida en fichero temporal. +cfgfiled=/tmp/getconfigd +echo "${ser:+$ser;}$cfgd" > $cfgfiled +#AGP ---------------------------------- # Crear el menú por defecto a partir del fichero generado (no dar ninguna salida). generateMenuDefault &>/dev/null @@ -84,5 +97,4 @@ awk '{ n=split($0,sep,";"); rm -f /mnt/*/ogboot.* /mnt/*/*/ogboot.* # Volver a registrar los errores. -unset DEBUG - +unset DEBUG
\ No newline at end of file diff --git a/admin/WebConsole/includes/pintaParticiones.php b/admin/WebConsole/includes/pintaParticiones.php index 02c0f570..d3ad98bb 100644 --- a/admin/WebConsole/includes/pintaParticiones.php +++ b/admin/WebConsole/includes/pintaParticiones.php @@ -66,11 +66,31 @@ function pintaParticiones($cmd,$configuraciones,$idordenadores,$cc) $aviso=""; foreach($diskConfigs as $disk => $diskConfig){ $disk = (int)$disk; - echo'<tr height="16">'.chr(13); - echo '<td colspan="'.$columns.'" style="BORDER-TOP: #999999 1px solid;BACKGROUND-COLOR: #D4D0C8;"> '.$TbMsg["DISK"].' '.$disk.'</td>'.chr(13); - +// agp ============================================================================= + // Actualizamos la base de datos en el campo + $cmd->texto="SELECT tdisk + FROM ordenadores_particiones + WHERE idordenador='$idordenadores' + AND numdisk='$disk' + AND numpar=0"; - + $rs=new Recordset; + $rs->Comando=&$cmd; + if (!$rs->Abrir()) return; // Error al abrir recordset + $rs->Primero(); + while (!$rs->EOF){ + $tipodisk = $rs->campos["tdisk"]; + $rs->Siguiente(); + } +// agp ============================================================================= + echo'<tr height="16">'.chr(13); +// agp ============================================================================= + if ($tipodisk=="NVM"){ + echo '<td colspan="'.$columns.'" style="BORDER-TOP: #999999 1px solid;BACKGROUND-COLOR: #D4D0C8;"> '.$TbMsg["DISK"].' '.$disk.' - <span style="color: red"><strong>( '.$tipodisk.'e )</span></td>'.chr(13); + }else{ + echo '<td colspan="'.$columns.'" style="BORDER-TOP: #999999 1px solid;BACKGROUND-COLOR: #D4D0C8;"> '.$TbMsg["DISK"].' '.$disk.' - <span><strong>( '.$tipodisk.' )</span></td>'.chr(13); + } +// agp ============================================================================= $auxCfg=explode("@",$diskConfig); // Crea lista de particiones for($i=0;$i<sizeof($auxCfg);$i++){ $auxKey=explode(";",$auxCfg[$i]); // Toma clave de configuracion @@ -240,8 +260,31 @@ function pintaParticionesRestaurarImagen($cmd,$configuraciones,$idordenadores,$c foreach($diskConfigs as $disk => $diskConfig){ $disk = (int)$disk; +// agp ============================================================================= + // Actualizamos la base de datos en el campo + $cmd->texto="SELECT tdisk + FROM ordenadores_particiones + WHERE idordenador='$idordenadores' + AND numdisk='$disk' + AND numpar=0"; + + $rs=new Recordset; + $rs->Comando=&$cmd; + if (!$rs->Abrir()) return; // Error al abrir recordset + $rs->Primero(); + while (!$rs->EOF){ + $tipodisk = $rs->campos["tdisk"]; + $rs->Siguiente(); + } +// agp ============================================================================= echo'<tr height="16">'.chr(13); - echo '<td colspan="'.$columns.'" style="BORDER-TOP: #999999 1px solid;BACKGROUND-COLOR: #D4D0C8;"> '.$TbMsg["DISK"].' '.$disk.'</td>'.chr(13); +// agp ============================================================================= + if ($tipodisk=="NVM"){ + echo '<td colspan="'.$columns.'" style="BORDER-TOP: #999999 1px solid;BACKGROUND-COLOR: #D4D0C8;"> '.$TbMsg["DISK"].' '.$disk.' - <span style="color: red"><strong>( '.$tipodisk.'e )</span></td>'.chr(13); + }else{ + echo '<td colspan="'.$columns.'" style="BORDER-TOP: #999999 1px solid;BACKGROUND-COLOR: #D4D0C8;"> '.$TbMsg["DISK"].' '.$disk.' - <span><strong>( '.$tipodisk.' )</span></td>'.chr(13); + } +// agp ============================================================================= $auxCfg=explode("@",$diskConfig); // Crea lista de particiones for($i=0;$i<sizeof($auxCfg);$i++){ @@ -439,8 +482,31 @@ function pintaParticionesRestaurarImagenSincronizacion1($cmd,$configuraciones,$i foreach($diskConfigs as $disk => $diskConfig){ $disk = (int)$disk; +// agp ============================================================================= + // Actualizamos la base de datos en el campo + $cmd->texto="SELECT tdisk + FROM ordenadores_particiones + WHERE idordenador='$idordenadores' + AND numdisk='$disk' + AND numpar=0"; + + $rs=new Recordset; + $rs->Comando=&$cmd; + if (!$rs->Abrir()) return; // Error al abrir recordset + $rs->Primero(); + while (!$rs->EOF){ + $tipodisk = $rs->campos["tdisk"]; + $rs->Siguiente(); + } +// agp ============================================================================= echo'<tr height="16">'.chr(13); - echo '<td colspan="'.$columns.'" style="BORDER-TOP: #999999 1px solid;BACKGROUND-COLOR: #D4D0C8;"> '.$TbMsg["DISK"].' '.$disk.'</td>'.chr(13); +// agp ============================================================================= + if ($tipodisk=="NVM"){ + echo '<td colspan="'.$columns.'" style="BORDER-TOP: #999999 1px solid;BACKGROUND-COLOR: #D4D0C8;"> '.$TbMsg["DISK"].' '.$disk.' - <span style="color: red"><strong>( '.$tipodisk.'e )</span></td>'.chr(13); + }else{ + echo '<td colspan="'.$columns.'" style="BORDER-TOP: #999999 1px solid;BACKGROUND-COLOR: #D4D0C8;"> '.$TbMsg["DISK"].' '.$disk.' - <span><strong>( '.$tipodisk.' )</span></td>'.chr(13); + } +// agp ============================================================================= $auxCfg=explode("@",$diskConfig); // Crea lista de particiones for($i=0;$i<sizeof($auxCfg);$i++){ diff --git a/admin/WebConsole/varios/menucliente.php b/admin/WebConsole/varios/menucliente.php index b1c07c94..9c6d8cd1 100644 --- a/admin/WebConsole/varios/menucliente.php +++ b/admin/WebConsole/varios/menucliente.php @@ -47,6 +47,35 @@ else{ $UrlPaginaIconos=dirname($UrlPagina)."/images/iconos"; $codeHtml=""; //________________________________________________________________________________________________________ + //agp Tomamos el tipo de disco DISK o NVM +//________________________________________________________________________________________________________ + // Leemos el fichero que contiene la información de discos + $nom_fich = "/opt/opengnsys/log/clients/".$iph.".tdisk.txt"; + $cont_fich = file_get_contents($nom_fich);//echo $cont_fich; + // quitamos 2 ultimos caracteres (espacio y ;) + $cont_fich = substr($cont_fich, 0, -2); + $disk_l=explode(";",$cont_fich); + + for($i=0;$i<count($disk_l);$i++){ + // Obtenemos los 3 primeros caracteres del disco + $dcar=substr($disk_l[$i], 0, 3); + // Comprobamos si los 2 primeros caracteres son DISCOS ejemp: 1:0 , 2:0 , 3:0 + if ( $dcar == $i.":0"){ + // Obtenemos el último campo DISK - NVM + $disko_enc = explode(":",$disk_l[$i]); + $NUMDISK=$dcar2[0]; + $TIPODISK=$disko_enc[7]; + // Actualizamos la base de datos en el campo + $cmd->texto="UPDATE ordenadores_particiones + SET tdisk='".$TIPODISK."' + WHERE idordenador=(SELECT idordenador + FROM ordenadores + WHERE ip='".$iph."') + AND numdisk='".$NUMDISK."'"; + $resul=$cmd->Ejecutar(); + } + } +//________________________________________________________________________________________________________ //agp $nombre_archivo = "/opt/opengnsys/log/clients/".$iph.".cache.txt"; $contenidofichero = file_get_contents($nombre_archivo); diff --git a/client/shared/scripts/generateMenuDefault b/client/shared/scripts/generateMenuDefault index 09e4300f..dd4388df 100755 --- a/client/shared/scripts/generateMenuDefault +++ b/client/shared/scripts/generateMenuDefault @@ -8,8 +8,11 @@ DEVICE=${DEVICE:-"eth0"} source /tmp/net-$DEVICE.conf FILEINFOHTML=$OGLOG/`ogGetIpAddress`.info.html FILEINFOCACHE=$OGLOG/`ogGetIpAddress`.cache.txt +FILETIPODISK=$OGLOG/`ogGetIpAddress`.tdisk.txt ogMountCache 2>/dev/null CACHECONTENIDO="ls -m $OGCAC/$OGIMG 2>/dev/null" +TIPODISK=`cat /tmp/getconfigd` +echo $TIPODISK > $FILETIPODISK SPEED=$(LANG=C ethtool $DEVICE 2>/dev/null | awk '$1~/Speed/ {print $2}') case "${SPEED,,}" in |