From 00cf45421042d623dc0602b82f925823abaddcd5 Mon Sep 17 00:00:00 2001 From: albertogp Date: Tue, 27 Apr 2021 21:37:56 +0200 Subject: "#ID-1037 Preparando todos los ficheros para versión 1.2.1" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/Database/ogAdmBD-1.0.6b-1.1.0a.sql | 1 + admin/Database/ogAdmBD-1.1.0a-1.1.1c.sql | 7 +++ admin/Database/ogAdmBD-1.1.0pre-1.1.0a.sql | 14 +++++ admin/Database/ogAdmBD-1.1.1c-1.2.0.sql | 7 +++ admin/Database/ogAdmBD.sql | 1 + admin/Interface/getConfiguration | 16 +++++- admin/WebConsole/includes/pintaParticiones.php | 78 ++++++++++++++++++++++++-- admin/WebConsole/varios/menucliente.php | 29 ++++++++++ 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''.chr(13); - echo ' '.$TbMsg["DISK"].' '.$disk.''.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''.chr(13); +// agp ============================================================================= + if ($tipodisk=="NVM"){ + echo ' '.$TbMsg["DISK"].' '.$disk.' - ( '.$tipodisk.'e )'.chr(13); + }else{ + echo ' '.$TbMsg["DISK"].' '.$disk.' - ( '.$tipodisk.' )'.chr(13); + } +// agp ============================================================================= $auxCfg=explode("@",$diskConfig); // Crea lista de particiones for($i=0;$i $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''.chr(13); - echo ' '.$TbMsg["DISK"].' '.$disk.''.chr(13); +// agp ============================================================================= + if ($tipodisk=="NVM"){ + echo ' '.$TbMsg["DISK"].' '.$disk.' - ( '.$tipodisk.'e )'.chr(13); + }else{ + echo ' '.$TbMsg["DISK"].' '.$disk.' - ( '.$tipodisk.' )'.chr(13); + } +// agp ============================================================================= $auxCfg=explode("@",$diskConfig); // Crea lista de particiones for($i=0;$i $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''.chr(13); - echo ' '.$TbMsg["DISK"].' '.$disk.''.chr(13); +// agp ============================================================================= + if ($tipodisk=="NVM"){ + echo ' '.$TbMsg["DISK"].' '.$disk.' - ( '.$tipodisk.'e )'.chr(13); + }else{ + echo ' '.$TbMsg["DISK"].' '.$disk.' - ( '.$tipodisk.' )'.chr(13); + } +// agp ============================================================================= $auxCfg=explode("@",$diskConfig); // Crea lista de particiones for($i=0;$itexto="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 -- cgit v1.2.3-18-g5258