diff options
31 files changed, 635 insertions, 93 deletions
diff --git a/admin/WebConsole/gestores/gestor_aulas.php b/admin/WebConsole/gestores/gestor_aulas.php index e947edb2..ea194275 100644 --- a/admin/WebConsole/gestores/gestor_aulas.php +++ b/admin/WebConsole/gestores/gestor_aulas.php @@ -37,8 +37,14 @@ $horaresevini=0; $horaresevfin=0; $idmenu=0; $idproautoexec=0; +######################## AGP $idrepositorio=0; -### AGP +$diskremotepc=0; +$partremotepc=0; +$imaremotepc=0; +$idimaremotepc=0; +$idperfilsoftimaremotepc=0; +######################## AGP $oglive="ogLive"; $idperfilhard=0; $modomul=0; @@ -127,8 +133,48 @@ if ($cmd){ $resul=Gestiona(); $cmd->Conexion->Cerrar(); } -// ************************************************************************************************************************************************* -?> +//________________________________________________________________________________________________________ +### AGP remotePC ###################################################################################### +if (isset($_POST["diskremotepc"])) $diskremotepc=$_POST["diskremotepc"]; +if (isset($_POST["partremotepc"])) $partremotepc=$_POST["partremotepc"]; +if (isset($_POST["imaremotepc"])) $imaremotepc=$_POST["imaremotepc"]; +$imaremoPC=explode("_",$imaremotepc); +$idimaremotepc=$imaremoPC[2]; +$idperfilsoftimaremotepc=$imaremoPC[3]; + +### AGP remotePC ###################################################################################### +///* +$cmd=CreaComando($cadenaconexion); // Crea objeto comando +$rs=new Recordset; +$cmd->texto="SELECT idordenador FROM ordenadores WHERE idaula=".$idaula; +$rs->Comando=&$cmd; +if (!$rs->Abrir()) return(true); // Error al abrir recordset +$rs->Primero(); +while (!$rs->EOF){ + $idordremotepc=$rs->campos["idordenador"]; + RecorreOrdenadoresremotePC($cmd,$idordremotepc); + $rs->Siguiente(); +} +$rs->Cerrar(); +//*/ +//________________________________________________________________________________________________________ +### AGP remotePC ###################################################################################### +/*________________________________________________________________________________________________________ + Crea un arbol XML para el nuevo nodo insertado +________________________________________________________________________________________________________*/ +function SubarbolXML_aulas($idaula,$nombreaula){ + global $LITAMBITO_AULAS; + $cadenaXML='<AULAS '; + // Atributos + $cadenaXML.=' clickcontextualnodo="menu_contextual(this,' ."'flo_".$LITAMBITO_AULAS."'" .')"'; + $cadenaXML.=' imagenodo="../images/iconos/aula.gif"'; + $cadenaXML.=' infonodo="'.$nombreaula.'"'; + $cadenaXML.=' nodoid='.$LITAMBITO_AULAS.'-'.$idaula; + $cadenaXML.='>'; + $cadenaXML.='</AULAS>'; + return($cadenaXML); +} +?> <HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> @@ -355,4 +401,54 @@ function SubarbolXML_aulas($idaula,$nombreaula){ $cadenaXML.='</AULAS>'; return($cadenaXML); } -?> +### AGP remotePC ###################################################################################### +///* +//________________________________________________________________________________________________________ +function RecorreOrdenadoresRemotePC($cmd,$idordremotepc){ + global $cmd; + global $idordremotepc; + global $diskremotepc; + global $partremotepc; + global $idimaremotepc; + global $idperfilsoftimaremotepc; + + $cmd->CreaParametro("@idordremotepc",$idordremotepc,1); + $cmd->CreaParametro("@diskremotepc",$diskremotepc,1); + $cmd->CreaParametro("@partremotepc",$partremotepc,1); + $cmd->CreaParametro("@idimaremotepc",$idimaremotepc,1); + $cmd->CreaParametro("@idperfilsoftimaremotepc",$idperfilsoftimaremotepc,1); + + $cmd->texto="SELECT numdisk,numpar FROM ordenadores_particiones + WHERE idordenador=@idordremotepc + AND numdisk=@diskremotepc + AND numpar=@partremotepc"; + $rs=new Recordset; + $rs->Comando=&$cmd; + if (!$rs->Abrir()) return; // Error al abrir recordset + $NumdiskremoPC=$rs->campos["numdisk"]; + // Si los 3 campos tienen datos realizamos cambios + if ( (!empty($diskremotepc)) && (!empty($partremotepc)) && (!empty($idimaremotepc)) ){ + // Si tienen algun disco realizamos operacion + if ( !empty($NumdiskremoPC)){ + // Si tiene algun Disco Actualizamos + $cmd->texto = "UPDATE ordenadores_particiones + SET idimagen=@idimaremotepc, idperfilsoft=@idperfilsoftimaremotepc + WHERE numdisk=@diskremotepc + AND numpar=@partremotepc + AND idordenador=@idordremotepc"; + $resul=$cmd->Ejecutar(); + }else{ + // Si NO tiene ningun Disco Insertamos + $cmd->texto="INSERT INTO ordenadores_particiones (idordenador,numdisk,numpar,idimagen,idperfilsoft) + VALUES ( @idordremotepc, @diskremotepc ,@partremotepc, @idimaremotepc, @idperfilsoftimaremotepc ) "; + $resul=$cmd->Ejecutar(); + } + }else{ + // NO realiza ningun cambio + echo ""; + } + $rs->Cerrar(); +} +### AGP remotePC ###################################################################################### +///* +?>
\ No newline at end of file diff --git a/admin/WebConsole/idiomas/php/cat/avisos_cat.php b/admin/WebConsole/idiomas/php/cat/avisos_cat.php index 65522458..c269bd40 100644 --- a/admin/WebConsole/idiomas/php/cat/avisos_cat.php +++ b/admin/WebConsole/idiomas/php/cat/avisos_cat.php @@ -14,5 +14,5 @@ $TbMsg["WARN_NOTESOFMENU"]='NOTAS: Los menús personalizados tienen mayor $TbMsg["WARN_GPT"]='AVISO: Para tabla de particiones GPT es necesario que la primera partición sea tipo EFI <br>y se recomienda un tamaño en torno a 512Mb.'; $TbMsg["WARN_SCHEDULER"]='AVISO: activar calendario de eventos de la BD para habilitar esta propiedad.'; $TbMsg["WARN_SOURCE_PATH"]='AVISO: La ruta de origen sólo se utiliza en las sincronizadas tipo directorio.'; - +$TbMsg["COMM_REMOTEACCESS_CREATEAULA"]='permitir gestión de acceso remoto a los ordenadores cuando Aula creada'; diff --git a/admin/WebConsole/idiomas/php/cat/estados_cat.php b/admin/WebConsole/idiomas/php/cat/estados_cat.php index dfedfa42..8c3fd1da 100644 --- a/admin/WebConsole/idiomas/php/cat/estados_cat.php +++ b/admin/WebConsole/idiomas/php/cat/estados_cat.php @@ -19,5 +19,5 @@ $TbMsg["STATUS_LNXS"]="Sessió GNU/Linux"; $TbMsg["STATUS_OSX"]="macOS"; $TbMsg["STATUS_WIN"]="Windows"; $TbMsg["STATUS_WINS"]="Sessió Windows"; - - +// Estats WoL +$TbMsg["STATUS_WOL_SENT"]="WoL enviat"; diff --git a/admin/WebConsole/idiomas/php/cat/propiedades_aulas_cat.php b/admin/WebConsole/idiomas/php/cat/propiedades_aulas_cat.php index 02c8a984..94d9a240 100644 --- a/admin/WebConsole/idiomas/php/cat/propiedades_aulas_cat.php +++ b/admin/WebConsole/idiomas/php/cat/propiedades_aulas_cat.php @@ -44,6 +44,7 @@ $TbMsg[32]="Pàgina validació"; // AGP $TbMsg[33]="ogLive"; $TbMsg[34]="*** Existeixen Equips amb diferents ogLive ***"; +$TbMsg[35]="*** A l'Iniciar equips amb ogLive s'actualitza Base Dades ***"; $TbMsg[495]="Data/Caché"; $TbMsg[509]="Foto ordinador"; $TbMsg[5091]="Afegir foto"; diff --git a/admin/WebConsole/idiomas/php/eng/avisos_eng.php b/admin/WebConsole/idiomas/php/eng/avisos_eng.php index 2f0b887d..bd8e7d29 100644 --- a/admin/WebConsole/idiomas/php/eng/avisos_eng.php +++ b/admin/WebConsole/idiomas/php/eng/avisos_eng.php @@ -14,3 +14,4 @@ $TbMsg["WARN_NOTESOFMENU"]='NOTES: Personalized messages have priority over atom $TbMsg["WARN_GPT"]='WARNING: In GPT partitions table first partition must be EFI, and it is recommended it has about 512 MB.'; $TbMsg["WARN_SCHEDULER"]='WARNING: Turn on database event scheduler to enable this property.'; $TbMsg["WARN_SOURCE_PATH"]='WARNING: The source path is only used in directory-type synchronized images.'; +$TbMsg["COMM_REMOTEACCESS_CREATEAULA"]='Allow remote access management to computers when Classroom created'; diff --git a/admin/WebConsole/idiomas/php/eng/estados_eng.php b/admin/WebConsole/idiomas/php/eng/estados_eng.php index c5f2ed7b..85af4c41 100644 --- a/admin/WebConsole/idiomas/php/eng/estados_eng.php +++ b/admin/WebConsole/idiomas/php/eng/estados_eng.php @@ -19,3 +19,5 @@ $TbMsg["STATUS_LNXS"]="GNU/Linux session"; $TbMsg["STATUS_OSX"]="MacOS"; $TbMsg["STATUS_WIN"]="Windows"; $TbMsg["STATUS_WINS"]="Windows session"; +// WoL states +$TbMsg["STATUS_WOL_SENT"]="WoL sent"; diff --git a/admin/WebConsole/idiomas/php/eng/propiedades_aulas_eng.php b/admin/WebConsole/idiomas/php/eng/propiedades_aulas_eng.php index 9191b82d..1b9e3c2b 100644 --- a/admin/WebConsole/idiomas/php/eng/propiedades_aulas_eng.php +++ b/admin/WebConsole/idiomas/php/eng/propiedades_aulas_eng.php @@ -44,6 +44,7 @@ $TbMsg[32]="Validation page"; // AGP $TbMsg[33]="ogLive"; $TbMsg[34]="*** Some computers have different ogLive ***"; +$TbMsg[35]="When starting equipment with ogLive, the Database is updated "; $TbMsg[495]="Cache data"; $TbMsg[509]="Computer picture"; $TbMsg[5091]="Insert picture"; diff --git a/admin/WebConsole/idiomas/php/esp/avisos_esp.php b/admin/WebConsole/idiomas/php/esp/avisos_esp.php index cfefbee2..500d3fce 100644 --- a/admin/WebConsole/idiomas/php/esp/avisos_esp.php +++ b/admin/WebConsole/idiomas/php/esp/avisos_esp.php @@ -14,5 +14,5 @@ $TbMsg["WARN_NOTESOFMENU"]='NOTAS: Los menús personalizados tienen mayor $TbMsg["WARN_GPT"]='AVISO: Para tabla de particiones GPT es necesario que la primera partición sea tipo EFI <br>y se recomienda un tamaño en torno a 512Mb.'; $TbMsg["WARN_SCHEDULER"]='AVISO: activar calendario de eventos de la BD para habilitar esta propiedad'; $TbMsg["WARN_SOURCE_PATH"]='AVISO: La ruta de origen sólo se utiliza en las sincronizadas tipo directorio.'; - +$TbMsg["COMM_REMOTEACCESS_CREATEAULA"]='permitir gestión de acceso remoto a los ordenadores cuando Aula creada'; diff --git a/admin/WebConsole/idiomas/php/esp/estados_esp.php b/admin/WebConsole/idiomas/php/esp/estados_esp.php index b1fce40f..3b54cc90 100644 --- a/admin/WebConsole/idiomas/php/esp/estados_esp.php +++ b/admin/WebConsole/idiomas/php/esp/estados_esp.php @@ -19,5 +19,5 @@ $TbMsg["STATUS_LNXS"]="Sesión GNU/Linux"; $TbMsg["STATUS_OSX"]="macOS"; $TbMsg["STATUS_WIN"]="Windows"; $TbMsg["STATUS_WINS"]="Sesión Windows"; - - +// Estados WoL +$TbMsg["STATUS_WOL_SENT"]="WoL enviado"; diff --git a/admin/WebConsole/idiomas/php/esp/propiedades_aulas_esp.php b/admin/WebConsole/idiomas/php/esp/propiedades_aulas_esp.php index d811f04b..a095d887 100644 --- a/admin/WebConsole/idiomas/php/esp/propiedades_aulas_esp.php +++ b/admin/WebConsole/idiomas/php/esp/propiedades_aulas_esp.php @@ -44,6 +44,7 @@ $TbMsg[32]="Página validación"; // AGP $TbMsg[33]="ogLive"; $TbMsg[34]="*** Existen equipos con diferentes ogLive ***"; +$TbMsg[35]="*** Al Iniciar equipos con ogLive se actualiza Base Datos ***"; $TbMsg[495]="Fecha/Caché"; $TbMsg[509]="Foto ordenador"; $TbMsg[5091]="Insertar foto"; diff --git a/admin/WebConsole/images/ordenador_WOL_SENT.png b/admin/WebConsole/images/ordenador_WOL_SENT.png Binary files differnew file mode 100644 index 00000000..d8bef72e --- /dev/null +++ b/admin/WebConsole/images/ordenador_WOL_SENT.png diff --git a/admin/WebConsole/jscripts/aula.js b/admin/WebConsole/jscripts/aula.js index ce87b6e2..fa119ecb 100644 --- a/admin/WebConsole/jscripts/aula.js +++ b/admin/WebConsole/jscripts/aula.js @@ -138,6 +138,9 @@ function soIMG(so) case 'VDI': MimgOrdenador="ordenador_VDI.png"; // Virtual break; + case 'WOL_SENT': + MimgOrdenador="ordenador_WOL_SENT.png"; // Wol enviado + break; default: MimgOrdenador="ordenador_OFF.png"; // Apagado break; diff --git a/admin/WebConsole/principal/aula.php b/admin/WebConsole/principal/aula.php index eeedeedc..398c8278 100644 --- a/admin/WebConsole/principal/aula.php +++ b/admin/WebConsole/principal/aula.php @@ -364,7 +364,7 @@ function pintaordenadores(){ } echo ' </tr>'; echo ' <tr align="center" valign="top">'; - foreach (Array ("OFF", "MNT") as $status) { + foreach (Array ("OFF", "MNT", "WOL_SENT") as $status) { echo ' <td><img src="../images/ordenador_'.$status.'.png" alt="'.$status.'" width="24" style="opacity: '.(1-0.5*($status=="MNT")).'" /><br /><font color="#003300" size="1" face="Arial, Helvetica, sans-serif">'.str_replace(" ", "<br>", $TbMsg["STATUS_$status"]).'</font></td>'; } echo ' </tr>'; diff --git a/admin/WebConsole/principal/configuraciones.php b/admin/WebConsole/principal/configuraciones.php index 4bcef0b3..d33fa0cc 100644 --- a/admin/WebConsole/principal/configuraciones.php +++ b/admin/WebConsole/principal/configuraciones.php @@ -360,7 +360,7 @@ function datos_sesiones($cmd, $idordenador) } if ($ip) { foreach (file(LOG_FILE) as $line) { - if (strstr($line, "ip=$ip")) { + if (strstr($line, "ip=$ip,")) { $fields = preg_split("/[:,=]/", rtrim($line, ". \t\n\r\0\x0B")); $date_time = str_replace("T", " ", $fields[0]) . ":" . $fields[1] . ":" . preg_replace("/\+.*$/", "", $fields[2]); diff --git a/admin/WebConsole/propiedades/propiedades_aulas.php b/admin/WebConsole/propiedades/propiedades_aulas.php index 8bf2f8b5..ef9f7790 100644 --- a/admin/WebConsole/propiedades/propiedades_aulas.php +++ b/admin/WebConsole/propiedades/propiedades_aulas.php @@ -94,6 +94,21 @@ function abrir_ventana(URL){ window.open('../images/ver.php','Imagenes','scrollbars=yes,resizable=yes,width=950,height=640') } </script> +<!-- ### AGP remotePC ###################################################################################### --> +<script type="text/javascript"> +function MuestraAccesoR() { + element = document.getElementById("verinremotepc"); + check = document.getElementById("check"); + if (check.checked) { + element.style.display=''; + } + else { + element.style.display='none'; + } +} +</script> + +<!-- ### AGP remotePC ###################################################################################### --> </HEAD> <BODY> <DIV align=center> @@ -235,13 +250,17 @@ function abrir_ventana(URL){ echo '<td colspan="3"><input class="formulariodatos" name="inremotepc" type="checkbox" onclick="desabilita(this)" '; if ($inremotepc) echo ' checked '; echo '></td>'; - } else { - echo '<td colspan="3"><input class="formulariodatos" name="inremotepc" type="checkbox" value="1" '; - if ($inremotepc) echo ' checked '; - if ($scheduler) - echo '> <em>('.$TbMsg['COMM_REMOTEACCESS'].')<em></td>'; - else - echo 'disabled> <em>'.$TbMsg['WARN_SCHEDULER'].'<em></td>'; + } else { ### AGP Se activa la casilla verificacion cuando el Aula esta creada + echo '<td colspan="3"><input onchange="MuestraAccesoR();" class="formulariodatos" name="inremotepc" id="check" type="checkbox" value="1" '; + if ( !empty($idaula) ){ + if ($inremotepc) echo ' checked '; + if ($scheduler) + echo '> <em>('.$TbMsg['COMM_REMOTEACCESS'].')<em></td>'; + else + echo 'disabled> <em>'.$TbMsg['WARN_SCHEDULER'].'<em></td>'; + }else{ + echo 'disabled> <em><font color=red>('.$TbMsg['COMM_REMOTEACCESS_CREATEAULA'].')</font><em></td>'; + } } ?> </tr> @@ -465,7 +484,41 @@ function abrir_ventana(URL){ echo '<td colspan="3"><input class="formulariodatos" name="paginavalidacion" style="width:200px" type="text" value="'.$paginavalidacion.'"></td>'; ?> </tr> -<!-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> +<!------------------------------------------------------------------- UMA remotePC--------------------------------------------------------------------------------------> +<!-- ### AGP remotePC ############################################################################################################################################# --> + <?php if ($inremotepc){ + echo '<tr id="verinremotepc" style="display:">'; + }else{ + echo '<tr id="verinremotepc" style="display:none">'; + ?> + <th align="center"> <?php echo "remotePC"?> </th> + <?php if ($opcion==$op_eliminacion) //eliminacion=3 + //echo '<td colspan="3">'.$paginavalidacion.'</td>'; + echo '<td colspan="3">De momento nada</td>'; + else // sino insertamos + $ambito=4; //Ambito aula 4 + echo '<td colspan="3">Nº Disk ---- Nº Part Imagen remotePC<br> + <input class="formulariodatos" name="diskremotepc" style="width:20px" maxlength="1" align="center" type="text" value="'.$diskremotepc.'"> + + <input class="formulariodatos" name="partremotepc" style="width:20px" maxlength="1" align="center" type="text" value="'.$partremotepc.'"> + + <select class="formulariodatos" name="imaremotepc" align="center"> + <option value="">-- Selecciona Imagen remotePC --</option> + '. htmlOPTION_images($cmd,$ambito,$idaula) .' + </select> + <br> + <div style="color: red; font-weight: bold;">'.$TbMsg[35].' + </td>'; + + ?> + <?php + echo '<tr id="verinremotepc" style="display:none">'; + echo '<TH style="BACKGROUND-COLOR:#FFFFFF;COLOR:red" colspan=4 align=center> <?php echo $TbMsg[1888]?> </TH>'; + echo '</TR>'; + + }?> +<!-- ### AGP remotePC ############################################################################################################################################# --> +<!------------------------------------------------------------------- UMA remotePC--------------------------------------------------------------------------------------> </TABLE> </FORM> @@ -673,3 +726,54 @@ function TomaConfiguracion($cmd) { } return(false); } +### AGP remotePC ###################################################################################### +//________________________________________________________________________________________________________ +// Recupera los datos de una imagen +// Parametros: +// - cmd: Una comando ya operativo (con conexión abierta) +// - ambito: El ambito del aula +// - idambito: El identificador del aula +//________________________________________________________________________________________________________ +function htmlOPTION_images($cmd,$ambito,$idambito) +{ +// 1.1 Imagenes de todos los repositorios de la UO. +if ($ambito == 4) +{ +// ambito aulas +$subconsultarepo='select idrepositorio from repositorios INNER JOIN aulas where repositorios.idcentro=aulas.idcentro AND idaula='.$idambito; +} +if ($ambito == 8) +{ +$subconsultarepo='select idrepositorio from repositorios INNER JOIN aulas INNER JOIN gruposordenadores where repositorios.idcentro=aulas.idcentro AND aulas.idaula=gruposordenadores.idaula AND idgrupo='.$idambito; +} +if ($ambito == 16) +{ +$subconsultarepo='select repositorios.idrepositorio from repositorios INNER JOIN aulas INNER JOIN ordenadores where repositorios.idcentro=aulas.idcentro AND aulas.idaula=ordenadores.idaula AND idordenador='.$idambito; +} + $SelectHtml=""; + // 1.0.5 imagenes.tipo =1 para que solo muestre las monoloticas. + $cmd->texto="SELECT *,repositorios.ip as iprepositorio, repositorios.nombrerepositorio as nombrerepo FROM imagenes + INNER JOIN repositorios ON repositorios.idrepositorio=imagenes.idrepositorio + AND repositorios.idrepositorio IN (" . $subconsultarepo . ") WHERE imagenes.inremotepc=1 AND imagenes.tipo=1 ORDER BY imagenes.descripcion"; + $rs=new Recordset; + $rs->Comando=&$cmd; + + if ($rs->Abrir()){ + $rs->Primero(); + while (!$rs->EOF){ + $SelectHtml.='<OPTION value="'.$rs->campos["iprepositorio"] ."_".$rs->campos["nombreca"]."_".$rs->campos["idimagen"].'_'.$rs->campos["idperfilsoft"].'" '; + //$SelectHtml.='<OPTION value="'.$rs->campos["nombreca"] . '" '; + $SelectHtml.='>'; + $SelectHtml.= $rs->campos["descripcion"] .' ('.$rs->campos["nombrerepo"].') </OPTION>'; + $rs->Siguiente(); + } + $rs->Cerrar(); + } + else + { + $SelectHtml.='<option value=""> ERROR: Ambito con multiples Repositorios --</option>'; + + } + return($SelectHtml); +} +### AGP remotePC ###################################################################################### diff --git a/admin/WebConsole/propiedades/propiedades_imagenes.php b/admin/WebConsole/propiedades/propiedades_imagenes.php index 116d5a95..9816e046 100644 --- a/admin/WebConsole/propiedades/propiedades_imagenes.php +++ b/admin/WebConsole/propiedades/propiedades_imagenes.php @@ -75,6 +75,7 @@ if (!$resul) if ($opcion == 1 && $datospost == 1) { if (isset($_POST["opcion"])) $opcion=$_POST["opcion"];// Recoge parametros if (isset($_POST["idrepositorio"])) $idrepositorio=$_POST["idrepositorio"]; + if (isset($_POST["idperfilsoft"])) $idperfilsoft=$_POST["idperfilsoft"]; if (isset($_POST["idimagen"])) $idimagen=$_POST["idimagen"]; if (isset($_POST["nombreca"])) { $nombreca=$_POST["nombreca"]; @@ -128,6 +129,28 @@ if ($opcion!=$op_alta and isset($repokey)) { <SCRIPT language="javascript" src="../jscripts/propiedades_imagenes.js"></SCRIPT> <SCRIPT language="javascript" src="../jscripts/opciones.js"></SCRIPT> <?php echo '<SCRIPT language="javascript" src="../idiomas/javascripts/'.$idioma.'/propiedades_imagenes_'.$idioma.'.js"></SCRIPT>'?> +<!-- ### AGP remotePC ###################################################################################### --> +<script type="text/javascript"> +function showContent() { + element = document.getElementById("content"); + check = document.getElementById("check"); + if (check.checked) { + element.style.display=''; + } + else { + element.style.display='none'; + } +} +</script> +<script type="text/javascript"> + + + check = document.getElementById("check"); + if(check.value==1){ + alert(); + } +</script> +<!-- ### AGP remotePC ###################################################################################### --> </HEAD> <BODY> <DIV align=center> @@ -185,6 +208,17 @@ if ($opcion!=$op_alta and isset($repokey)) { echo '</TD>'; } ?> </TR> + <!-- ------------------------------------- TIPO PARTICION ------------------------- --> + <tr> + <th align="center"> <?php echo $TbMsg[9]?> </th> + <?php + if ($opcion==$op_eliminacion || !empty($idperfilsoft)) + echo '<td>'.$tipopar.' ('.dechex($codpar).') + <input type="hidden" name="codpar" value="'.$codpar.'"></td>'; + else + echo '<td>'.HTMLSELECT($cmd,0,'tipospar',$codpar,'codpar',"CONCAT(CASE WHEN codpar BETWEEN 1 AND 255 THEN '1-MSDOS' WHEN codpar BETWEEN 256 AND 65535 THEN '2-GPT' ELSE codpar END,': ',tipopar,' (',HEX(codpar),')')",170,"","","clonable=1").'</td>'; + ?> + </tr> <!-- -------------------------------------------------------------------------------- --> <?php if($tipoimg==$IMAGENES_INCREMENTALES){?> <TR> @@ -237,7 +271,8 @@ if ($opcion!=$op_alta and isset($repokey)) { if ($inremotepc) echo ' checked '; echo '></td>'; } else { - echo '<td><input name="inremotepc" type="checkbox" value="1"'; + echo '<td><input onchange="showContent();" name="inremotepc" id="check" type="checkbox" value="1" '; + // echo '<td><input name="inremotepc" type="checkbox" value="1"'; if ($inremotepc) echo ' checked '; if ($scheduler) echo '> <em>('.$TbMsg['COMM_REMOTEACCESS'].')<em></td>'; @@ -267,6 +302,8 @@ if ($opcion!=$op_alta and isset($repokey)) { <td> <?php if (! empty ($modelo)) echo "$fechacreacion ".($revision>0 ? "(r$revision)" : "") ?> <input type="hidden" name="fechacreacion" value="<?php echo $fechacreacion ?>"></td> </tr> +<!---------------------------------------------- AGP Perfil software------------------------------------------------------------------> +<?php } if ($opcion!=$op_alta){ ?> <!-- Perfil de software --> <TR> <TH align=center> <?php echo $TbMsg[6]?> </TH> @@ -278,7 +315,19 @@ if ($opcion!=$op_alta and isset($repokey)) { echo '<TD>'.HTMLSELECT($cmd,$idcentro,'perfilessoft',$idperfilsoft,'idperfilsoft','descripcion',300).'</TD>'; } ?> - </TR> + </TR> +<?php }else{ ?> + <!-- Perfil de software ALTA --> + <TR id="content" style="display:none"> + <TH align=center> <?php echo $TbMsg[6]?> </TH> + <?php + // echo '<INPUT type="text" name="idperfilsoft" value="'.$idperfilsoft.'">'; + echo '<TD>'.HTMLSELECT($cmd,$idcentro,'perfilessoft',$idperfilsoft,'idperfilsoft','descripcion',300).'</TD>'; + ?> + </TR> +<?php }?> +<!---------------------------------------------- AGP Perfil software------------------------------------------------------------------> + <?php if ($opcion!=$op_alta) { ?> <!-- Sistema Operativo --> <tr> <th align="center"> <?php echo $TbMsg['PROP_OS']?> </th> diff --git a/admin/WebConsole/rest/remotepc.php b/admin/WebConsole/rest/remotepc.php index 6a897e0a..6dc5a62d 100644 --- a/admin/WebConsole/rest/remotepc.php +++ b/admin/WebConsole/rest/remotepc.php @@ -185,6 +185,9 @@ INSERT INTO acciones idcentro=$ouid; EOD; $t2 = $cmd->Ejecutar(); + create_schedule_now(strval($timestamp), + $EJECUCION_COMANDO, + "auto-queue-remotepc-reserve-".$timestamp); // Create event to remove reservation on timeout (15 min.). $timeout = "15 MINUTE"; $cmd->texto = <<<EOD @@ -679,6 +682,9 @@ INSERT INTO acciones idcentro=$ouid; EOD; $cmd->Ejecutar(); + create_schedule_now(strval($timestamp), + $EJECUCION_COMANDO, + "auto-queue-remotepc-init-".$timestamp); // Create event to remove the operation on timeout (15 min.). $timeout = "15 MINUTE"; $cmd->texto = <<<EOD diff --git a/admin/WebConsole/rest/server.php b/admin/WebConsole/rest/server.php index a6256a2e..12b874ed 100644 --- a/admin/WebConsole/rest/server.php +++ b/admin/WebConsole/rest/server.php @@ -81,6 +81,7 @@ function getStatus($ouid, $labid, $clntid=0) { 'LNX'=>"linux", 'OSX'=>"macos", 'WIN'=>"windows", + 'WOL_SENT'=>"wol_sent", 'UNK'=>"unknown"]; // Parameters. $ouid = htmlspecialchars($ouid); diff --git a/client/engine/Cache.lib b/client/engine/Cache.lib index 40715946..cacba40d 100755 --- a/client/engine/Cache.lib +++ b/client/engine/Cache.lib @@ -275,7 +275,7 @@ ogDevToDisk ${PART%% *} 2>/dev/null function ogFormatCache () { # Variables locales. -local DEV MNTDIR +local DEV MNTDIR OPTIONS # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then ogHelp "$FUNCNAME" "$FUNCNAME" @@ -288,7 +288,9 @@ DEV=$(ogDiskToDev $DEV) || return $? # Formatear sistema de ficheros. ogUnmountCache 2>/dev/null -mkfs.ext4 -q -F $DEV -L "CACHE" -O extent,large_file 2>/dev/null || ogRaiseError $OG_ERR_PARTITION "CACHE" || return $? +OPTIONS="extent,large_file" +[[ $(uname -r) =~ ^5 ]] && OPTIONS+=",uninit_bg,^metadata_csum,^64bit" +mkfs.ext4 -q -F $DEV -L "CACHE" -O "$OPTIONS" 2>/dev/null || ogRaiseError $OG_ERR_PARTITION "CACHE" || return $? # Crear estructura básica. MNTDIR=$(ogMountCache) diff --git a/client/shared/bin/poweroffconf b/client/shared/bin/poweroffconf index de6726b4..c8cdf39c 100755 --- a/client/shared/bin/poweroffconf +++ b/client/shared/bin/poweroffconf @@ -21,6 +21,7 @@ OPENGNSYS=${OPENGNSYS:-/opt/opengnsys} # Instalación de OpenGnsys OGETC=${OGETC:-$OPENGNSYS/etc} # Configuración de OpenGnsys POWEROFFCONF=/etc/poweroff.conf # Configuración del script +OGCLIENT=ogclient # Error si no existe el fichero de configuración de ahorro de energía. if [ ! -f $POWEROFFCONF ]; then @@ -62,7 +63,7 @@ case $# in esac # Comprobar si hay algún script en ejecución (verificando compatibilidad de "pgrep"). [ -n "$(pgrep -fa 2>&1 | grep "invalid")" ] && PGREP="pgrep -fl" || PGREP="pgrep -fa" -if [ -n "$($PGREP $OPENGNSYS | egrep -v "$OGETC|$0")" ]; then +if [ -n "$($PGREP $OPENGNSYS | egrep -v "$OGETC|$0|$OGCLIENT")" ]; then # Eliminar tiempo de inicio de espera, si se está ejecutando operación. perl -pi -e 's/POWEROFFTIME=.*$/POWEROFFTIME=/' $POWEROFFCONF else diff --git a/doc/CHANGELOG.en.txt b/doc/CHANGELOG.en.txt new file mode 100644 index 00000000..d33d92f9 --- /dev/null +++ b/doc/CHANGELOG.en.txt @@ -0,0 +1,60 @@ +CHANGELOG.en.txt +================ + + +Changes included in OpenGnsys 1.2.0 +----------------------------------- + +#140 Unified configuration file (duplicated) +#803 Delete drop-down of images from different partition (won't be resolved) +#837 Install OpenGnsys using deb package (duplicated) +#838 Problema con parámetros vga en ogLive +#901 Investigate if connections to the database are made correctly +#902 Unclear error message (won't be resolved) +#941 Use libdbi in ogAdmServer +#942 Remove ogAdmAgent +#944 Show computer distribution in a lab +#968 Choose allowed operations in OGAgent agents +#970 Use autotools in ogAdmServer +#971 Remove unused code in ogAdmServer, ogAdmAgent and ogAdmClient +#975 New OGAgent option to obtain system status in detail +#976 ogBootMbrGeneric: improve GPT compatibility (won't be resolved) +#980 Add REST API to ogClient +#981 add native systemd unit file for ogAdmServer +#986 Rename ogAdmServer to ogServer +#987 Use systemctl to disable/enable services in Debian/Ubuntu +#990 Use client broadcast address on WoL +#991 Define computer in maintenance status +#997 Releasing OpenGnsys version 1.2.0 +#998 disable incremental image updates +#999 ogClient session command do not boot the selected OS +#1000 Fix ogClient HTTP lenght handling +#1001 Remove trailing \r and \n in some scripts +#1002 Fix update script to not remove ogAdmRepo.cfg +#1003 Fix ogClient update +#1005 Fix support for computer groups in RemotePC +#1006 Fix RemotePC IP retrieving on running clients +#1007 opengnsys_update.sh does not generate VERSION.json file +#1008 Add support to several disks +#1009 Fix ogclient permissions +#1010 Clean up and fix /software +#1011 Windows hibernation error +#1012 Support disk larger than 2Tb +#1013 ogClient (live mode) hangs busy when createImage script fails +#1014 ogGetImageInfo function fails with Windows 10 2009 update +#1015 PXE files are not updated when needed +#1017 Default ogLive crash after system update, symlinks don't exist (not valid) +#1018 opengnsys_update script cannot start or stop ogserver service +#1019 ogClient cannot execute some queued instructions +#1020 logrotate does not rotate opengnsys log files +#1022 Software inventory crashes when it exceeds 64 Kb +#1024 Disable function move a single computer +#1026 Installation and update scripts must report the operating system prerequisites (and previous version of OpenGnsys in the case of update scripts) +#1027 opengnsys_update.sh does not include the server IP in ogclient.json file +#1028 ogServer: modify its status when uninstalling or changing the server's IP address +#1029 Final message of installation and upgrade scripts +#1031 Admin console doesn't show the statistics +#1032 Running a task causes a malfunction in action queue +#1033 ogLive 5.4 incompatible with "opengnsys-cache" netboot option +#1034 Error is displayed during the execution of opengnsys_export.sh + diff --git a/doc/CHANGELOG.es.txt b/doc/CHANGELOG.es.txt index ba7f5fb6..6cdde072 100644 --- a/doc/CHANGELOG.es.txt +++ b/doc/CHANGELOG.es.txt @@ -6,40 +6,67 @@ Lista de cambios incluidos en OpenGnsys 1.2.0 --------------------------------------------- Tickets resueltos en módulo OpenGnsys Cloning Engine: +#976 ogBootMbrGeneric: mejora en la compatibilidad con GPT (no se resolverá) #1011 Error con Windows hibernado #1014 ogGetImageInfo falla con la actualización de Windows de octubre 2020 Tickets resueltos en módulo OpenGnsys Client: -#980 Add REST API to ogClient -#999 ogClient session command do not boot the selected OS (corrección) -#1000 Fix ogClient HTTP lenght handling (corrección) -#1009 Fix ogclient permissions (corrección) +#980 Se añade API REST API a ogClient +#999 El comando "session" de ogClient no arranque el SO seleccionado (corrección) +#1000 Se arregla el manejo de la longitud HTTP (corrección) +#1009 Se arreglan los permisos de ogclient (corrección) +#1013 ogClient (en modo live) se cuelga mostrando estado ocupado cuando falla createImage +#1019 El agente ogclient del oglive no ejecuta algunas instrucciones encoladas +#1027 opengnsys_update.sh: no configura ip del servidor en ogclient.json +#1033 ogLive 5.4 incompatible con opción del netboot opengnsys-cache + +Tickets resueltos en módulo OpenGnsys Agent: +#968 Elegir operaciones permitidas en agentes OGAgent +#975 Definir opción para que OGAgent devuelva estado detallado del sistema Tickets resueltos en módulo OpenGnsys Server: -#941 Use libdbi in ogAdmServer (mejora) -#942 Remove ogAdmAgent (mejora) -#970 Use autotools in ogAdmServer -#971 Remove unused code in ogAdmServer, ogAdmAgent and ogAdmClient -#981 add native systemd unit file for ogAdmServer -#986 Rename ogAdmServer to ogServer -#990 Use client broadcast address on WoL (mejora) +#140 Fichero de configuración unificado (duplicado) +#941 Utilizar libdbi en ogAdmServer (mejora) +#942 Eliminar ogAdmAgent (mejora) +#970 Utilizar autotools en ogAdmServer +#971 Eliminar código innecesario en ogAdmServer, ogAdmAgent y ogAdmClient +#981 Añadir fichero de inicio para ogAdmServer con systemd +#986 Renombrar ogAdmServer a ogServer +#990 Utilizar la dirección del cliente para WoL por broadcast (mejora) #1002 Fix update script to not remove ogAdmRepo.cfg (corrección) -#1008 Add support to several disk (mejora) -#1010 Clean up and fix /software +#1008 Añadir soporte para varios discos (mejora) +#1010 Limpiar y corregir código +#1017 Falla ogLive (por defecto) tras una actualización, los enlaces del tftpboot oglive y oclient no están. (no válido) +#1018 Servicio ogserver no se para ni se inicia durante el proceso de opengnsys_update +#1020 logrotate no rota los ficheros de log de opengnsys +#1022 NO realiza Inventario Software cuando supera los 64 kb +#1028 servicio ogserver: modificar su estado al desinstalar o cambiar la ip del servidor. +#1034 opengnsys_export.sh muestra falso error durante su ejecución Tickets resueltos en módulo OpenGnsys Web Admin Console: +#803 Consola Web: Eliminar desplegable imágenes de distinta partición (no se resolverá) #838 Problema con parámetros vga en ogLive -#901 Investigate if connections to the database are made correctly +#901 Revisión de las conexiones a la base de datos +#902 Unclear error message (no se resolverá) #944 Mostrar la distribución de equipos en el aula (mejora) -#998 disable incremental image updates -#1001 Remove trailing \r and \n in some scripts (corrección) -#1005 Fix support for computer groups in RemotePC (corrección) -#1006 Fix RemotePC IP retrieving on running clients +#991 Definir ordenador en estado de mantenimiento +#998 Deshabilitar imágenes sincronizadas +#1001 Eliminar finales en \r y \n en algunos scripts (corrección) +#1005 Arreglar el soporte para grupos de ordenadores en RemotePC (corrección) +#1006 Arreglar la recuperación de IP de clientes en ejecución en RemotePC #1012 Soporte disco mayores de 2Tb +#1015 Los ficheros de arranque PXE files no se actualizan cuando es necesario +#1024 Se dehabilita la función de mover un único equipo +#1031 La consola de administración no muestra las estadísticas +#1032 La ejecución de tareas provoca el mal funcionamiento de la cola de acciones Tickets resueltos en módulo OpenGnsys Installer: -#987 Use systemctl to disable/enable services in Debian/Ubuntu (mejora) -#1003 Fix ogClient update +#837 Paquete deb para instalar OpenGnsys (duplicado) +#987 Utilizar systemctl para habilitar/deshabilitar los servicios en Debian/Ubuntu (mejora) +#1003 Arreglar la actualizacion del ogClient +#1007 Error en opengnsys_update.sh: no genera archivo version.json +#1026 Los script de instalación y actualización deben mostrar los prerequisitos de OpenGnsys (y el de actualizacion la versión previa) +#1029 Los script de instalación y actualización muestran aviso sobre el nivel de depuración de syslog. Lista de cambios incluidos en OpenGnsys 1.1.1c (versión de mantenimiento) diff --git a/doc/COMPATIBILITY.en.txt b/doc/COMPATIBILITY.en.txt index 03f81c55..c8d89ab1 100644 --- a/doc/COMPATIBILITY.en.txt +++ b/doc/COMPATIBILITY.en.txt @@ -1,5 +1,5 @@ -OpenGnsys 1.1.1 (Espeto) Compatibility Notes +OpenGnsys 1.2.0 (Gazpacho) Compatibility Notes ============================================== @@ -8,9 +8,7 @@ OpenGnsys Administration Server and Repository Manager Installation of OpenGnsys services has been tested on the following GNU/Linux distributions: - - Ubuntu Server 18.04 LTS 64-bit (recommended) - - Ubuntu Server 16.04 LTS 64-bit (not fully tested) - - CentOS 7.x 64-bit (not fully tested) + - Ubuntu Server 18.04 LTS 64-bit OpenGnsys Clients @@ -18,8 +16,8 @@ OpenGnsys Clients Installation and cloning operations have been tested on the following operating systems and filesystems: - - Ubuntu Desktop 14.04 LTS 64-bit, 16.04 LTS 64-bit and 18.04 LTS 64-bit with Ext4 filesystem and Swap partition + - Ubuntu Desktop 14.04 LTS 64-bit, 16.04 LTS 64-bit, 18.04 LTS 64-bit, and 20.04 LTS 64-bit with Ext4 filesystem and swap partition or swap file - Windows 7 Enterprise 64-bit with NTFS filesystem - - Windows 10 Education 1709 64-bit, 1803 64-bit, 1809 64-bit and 1903 64-bit with NTFS filesystem + - Windows 10 Education 1709 64-bit, 1803 64-bit, 1809 64-bit, 1903 64-bit, 2004 64-bit, and 2009 64-bit with NTFS filesystem diff --git a/doc/INSTALL.en.txt b/doc/INSTALL.en.txt index 84492e6e..02062ef9 100644 --- a/doc/INSTALL.en.txt +++ b/doc/INSTALL.en.txt @@ -1,10 +1,10 @@ -Installing OpenGnsys Server 1.1.1 (Espeto) -========================================== +Installing OpenGnsys Server 1.2.0 (Gazpacho) +============================================ Before installation ------------------- -OpenGnsys Server 1.1.1 (codename Espeto) is meant to be installed under Ubuntu Server 18.04 LTS or newer (some tests have been done on CentOS 7-based systems). +OpenGnsys Server 1.2.0 (codename Gazpacho) is meant to be installed under Ubuntu Server 18.04 LTS 64-bit. Network connection is needed in order to download the required packages, the source code and the preconfigured client. @@ -71,7 +71,7 @@ Once the installation process is finished, you can start working with the system Updating / upgrading -------------------- -Warning: if you are going to upgrade OpenGnsys from a version earlier than 1.1.1 (Espeto), you must first upgrade Ubuntu to version 18.04 LTS and restart the server. +Warning: if you are going to upgrade OpenGnsys from a version earlier than 1.2.0 (Gazpacho), you must first upgrade Ubuntu to version 18.04 LTS and restart the server. There is a system self-upgrading script with the following features: * Network connection is needed to obtain the latest updates / upgrades. diff --git a/doc/INSTALL.es.txt b/doc/INSTALL.es.txt index a8fd4e00..75c844dc 100644 --- a/doc/INSTALL.es.txt +++ b/doc/INSTALL.es.txt @@ -1,10 +1,10 @@ -Instalación de OpenGnsys Server 1.1.1 (Espeto) -============================================== +Instalación de OpenGnsys Server 1.2.0 (Gazpacho) +================================================ Notas iniciales --------------- -Se presupone que el servidor de OpenGnsys 1.1.1 (Espeto) va a ser instalado en una distribución del sistema operativo Ubuntu Server a partir de la versión 18.04 LTS (se han hecho algunas pruebas en sistemas basados en CentOS 7). +Se recomienda que el servidor de OpenGnsys 1.2.0 (Gazpacho) sea instalado en una distribución del sistema operativo Ubuntu Server versión 18.04 LTS de 64 bits. El serividor debe tener acceso a Internet para descargar los paquetes necesarios, el código del proyecto y el cliente preconfigurado. @@ -71,7 +71,7 @@ Una vez finalizada la ejecución del instalador, puede empezarse a trabajar con Actualización ------------- -Nota importante: si se va a actualizar OpenGnsys desde una versión anterior a la 1.1.1 (Espeto), debe actualizarse antes la distribución de Ubuntu a la versión 18.04 LTS y reiniciar el servidor. +Nota importante: si se va a actualizar OpenGnsys desde una versión anterior a la 1.2.0 (Gazpacho), debe actualizarse antes la distribución de Ubuntu a la versión 18.04 LTS y reiniciar el servidor. Se dispone de un script de auto-actualización del sistema, con las siguientes características: * Es necesario conexión a Internet para obtener las últimas actualizaciones. diff --git a/doc/VERSION.json b/doc/VERSION.json index 94dd81ed..cbbd5c0d 100644 --- a/doc/VERSION.json +++ b/doc/VERSION.json @@ -1,6 +1,6 @@ { "project": "OpenGnsys", - "version": "1.2.0", + "version": "1.2.1", "codename": "Gazpacho", "definition": "https://www.andalucia.com/gastronomy/gazpacho.htm", "release": "", diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index ed892df0..972ea71a 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -114,24 +114,26 @@ function userData () OPENGNSYS_CLIENT_PASSWD="$PASSWORD" unset PASSWORD + # El ogclient sólo es compatible con ogLive de kernel 5.x. Se comenta la elección de ogLive. # Selección de clientes ogLive para descargar. - while : ; do - echo -e "\\n\\nChoose ogLive client to install." - echo -e "1) Kernel 5.4, 64-bit, EFI-compatible" - echo -e "2) Kernel 3.2, 32-bit" - echo -e "3) Both" - echo -n -e "Please, type a valid number (1): " - read -r OPT - case "$OPT" in - 1|"") OGLIVE="$DEFAULT_OGLIVE" - break ;; - 2) OGLIVE="ogLive-precise-3.2.0-23-generic-r5159.iso" - break ;; - 3) OGLIVE=" $DEFAULT_OGLIVE ogLive-precise-3.2.0-23-generic-r5159.iso"; - break ;; - *) echo -e "\\aERROR: unknown option, try again." - esac - done + #while : ; do + # echo -e "\\n\\nChoose ogLive client to install." + # echo -e "1) Kernel 5.4, 64-bit, EFI-compatible" + # echo -e "2) Kernel 3.2, 32-bit" + # echo -e "3) Both" + # echo -n -e "Please, type a valid number (1): " + # read -r OPT + # case "$OPT" in + # 1|"") OGLIVE="$DEFAULT_OGLIVE" + # break ;; + # 2) OGLIVE="ogLive-precise-3.2.0-23-generic-r5159.iso" + # break ;; + # 3) OGLIVE=" $DEFAULT_OGLIVE ogLive-precise-3.2.0-23-generic-r5159.iso"; + # break ;; + # *) echo -e "\\aERROR: unknown option, try again." + # esac + #done + OGLIVE="$DEFAULT_OGLIVE" echo -e "\\n==============================" } @@ -833,7 +835,7 @@ function downloadCode() echoAndLog "${FUNCNAME}(): downloading code..." - curl "${url}" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys + curl "${url}" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-${BRANCH#v}" opengnsys if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error getting OpenGnsys code from $url" return 1 @@ -1360,7 +1362,7 @@ function ogServerCompilation () echoAndLog "${FUNCNAME}(): ogServer code was downloaded" echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Server" - pushd "$WORKDIR/ogServer-$BRANCH" + pushd "$WORKDIR/ogServer-${BRANCH#v}" autoreconf -fi && ./configure && make && mv ogserver $INSTALL_TARGET/sbin if [ $? -ne 0 ]; then echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Server" @@ -1427,7 +1429,7 @@ function copyClientFiles() if ! (curl "${ogclientUrl}" -o ogclient.zip && \ unzip -qo ogclient.zip && \ - mv "ogClient-$BRANCH" $INSTALL_TARGET/client/ogClient) + mv "ogClient-${BRANCH#v}" $INSTALL_TARGET/client/ogClient) then errorAndLog "${FUNCNAME}(): "\ "error getting ogClient code from ${ogclientUrl}" @@ -1496,7 +1498,7 @@ function openGnsysConfigure() cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.service \ /lib/systemd/system/opengnsys.service - cp -a $WORKDIR/ogServer-$BRANCH/cfg/ogserver.service \ + cp -a $WORKDIR/ogServer-${BRANCH#v}/cfg/ogserver.service \ /lib/systemd/system/ogserver.service cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default /etc/default/opengnsys # Deshabilitar servicios de BitTorrent si no están instalados. diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index 4b244b28..3a21072d 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -139,7 +139,7 @@ function autoConfigure() # Configuración según la distribución de Linux. if [ -f /etc/debian_version ]; then # Distribución basada en paquetes Deb. - DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast libev-dev libjansson-dev libssl-dev shim-signed grub-efi-amd64-signed php-fpm gawk libdbi-dev libdbi1 libdbd-mysql automake liblz4-tool ) + DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast libev-dev libjansson-dev libssl-dev shim-signed grub-efi-amd64-signed php-fpm gawk libdbi-dev libdbi1 libdbd-mysql automake liblz4-tool software-properties-common ) # Paquete correcto para realpath. [ -z "$(apt-cache pkgnames realpath)" ] && DEPENDENCIES=( ${DEPENDENCIES[@]//realpath/coreutils} ) UPDATEPKGLIST="add-apt-repository -y ppa:ondrej/php; apt-get update" @@ -221,8 +221,9 @@ function chooseVersion() [ -f $INSTALL_TARGET/doc/VERSION.txt ] && read -pe INSTVERSION INSTRELEASE <<< $(awk '{print $2,$3}' $INSTALL_TARGET/doc/VERSION.txt) # Fetch tags (releases) data from GitHub. while read -pe TAG URL; do - if [[ $TAG =~ ^opengnsys- ]]; then + if [[ $TAG =~ ^(opengnsys-|v)[0-9] ]]; then [ "${TAG#opengnsys-}" \< "${INSTVERSION%pre}" ] && continue + [ "${TAG#v}" \< "${INSTVERSION%pre}" ] && continue RELDATE=$(curl -s "$URL" | jq -r '.commit.committer.date | split("-") | join("")[:8]') RELEASES+=( "${TAG} ($RELDATE)" ) DOWNLOADS+=( "$URL" ) @@ -496,13 +497,12 @@ function downloadCode() fi local url="$1" - echoAndLog "${FUNCNAME}(): downloading code..." curl "$url" -o opengnsys.zip && \ unzip -qo opengnsys.zip && \ rm -fr opengnsys && \ - mv "OpenGnsys-$BRANCH" opengnsys + mv "OpenGnsys-${BRANCH#v}" opengnsys if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error getting code from ${url}, verify your user and password" return 1 @@ -1097,7 +1097,7 @@ function ogServerCompilation() echoAndLog "${FUNCNAME}(): ogServer code was downloaded" echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Admin Server" - pushd "$WORKDIR/ogServer-$BRANCH" + pushd "$WORKDIR/ogServer-${BRANCH#v}" autoreconf -fi && ./configure && make && moveNewService ogserver $INSTALL_TARGET/sbin if [ $? -ne 0 ]; then echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Server" @@ -1142,7 +1142,7 @@ function ogServerCompilation() $INSTALL_TARGET/bin/settoken -f # Updating service file, if needed if ! diff -q \ - "$WORKDIR"/ogServer-"$BRANCH"/cfg/ogserver.service \ + "$WORKDIR"/ogServer-"${BRANCH#v}"/cfg/ogserver.service \ /lib/systemd/system/ogserver.service 2>/dev/null; then service="opengnsys" $STOPSERVICE @@ -1151,7 +1151,7 @@ function ogServerCompilation() service="ogserver" $STOPSERVICE cp -a \ - "$WORKDIR"/ogServer-"$BRANCH"/cfg/ogserver.service \ + "$WORKDIR"/ogServer-"${BRANCH#v}"/cfg/ogserver.service \ /lib/systemd/system/ogserver.service systemctl daemon-reload $STARTSERVICE @@ -1236,14 +1236,14 @@ function updateOgClient() return 1 fi if [ -e $INSTALL_TARGET/client/ogClient/cfg/ogclient.json ]; then - rm -f ogClient-"$BRANCH"/cfg/ogclient.json + rm -f ogClient-"${BRANCH#v}"/cfg/ogclient.json else CLIENTPASS=$(awk -F":" '{print $2}' /etc/rsyncd.secrets) sed -i -e 's/127.0.0.1/'$ServidorAdm'/' \ -e 's/pass'.*$'/pass\": "'$CLIENTPASS'"/' \ - ogClient-"$BRANCH"/cfg/ogclient.json + ogClient-"${BRANCH#v}"/cfg/ogclient.json fi - rsync -irplt "ogClient-$BRANCH/" $INSTALL_TARGET/client/ogClient + rsync -irplt "ogClient-${BRANCH#v}/" $INSTALL_TARGET/client/ogClient rm -f ogclient.zip echoAndLog "${FUNCNAME}(): ogClient code was downloaded and updated" diff --git a/installer/vagrant/Vagrantfile-1.2.0-vbox b/installer/vagrant/Vagrantfile-1.2.0-vbox index 3cecfdd2..b6659841 100644 --- a/installer/vagrant/Vagrantfile-1.2.0-vbox +++ b/installer/vagrant/Vagrantfile-1.2.0-vbox @@ -46,7 +46,7 @@ if which curl &>/dev/null; then elif which wget &>/dev/null; then DOWNLOAD="wget -q -O -" fi -BRANCH="opengnsys-#{OGVERSION}" +BRANCH="v#{OGVERSION}" $DOWNLOAD "https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH/installer/opengnsys_installer.sh" | bash || exit $? mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log echo y | /opt/opengnsys/bin/setserveraddr $(ip -o link show | tail -1 | cut -d: -f2) diff --git a/installer/vagrant/Vagrantfile-master-libvirt b/installer/vagrant/Vagrantfile-master-libvirt new file mode 100644 index 00000000..32261dcd --- /dev/null +++ b/installer/vagrant/Vagrantfile-master-libvirt @@ -0,0 +1,187 @@ +# Vagrantfile to install OpenGnsys virtual environment (development version) using VirtualBox provider. + +VAGRANTFILE_API_VERSION = "2" +# VM provider: Oracle VM VirtualBox. +ENV['VAGRANT_DEFAULT_PROVIDER'] = "libvirt" +# OGAgent version. +OGAGENTVERSION="1.1.2" +# Language (accepted values: es_ES, ca_ES, en_GB). +LANGUAGE = "es_ES" +ENV['LC_ALL'] = LANGUAGE + ".UTF-8" +# Number of OpenGnsys clients (accepted values: from 2 to 9). +NCLIENTS = 4 +# Repository virtual disk: file and size (GB). +REPODISK = "ogRepo.vdi" +REPOSIZE = 50 +# Amount of memory for server and clients (MB) +SERVERMEM = 1024 # Minimum: 512 +CLIENTMEM = 512 # Minimum: 256 +# Amount of CPU for server and clients (MB) +SERVERCPU = 1 +CLIENTCPU = 1 +# Prefixes for MAC and IP addresses. +MACPREFIX = "08:00:27:0E:65" +NETPREFIX = "192.168.2" +# OpenGnsys Server IP address. +SERVERIP = "#{NETPREFIX}.10" +# Local port to access OpenGnsys Server. +LOCALWEBPORT = 8443 + +# OpenGnsys Server provisioning script: prepare repo disk, install OpenGnsys, change default interface, configure DHCP server. +OGSERVERSCRIPT = <<EOT +# Exit if OpenGnsys is installed. +[ -f /opt/opengnsys/doc/VERSION.json ] && echo "Cannot provision, OpenGnsys is already installed." && exit 1 + +# Create repository disk using LVM, if necesary. +if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get -y install lvm2 + pvcreate /dev/vdb + vgcreate og /dev/vdb + vgchange -ay + lvcreate -ay -n images -l 100%VG og + mkfs -t ext4 /dev/mapper/og-images + mkdir -p /opt/opengnsys/images + echo "/dev/mapper/og-images /opt/opengnsys/images ext4 defaults 0 0" >> /etc/fstab + mount -t ext4 /dev/mapper/og-images /opt/opengnsys/images +fi +# Install OpenGnsys and change server address. +if which curl &>/dev/null; then + DOWNLOAD="curl -s" +elif which wget &>/dev/null; then + DOWNLOAD="wget -q -O -" +fi +BRANCH="master" +$DOWNLOAD "https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH/installer/opengnsys_installer.sh" | bash || exit $? +mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log +echo y | /opt/opengnsys/bin/setserveraddr $(ip -o link show | tail -1 | cut -d: -f2) +# Insert DHCP data. +for ((i=#{NCLIENTS+10}; i>10; i--)); do + sed -i "/^}$/ i host pc${i} { hardware ethernet #{MACPREFIX}:${i}; fixed-address #{NETPREFIX}.${i}; }" /etc/dhcp/dhcpd.conf +done +service isc-dhcp-server restart +# Set language. +export LANG="#{LANGUAGE}.UTF-8" +echo "LANG=\\\"$LANG\\\"" > /etc/default/locale +echo "LANG=\\\"$LANG\\\"" >> /etc/environment +locale-gen --lang #{LANGUAGE} +sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\\\"${LANG%_*}\\\"/" /etc/default/keyboard +dpkg-reconfigure -fnoninteractive console-setup +# Comment out next lines for automatic data insertion. +#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}.1', '255.255.255.0', '', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" +#for ((i=11; i<=#{NCLIENTS+10}; i++)); do +# SQL="$SQL ('pc$i', '#{NETPREFIX}.$i', REPLACE('#{MACPREFIX}$i',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif')," +#done +#mysql -u usuog -ppassusuog -D ogAdmBD -e "${SQL%,}" +#read -pe PORT TOKEN <<< $(jq -r '.rest.port+" "+.rest.api_token' /opt/opengnsys/etc/ogserver.json) +#DATA='{"clients": ["#{NETPREFIX}.11"], "mode": "19pxeADMIN"}' +#curl -ks -H "Authorization: $TOKEN" -d "$DATA" "http://localhost:$PORT/mode" +#DATA='{"clients": ["#{NETPREFIX}.'$(seq -s '", "#{NETPREFIX}.' 12 #{NCLIENTS+10})'"], "mode": "pxe"}' +#curl -ks -H "Authorization: $TOKEN" -d "$DATA" "http://localhost:$PORT/mode" + +# Tftpboot: Change grldr to new version +cp /opt/opengnsys/tftpboot/grldr /opt/opengnsys/tftpboot/grldr.orig +cp /opt/opengnsys/tftpboot/grldr-0.4.4 /opt/opengnsys/tftpboot/grldr + +echo "Notes:" +echo "- OpenGnsys Server URL: https://#{SERVERIP}/opengnsys/" +exit 0 +EOT + +# Client 1 OS provisioning script. +MODELSCRIPT = <<EOT +# Comment out next lines to install and configure OGAgent for Ubuntu. +#export DEBIAN_FRONTEND=noninteractive +#OGAGENTPKG="ogagent_#{OGAGENTVERSION}_all.deb" +#apt-get update -y +#apt-get install -y curl +#curl -ks https://#{SERVERIP}/opengnsys/descargas/$OGAGENTPKG -o /tmp/$OGAGENTPKG +#if [ -f /tmp/$OGAGENTPKG ]; then +# apt-get install -y /tmp/$OGAGENTPKG || exit $? +# sed -i "0,/remote=/ s,remote=.*,remote=https://#{SERVERIP}/opengnsys/rest/," /usr/share/OGAgent/cfg/ogagent.cfg +# rm -f /tmp/$OGAGENTPKG +#else +# echo "Warning: cannot install OGAgent package $OGAGENTPKG" +#fi +echo "Notes:" +echo "- After now, use virt-manager GUI to disable network interface 1, reconfigure boot network and restart this VM." +# Leave VM halted. +sleep 2 +poweroff & +EOT + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + # OpenGnsys Server VM definition. + config.vm.define :ogAdministrator, primary: true do |og| + # Specific VirtualBox configuration. + og.vm.provider "libvirt" do |vb| + # VM name, memory and CPUs. + vb.memory = SERVERMEM + vb.cpus = SERVERCPU + # 2nd virtual disk. + vb.storage :file, :size => REPOSIZE, + :path => REPODISK, + :allow_existing => true + end + # VM base and host name. + og.vm.box = "peru/ubuntu-18.04-server-amd64" + og.vm.hostname = "ogAdministrator" + # Network configuration: forward web port and attach new interface to VMs private network. + og.vm.network :forwarded_port, guest: 443, host: LOCALWEBPORT, host_ip: "127.0.0.1" + og.vm.network :private_network, + :libvirt__network_name => "virtualLab0", + :mac => "#{MACPREFIX}10".tr(":",""), + :ip => "#{SERVERIP}", + :libvirt__dhcp_enabled => false, + :libvirt__forward_mode => "none" + # Comment out to disable synced folder. + #og.vm.synced_folder ".", "/vagrant", disabled: true + # Launch provisioning script. + og.vm.provision "shell", inline: OGSERVERSCRIPT + end + + # Client 1 VM definition. + config.vm.define "pc11", autostart: false do |v1| + v1.vm.box = "peru/ubuntu-18.04-server-amd64" + v1.vm.synced_folder ".", "/vagrant", disabled: true + v1.ssh.insert_key = false + v1.vm.boot_timeout = 5 + v1.vm.network :private_network, + :libvirt__network_name => "virtualLab0", + :libvirt__forward_mode => "none", + :libvirt__dhcp_enabled => false, + :mac => "#{MACPREFIX}11".tr(":","") + v1.vm.provider "libvirt" do |vb| + vb.cpu_mode = 'host-passthrough' + vb.memory = CLIENTMEM + vb.cpus = CLIENTCPU + boot_network = {'network' => "vagrant_libvirt"} + vb.boot boot_network + end + v1.vm.provision "shell", inline: MODELSCRIPT + end + + # Clonable clients definition. + (2..NCLIENTS).each do |i| + config.vm.define "pc#{i+10}", autostart: false do |cl| + cl.vm.synced_folder ".", "/vagrant", disabled: true + cl.ssh.insert_key = false + cl.vm.boot_timeout = 5 + cl.vm.network :private_network, + :libvirt__network_name => "virtualLab0", + :libvirt__forward_mode => "none", + :libvirt__dhcp_enabled => false, + :mac => "#{MACPREFIX}#{i+10}".tr(":","") + cl.vm.provider :libvirt do |vb| + vb.storage :file, :size => '100G', :type => 'qcow2' + vb.memory = CLIENTMEM + vb.cpus = CLIENTCPU + boot_network = {'network' => "virtualLab0"} + vb.boot boot_network + end + cl.vm.post_up_message = "- After now, use virt-manager GUI to disable network interface 1 and restart this VM." + end + end +end diff --git a/installer/vagrant/Vagrantfile-prod-vbox b/installer/vagrant/Vagrantfile-prod-vbox index 0d1bf07b..86bd3055 120000 --- a/installer/vagrant/Vagrantfile-prod-vbox +++ b/installer/vagrant/Vagrantfile-prod-vbox @@ -1 +1 @@ -Vagrantfile-1.1.1c-vbox
\ No newline at end of file +Vagrantfile-1.2.0-vbox
\ No newline at end of file |