From c870c844e42cbd68b4f277b3f6e686f4c69b8fc4 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Thu, 17 May 2018 13:54:59 +0200 Subject: #834: Eliminar algunos espacios sobreantes y saltos de línea tipo CRLF. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/ogAdmServer/sources/ogAdmServer.cpp | 4 +- .../WebConsole/asistentes/jscripts/CrearImagen.js | 10 +- .../asistentes/jscripts/IniciarSesion.js | 9 +- .../asistentes/jscripts/InventarioSoftware.js | 4 +- admin/WebConsole/barramenu.php | 8 +- admin/WebConsole/clases/AdoPhp.php | 2 +- admin/WebConsole/clases/jscripts/ArbolVistaXML.js | 16 +- admin/WebConsole/comandos/EliminarImagenCache.php | 21 +- admin/WebConsole/estilos.css | 10 +- admin/WebConsole/gestores/gestor_aulas.php | 2 +- .../gestores/gestor_ejecutaracciones.php | 620 ++++++++++----------- .../javascripts/eng/propiedades_aulas_eng.js | 2 +- admin/WebConsole/images/M_Iconos.js | 169 +++--- 13 files changed, 438 insertions(+), 439 deletions(-) diff --git a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp index 7414c64c..4aa68441 100644 --- a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp +++ b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp @@ -2492,8 +2492,8 @@ BOOLEAN actualizaRestauracionImagen(Database db, Table tbl, char* idi, snprintf(sqlstr, LONSQL, "UPDATE ordenadores_particiones" " SET idimagen=%s, idperfilsoft=%s, fechadespliegue=NOW()," - " revision=(SELECT revision FROM imagenes WHERE idimagen=%s)," - " idnombreso=IFNULL((SELECT idnombreso FROM perfilessoft WHERE idperfilsoft=%s),0)" + " revision=(SELECT revision FROM imagenes WHERE idimagen=%s)," + " idnombreso=IFNULL((SELECT idnombreso FROM perfilessoft WHERE idperfilsoft=%s),0)" " WHERE idordenador=%s AND numdisk=%s AND numpar=%s", idi, ifs, idi, ifs, ido, dsk, par); if (!db.Execute(sqlstr, tbl)) { // Error al recuperar los datos diff --git a/admin/WebConsole/asistentes/jscripts/CrearImagen.js b/admin/WebConsole/asistentes/jscripts/CrearImagen.js index fcbe1804..0f63a69d 100644 --- a/admin/WebConsole/asistentes/jscripts/CrearImagen.js +++ b/admin/WebConsole/asistentes/jscripts/CrearImagen.js @@ -55,15 +55,15 @@ despleimagen=document.getElementById("despleimagen_"+particion); var p=despleimagen.selectedIndex; if (p==0){ - alert(TbMsg[0]); - despleimagen.focus(); - return(false) + alert(TbMsg[0]); + despleimagen.focus(); + return(false) } } } if(op==0){ - alert(TbMsg[1]); - return(false); + alert(TbMsg[1]); + return(false); } return(comprobar_datosejecucion()) } diff --git a/admin/WebConsole/asistentes/jscripts/IniciarSesion.js b/admin/WebConsole/asistentes/jscripts/IniciarSesion.js index 8e30da51..59ea71e2 100644 --- a/admin/WebConsole/asistentes/jscripts/IniciarSesion.js +++ b/admin/WebConsole/asistentes/jscripts/IniciarSesion.js @@ -22,7 +22,7 @@ function confirmar(){ document.fdatosejecucion.atributos.value="par="+particion+RC; document.fdatosejecucion.submit(); } - } + } //________________________________________________________________________________________________________ function cancelar() { @@ -36,11 +36,12 @@ function confirmar(){ var ochecks=tb_conf.getElementsByTagName('INPUT'); var op=0; for(var i=0;i - +     - +     @@ -202,11 +202,11 @@ if (!$cmd)     - + - + diff --git a/admin/WebConsole/clases/AdoPhp.php b/admin/WebConsole/clases/AdoPhp.php index 0b257c4f..4265911c 100644 --- a/admin/WebConsole/clases/AdoPhp.php +++ b/admin/WebConsole/clases/AdoPhp.php @@ -447,7 +447,7 @@ class Comando{ return(true); } /* ------------------------------------------------------------------------------------------- - Esta funci� recupera el ltimo nmero asignado a una clave autonum�ica de una tabla + Esta función recupera el ltimo nmero asignado a una clave autonum�ica de una tabla ---------------------------------------------------------------------------------------------*/ function Autonumerico(){ $ulreg=mysqli_insert_id($this->Conexion->controlador); diff --git a/admin/WebConsole/clases/jscripts/ArbolVistaXML.js b/admin/WebConsole/clases/jscripts/ArbolVistaXML.js index 3ddbeb2b..f4d84ba1 100644 --- a/admin/WebConsole/clases/jscripts/ArbolVistaXML.js +++ b/admin/WebConsole/clases/jscripts/ArbolVistaXML.js @@ -78,7 +78,7 @@ var gLiteralbackground; // Fondo color nodo vista para restablecer //____________________________________________________________________________ this.pone_infonodo= function(lit){ this.literal.innerHTML=lit; - }; + }; //____________________________________________________________________________ // // Devuelve el segundo dato de una cadena con formato xxxxx-xxx que es id del nodo vista @@ -88,7 +88,7 @@ var gLiteralbackground; // Fondo color nodo vista para restablecer if(this.literal==null) return(null); var atributo=this.literal.getAttribute(atr); return(atributo); - }; + }; //____________________________________________________________________________ // // Devuelve true si el nodo tiene hijos,false en caso contrario @@ -140,9 +140,9 @@ var gLiteralbackground; // Fondo color nodo vista para restablecer o=o.parentNode; nodo.Nodo=o; - while(o.tagName!="TABLE" ) + while(o.tagName!="TABLE") o=o.parentNode; - var Mnivel=o.getAttribute("id").split("-"); + var Mnivel=o.getAttribute("id").split("-"); nodo.nivel=Mnivel[1]; while(o.tagName!="TR" ) @@ -243,7 +243,7 @@ function clickLiteralNodo(oLIT,pathimg){ currentpathimg=pathimg; } var signoimg=nodov.imgsigno.getAttribute("value"); - var signo=signoimg.split("_"); + var signo=signoimg.split("_"); if(botonraton==1){ if (signo[0]=="mas" || signo[0]=="menos" ) clickNodo(nodov,pathimg); } @@ -374,13 +374,13 @@ function CreaCeldaVista(nodov,tablanodo){ var nodoTBODYTR=nodoTBODY.childNodes[0]; var oIMG=nodoTBODYTR.getElementsByTagName('IMG')[0]; var HTMLinner=nodoTBODYTR.innerHTML; - + if(nodov.TieneHijos()){ - var patron = new RegExp("nada_c","gi"); + var patron = new RegExp("nada_c","gi"); HTMLinner=HTMLinner.replace(patron,"nada_t"); } else{ - var patron = new RegExp("nada_t","gi"); + var patron = new RegExp("nada_t","gi"); HTMLinner=HTMLinner.replace(patron,"nada_c"); } var auxnodo=nodov; diff --git a/admin/WebConsole/comandos/EliminarImagenCache.php b/admin/WebConsole/comandos/EliminarImagenCache.php index 3c08fc69..a49f6eac 100644 --- a/admin/WebConsole/comandos/EliminarImagenCache.php +++ b/admin/WebConsole/comandos/EliminarImagenCache.php @@ -239,26 +239,25 @@ function TomaPropiedades($cmd,$idambito) $ordenadores=$rs->campos["numordenadores"]; $idmenu=$rs->campos["idmenus"]; - if(count(explode(",",$idmenu))>1) $idmenu=0; + if(count(explode(",",$idmenu))>1) $idmenu=0; $idrepositorio=$rs->campos["idrepositorios"]; - if(count(explode(",",$idrepositorio))>1) $idrepositorio=0; - $idperfilhard=$rs->campos["idperfileshard"]; - if(count(explode(",",$idperfilhard))>1) $idperfilhard=0; - $cache=$rs->campos["caches"]; - if(count(explode(",",$cache))>1) $cache=0; + if(count(explode(",",$idrepositorio))>1) $idrepositorio=0; + $idperfilhard=$rs->campos["idperfileshard"]; + if(count(explode(",",$idperfilhard))>1) $idperfilhard=0; + $cache=$rs->campos["caches"]; + if(count(explode(",",$cache))>1) $cache=0; $idmenu=$rs->campos["idmenus"]; - if(count(explode(",",$idmenu))>1) $idmenu=0; + if(count(explode(",",$idmenu))>1) $idmenu=0; $idprocedimiento=$rs->campos["idprocedimientos"]; - if(count(explode(",",$idprocedimiento))>1) $idprocedimiento=0; - + if(count(explode(",",$idprocedimiento))>1) $idprocedimiento=0; + $gidmenu=$idmenu; $gidprocedimiento=$idprocedimiento; $gidrepositorio=$idrepositorio; $gidperfilhard=$idperfilhard; $gcache=$cache; - + $rs->Cerrar(); - return(true); } return(false); diff --git a/admin/WebConsole/estilos.css b/admin/WebConsole/estilos.css index ff5e36c2..4b37be1f 100644 --- a/admin/WebConsole/estilos.css +++ b/admin/WebConsole/estilos.css @@ -236,8 +236,8 @@ FONT-FAMILY: Arial, Helvetica, sans-serif; FONT-SIZE: 12px; FONT-WEIGHT: 500; - BORDER-BOTTOM:#4f4f4f 1px solid; - BORDER-RIGHT:#4f4f4f 1px solid; + BORDER-BOTTOM:#4f4f4f 1px solid; + BORDER-RIGHT:#4f4f4f 1px solid; } .tabla_listados_sin TD{ @@ -391,7 +391,7 @@ A.tabla_listados_sin:link{ } .tablaprogramacion TD{ - FONT-SIZE: 9pt; + FONT-SIZE: 9pt; FONT-FAMILY: Arial, Helvetica, sans-serif; COLOR: #000000; } @@ -401,7 +401,7 @@ A.tabla_listados_sin:link{ border-right-color: #666666; border-bottom-color: #666666; BACKGROUND-COLOR: #EEEECC; - FONT-SIZE: 9pt; + FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: Arial, Helvetica, sans-serif; } @@ -415,7 +415,7 @@ A.tabla_listados_sin:link{ FONT-FAMILY: Arial, Helvetica, sans-serif; FONT-SIZE: 11px; FONT-WEIGHT: 500; - BORDER-BOTTOM:#000000 1px solid ; + BORDER-BOTTOM:#000000 1px solid; } .tabla_accesos TD{ diff --git a/admin/WebConsole/gestores/gestor_aulas.php b/admin/WebConsole/gestores/gestor_aulas.php index b5625379..e947edb2 100644 --- a/admin/WebConsole/gestores/gestor_aulas.php +++ b/admin/WebConsole/gestores/gestor_aulas.php @@ -276,7 +276,7 @@ INSERT INTO aulas (idcentro, grupoid, nombreaula, urlfoto, inremotepc, cagnon, pizarra, ubicacion, comentarios, puestos, horaresevini, horaresevfin, router, netmask, ntp, dns, proxy, modomul, ipmul, pormul, velmul, modp2p, - timep2p, validacion, paginalogin, paginavalidacion, oglivedir) + timep2p, validacion, paginalogin, paginavalidacion, oglivedir) VALUES (@idcentro, @grupoid, @nombreaula, @urlfoto, @inremotepc, @cagnon, @pizarra, @ubicacion, @comentarios, @puestos, @horaresevini, @horaresevfin, @router, @netmask, @ntp, @dns, @proxy, @modomul, @ipmul, @pormul, @velmul, @modp2p, diff --git a/admin/WebConsole/gestores/gestor_ejecutaracciones.php b/admin/WebConsole/gestores/gestor_ejecutaracciones.php index bf86d9e1..40672678 100644 --- a/admin/WebConsole/gestores/gestor_ejecutaracciones.php +++ b/admin/WebConsole/gestores/gestor_ejecutaracciones.php @@ -1,310 +1,310 @@ -CreaParametro("@tipoaccion",$opcion,1); - $cmd->CreaParametro("@idtipoaccion",0,1); - $cmd->CreaParametro("@descriaccion","",0); - $cmd->CreaParametro("@idordenador",0,1); - $cmd->CreaParametro("@ip","",0); - $cmd->CreaParametro("@sesion",$sesion,1); - $cmd->CreaParametro("@idcomando",0,1); - $cmd->CreaParametro("@parametros","",0); - $cmd->CreaParametro("@fechahorareg","",0); - $cmd->CreaParametro("@fechahorafin","",0); - $cmd->CreaParametro("@estado",$ACCION_INICIADA,1); - $cmd->CreaParametro("@resultado",$ACCION_SINRESULTADO,1); - $cmd->CreaParametro("@descrinotificacion","",0); - $cmd->CreaParametro("@idprocedimiento",0,1); - $cmd->CreaParametro("@idtarea",0,1); - $cmd->CreaParametro("@idcentro",$idcentro,1); - $cmd->CreaParametro("@ambito",0,1); - $cmd->CreaParametro("@idambito",0,1); - $cmd->CreaParametro("@restrambito","",0); - } - switch($opcion){ - case $EJECUCION_AUTOEXEC: - $resul=actualizaAutoexec($idprocedimiento); - $literal="resultado_gestion_procedimiento"; - break; - case $EJECUCION_PROCEDIMIENTO: - $cmd->ParamSetValor("@idtipoaccion",$idprocedimiento); - $cmd->ParamSetValor("@descriaccion",$descriprocedimiento); - $resul=ejecucionProcedimiento($idprocedimiento,$ambito,$idambito); - $literal="resultado_gestion_procedimiento"; - break; - case $EJECUCION_TAREA: - $cmd->ParamSetValor("@idtipoaccion",$idtarea); - $cmd->ParamSetValor("@descriaccion",$descritarea); - $cmd->ParamSetValor("@idtarea",$idtarea); - $resul=ejecucionTarea($idtarea); - $literal="resultado_ejecutar_tareas"; - break; - } - $cmd->Conexion->Cerrar(); -} -if ($resul){ - if(empty($swc)){ - echo $literal."(1,'".$cmd->DescripUltimoError()."');".chr(13); - } - else{ - echo ''; - } -} -else{ - if(empty($swc)){ - echo $literal."(0,'".$cmd->DescripUltimoError()."')"; - } - else{ - echo ''; - } -} -//******************************************************************************************************** -// -// Incorpora un procedimiento como autoexec -//________________________________________________________________________________________________________ -function actualizaAutoexec($idprocedimiento) -{ - global $cadenaid; - global $cmd; - - $cmd->texto="UPDATE ordenadores SET idproautoexec=".$idprocedimiento." WHERE idordenador IN (".$cadenaid.")"; - $resul=$cmd->Ejecutar(); - return(resul); -} -//________________________________________recorreProcedimientos________________________________________________________________ -// -// Ejecuta un procedimiento: lo registra en acciones y lo envía por la red -//________________________________________________________________________________________________________ -function ejecucionProcedimiento($idprocedimiento,$ambito,$idambito) -{ - return(recorreProcedimientos($idprocedimiento,$ambito,$idambito)); -} -//________________________________________________________________________________________________________ -// -// Ejecuta una tarea: la registra en acciones y la envía por la red -//________________________________________________________________________________________________________ -function ejecucionTarea($idtarea) -{ - return(recorreTareas($idtarea)); -} -//________________________________________________________________________________________________________ -function recorreProcedimientos($idprocedimiento,$ambito,$idambito) -{ - global $cmd; - global $sesion; - - $cmd->texto="SELECT idcomando,procedimientoid,parametros - FROM procedimientos_acciones - WHERE idprocedimiento=".$idprocedimiento." - ORDER BY orden"; - - $rs=new Recordset; - $rs->Comando=&$cmd; - if (!$rs->Abrir()) return(false); // Error al abrir recordset - while (!$rs->EOF){ - $procedimientoid=$rs->campos["procedimientoid"]; - if($procedimientoid>0){ // Procedimiento recursivo - if(!recorreProcedimientos($procedimientoid,$ambito,$idambito)){ - return(false); - } - } - else{ - $parametros=$rs->campos["parametros"]; - $idcomando=$rs->campos["idcomando"]; - // Ticket 681: bucle infinito en procedimiento compuesto (J.M. Alonso). - do{ - $nwsesion=time(); - }while($sesion==$nwsesion); - $sesion=$nwsesion; - $cmd->ParamSetValor("@sesion",$sesion); - // Fin ticket 681. - if(!insertaComando($idcomando,$parametros,$idprocedimiento,$ambito,$idambito)) - return(false); - } - $rs->Siguiente(); - } - return(true); -} -//________________________________________________________________________________________________________ -function recorreTareas($idtarea) -{ - global $cadenaid; - global $cadenaip; - global $cadenamac; - global $cmd; - - $cmd->texto="SELECT tareas_acciones.orden,tareas_acciones.idprocedimiento,tareas_acciones.tareaid, - tareas.ambito,tareas.idambito,tareas.restrambito - FROM tareas - INNER JOIN tareas_acciones ON tareas_acciones.idtarea=tareas.idtarea - WHERE tareas_acciones.idtarea=".$idtarea." - ORDER BY tareas_acciones.orden"; - //echo $cmd->texto; - $rs=new Recordset; - $rs->Comando=&$cmd; - if (!$rs->Abrir()) return(false); // Error al abrir recordset - while (!$rs->EOF){ - $tareaid=$rs->campos["tareaid"]; - if($tareaid>0){ // Tarea recursiva - if(!recorreTareas($tareaid)){ - return(false); - } - } - else{ - $ambito=$rs->campos["ambito"]; - $idambito=$rs->campos["idambito"]; - if($ambito==0 && $idambito==0){ // Ámbito restringido - $idambito=$rs->campos["restrambito"]; - } - RecopilaIpesMacs($cmd,$ambito,$idambito); // Recopila Ipes del ámbito - $idprocedimiento=$rs->campos["idprocedimiento"]; - if(!recorreProcedimientos($idprocedimiento,$ambito,$idambito)) - return(false); - } - $rs->Siguiente(); - } - return(true); -} -//________________________________________________________________________________________________________ -// -// Registra un procedimiento para un ambito concreto -//________________________________________________________________________________________________________ -function insertaComando($idcomando,$parametros,$idprocedimiento,$ambito,$idambito) -{ - global $cadenaid; - global $cadenaip; - global $cmd; - global $sesion; - global $vez; - - if($ambito==0){ // Ambito restringido a un subconjuto de ordenadores con formato (idordenador1,idordenador2,etc) - $cmd->ParamSetValor("@restrambito",$idambito); - $idambito=0; - } - - $cmd->ParamSetValor("@idcomando",$idcomando); - $cmd->ParamSetValor("@idprocedimiento",$idprocedimiento); - $cmd->ParamSetValor("@parametros",$parametros); - $cmd->ParamSetValor("@fechahorareg",date("y/m/d H:i:s")); - $cmd->ParamSetValor("@ambito",$ambito); - $cmd->ParamSetValor("@idambito",$idambito); - - if(strlen($cadenaip)==0) return(true); - - $auxID=explode(",",$cadenaid); - $auxIP=explode(";",$cadenaip); - - for ($i=0;$iParamSetValor("@idordenador",$auxID[$i]); - $cmd->ParamSetValor("@ip",$auxIP[$i]); - $cmd->texto="INSERT INTO acciones (idordenador,tipoaccion,idtipoaccion,descriaccion,ip,sesion,idcomando,parametros,fechahorareg,estado,resultado,ambito,idambito,restrambito,idprocedimiento,idtarea,idcentro) - VALUES (@idordenador,@tipoaccion,@idtipoaccion,@descriaccion,@ip,@sesion,@idcomando,@parametros,@fechahorareg,@estado,@resultado,@ambito,@idambito,@restrambito,@idprocedimiento,@idtarea,@idcentro)"; - $resul=$cmd->Ejecutar(); - //echo $cmd->texto; - if(!$resul) return(false); - - /* Sólo envía por la red el primer comando, el resto, si hubiera, - lo encontrará el cliente a través de los comandos pendientes */ - if(empty($vez)){ - if(!enviaComando($parametros,$sesion)) return(false); - $vez++; - } - } - return(true); -} -//________________________________________________________________________________________________________ -// -// Envia un procedimiento a un grupo de ordenadores a través de la red -//________________________________________________________________________________________________________ -function enviaComando($parametros,$sesion) -{ - global $cadenaid; - global $cadenaip; - global $cadenamac; - global $servidorhidra; - global $hidraport; - global $LONCABECERA; - global $shidra; - - // Envio al servidor - - $aplicacion=chr(13)."ido=".$cadenaid.chr(13)."mac=".$cadenamac.chr(13)."iph=".$cadenaip.chr(13); - $acciones=chr(13)."ids=".$sesion.chr(13); // Para seguimiento - - if ($shidra->conectar()){ // Se ha establecido la conexión con el servidor hidra - $parametros.=$aplicacion; - $parametros.=$acciones; - $shidra->envia_comando($parametros); - $trama=$shidra->recibe_respuesta(); - $shidra->desconectar(); - } - return(true); -} -?> - +CreaParametro("@tipoaccion",$opcion,1); + $cmd->CreaParametro("@idtipoaccion",0,1); + $cmd->CreaParametro("@descriaccion","",0); + $cmd->CreaParametro("@idordenador",0,1); + $cmd->CreaParametro("@ip","",0); + $cmd->CreaParametro("@sesion",$sesion,1); + $cmd->CreaParametro("@idcomando",0,1); + $cmd->CreaParametro("@parametros","",0); + $cmd->CreaParametro("@fechahorareg","",0); + $cmd->CreaParametro("@fechahorafin","",0); + $cmd->CreaParametro("@estado",$ACCION_INICIADA,1); + $cmd->CreaParametro("@resultado",$ACCION_SINRESULTADO,1); + $cmd->CreaParametro("@descrinotificacion","",0); + $cmd->CreaParametro("@idprocedimiento",0,1); + $cmd->CreaParametro("@idtarea",0,1); + $cmd->CreaParametro("@idcentro",$idcentro,1); + $cmd->CreaParametro("@ambito",0,1); + $cmd->CreaParametro("@idambito",0,1); + $cmd->CreaParametro("@restrambito","",0); + } + switch($opcion){ + case $EJECUCION_AUTOEXEC: + $resul=actualizaAutoexec($idprocedimiento); + $literal="resultado_gestion_procedimiento"; + break; + case $EJECUCION_PROCEDIMIENTO: + $cmd->ParamSetValor("@idtipoaccion",$idprocedimiento); + $cmd->ParamSetValor("@descriaccion",$descriprocedimiento); + $resul=ejecucionProcedimiento($idprocedimiento,$ambito,$idambito); + $literal="resultado_gestion_procedimiento"; + break; + case $EJECUCION_TAREA: + $cmd->ParamSetValor("@idtipoaccion",$idtarea); + $cmd->ParamSetValor("@descriaccion",$descritarea); + $cmd->ParamSetValor("@idtarea",$idtarea); + $resul=ejecucionTarea($idtarea); + $literal="resultado_ejecutar_tareas"; + break; + } + $cmd->Conexion->Cerrar(); +} +if ($resul){ + if(empty($swc)){ + echo $literal."(1,'".$cmd->DescripUltimoError()."');".chr(13); + } + else{ + echo ''; + } +} +else{ + if(empty($swc)){ + echo $literal."(0,'".$cmd->DescripUltimoError()."')"; + } + else{ + echo ''; + } +} +//******************************************************************************************************** +// +// Incorpora un procedimiento como autoexec +//________________________________________________________________________________________________________ +function actualizaAutoexec($idprocedimiento) +{ + global $cadenaid; + global $cmd; + + $cmd->texto="UPDATE ordenadores SET idproautoexec=".$idprocedimiento." WHERE idordenador IN (".$cadenaid.")"; + $resul=$cmd->Ejecutar(); + return(resul); +} +//________________________________________recorreProcedimientos________________________________________________________________ +// +// Ejecuta un procedimiento: lo registra en acciones y lo envía por la red +//________________________________________________________________________________________________________ +function ejecucionProcedimiento($idprocedimiento,$ambito,$idambito) +{ + return(recorreProcedimientos($idprocedimiento,$ambito,$idambito)); +} +//________________________________________________________________________________________________________ +// +// Ejecuta una tarea: la registra en acciones y la envía por la red +//________________________________________________________________________________________________________ +function ejecucionTarea($idtarea) +{ + return(recorreTareas($idtarea)); +} +//________________________________________________________________________________________________________ +function recorreProcedimientos($idprocedimiento,$ambito,$idambito) +{ + global $cmd; + global $sesion; + + $cmd->texto="SELECT idcomando,procedimientoid,parametros + FROM procedimientos_acciones + WHERE idprocedimiento=".$idprocedimiento." + ORDER BY orden"; + + $rs=new Recordset; + $rs->Comando=&$cmd; + if (!$rs->Abrir()) return(false); // Error al abrir recordset + while (!$rs->EOF){ + $procedimientoid=$rs->campos["procedimientoid"]; + if($procedimientoid>0){ // Procedimiento recursivo + if(!recorreProcedimientos($procedimientoid,$ambito,$idambito)){ + return(false); + } + } + else{ + $parametros=$rs->campos["parametros"]; + $idcomando=$rs->campos["idcomando"]; + // Ticket 681: bucle infinito en procedimiento compuesto (J.M. Alonso). + do{ + $nwsesion=time(); + }while($sesion==$nwsesion); + $sesion=$nwsesion; + $cmd->ParamSetValor("@sesion",$sesion); + // Fin ticket 681. + if(!insertaComando($idcomando,$parametros,$idprocedimiento,$ambito,$idambito)) + return(false); + } + $rs->Siguiente(); + } + return(true); +} +//________________________________________________________________________________________________________ +function recorreTareas($idtarea) +{ + global $cadenaid; + global $cadenaip; + global $cadenamac; + global $cmd; + + $cmd->texto="SELECT tareas_acciones.orden,tareas_acciones.idprocedimiento,tareas_acciones.tareaid, + tareas.ambito,tareas.idambito,tareas.restrambito + FROM tareas + INNER JOIN tareas_acciones ON tareas_acciones.idtarea=tareas.idtarea + WHERE tareas_acciones.idtarea=".$idtarea." + ORDER BY tareas_acciones.orden"; + //echo $cmd->texto; + $rs=new Recordset; + $rs->Comando=&$cmd; + if (!$rs->Abrir()) return(false); // Error al abrir recordset + while (!$rs->EOF){ + $tareaid=$rs->campos["tareaid"]; + if($tareaid>0){ // Tarea recursiva + if(!recorreTareas($tareaid)){ + return(false); + } + } + else{ + $ambito=$rs->campos["ambito"]; + $idambito=$rs->campos["idambito"]; + if($ambito==0 && $idambito==0){ // Ámbito restringido + $idambito=$rs->campos["restrambito"]; + } + RecopilaIpesMacs($cmd,$ambito,$idambito); // Recopila Ipes del ámbito + $idprocedimiento=$rs->campos["idprocedimiento"]; + if(!recorreProcedimientos($idprocedimiento,$ambito,$idambito)) + return(false); + } + $rs->Siguiente(); + } + return(true); +} +//________________________________________________________________________________________________________ +// +// Registra un procedimiento para un ambito concreto +//________________________________________________________________________________________________________ +function insertaComando($idcomando,$parametros,$idprocedimiento,$ambito,$idambito) +{ + global $cadenaid; + global $cadenaip; + global $cmd; + global $sesion; + global $vez; + + if($ambito==0){ // Ambito restringido a un subconjuto de ordenadores con formato (idordenador1,idordenador2,etc) + $cmd->ParamSetValor("@restrambito",$idambito); + $idambito=0; + } + + $cmd->ParamSetValor("@idcomando",$idcomando); + $cmd->ParamSetValor("@idprocedimiento",$idprocedimiento); + $cmd->ParamSetValor("@parametros",$parametros); + $cmd->ParamSetValor("@fechahorareg",date("y/m/d H:i:s")); + $cmd->ParamSetValor("@ambito",$ambito); + $cmd->ParamSetValor("@idambito",$idambito); + + if(strlen($cadenaip)==0) return(true); + + $auxID=explode(",",$cadenaid); + $auxIP=explode(";",$cadenaip); + + for ($i=0;$iParamSetValor("@idordenador",$auxID[$i]); + $cmd->ParamSetValor("@ip",$auxIP[$i]); + $cmd->texto="INSERT INTO acciones (idordenador,tipoaccion,idtipoaccion,descriaccion,ip,sesion,idcomando,parametros,fechahorareg,estado,resultado,ambito,idambito,restrambito,idprocedimiento,idtarea,idcentro) + VALUES (@idordenador,@tipoaccion,@idtipoaccion,@descriaccion,@ip,@sesion,@idcomando,@parametros,@fechahorareg,@estado,@resultado,@ambito,@idambito,@restrambito,@idprocedimiento,@idtarea,@idcentro)"; + $resul=$cmd->Ejecutar(); + //echo $cmd->texto; + if(!$resul) return(false); + + /* Sólo envía por la red el primer comando, el resto, si hubiera, + lo encontrará el cliente a través de los comandos pendientes */ + if(empty($vez)){ + if(!enviaComando($parametros,$sesion)) return(false); + $vez++; + } + } + return(true); +} +//________________________________________________________________________________________________________ +// +// Envia un procedimiento a un grupo de ordenadores a través de la red +//________________________________________________________________________________________________________ +function enviaComando($parametros,$sesion) +{ + global $cadenaid; + global $cadenaip; + global $cadenamac; + global $servidorhidra; + global $hidraport; + global $LONCABECERA; + global $shidra; + + // Envio al servidor + + $aplicacion=chr(13)."ido=".$cadenaid.chr(13)."mac=".$cadenamac.chr(13)."iph=".$cadenaip.chr(13); + $acciones=chr(13)."ids=".$sesion.chr(13); // Para seguimiento + + if ($shidra->conectar()){ // Se ha establecido la conexión con el servidor hidra + $parametros.=$aplicacion; + $parametros.=$acciones; + $shidra->envia_comando($parametros); + $trama=$shidra->recibe_respuesta(); + $shidra->desconectar(); + } + return(true); +} +?> + diff --git a/admin/WebConsole/idiomas/javascripts/eng/propiedades_aulas_eng.js b/admin/WebConsole/idiomas/javascripts/eng/propiedades_aulas_eng.js index 9c4dd3c5..82f9c0c1 100644 --- a/admin/WebConsole/idiomas/javascripts/eng/propiedades_aulas_eng.js +++ b/admin/WebConsole/idiomas/javascripts/eng/propiedades_aulas_eng.js @@ -1,7 +1,7 @@ //________________________________________________________________________________________________________ // // Fichero de idiomas javascript: propiedades_aulas_eng.js -// Idioma: Inglés +// Idioma: Inglés //________________________________________________________________________________________________________ TbMsg=new Array; TbMsg[0]="El nombre del aula debe contener caracteres alfanumericos"; diff --git a/admin/WebConsole/images/M_Iconos.js b/admin/WebConsole/images/M_Iconos.js index 122eefa3..975f689d 100644 --- a/admin/WebConsole/images/M_Iconos.js +++ b/admin/WebConsole/images/M_Iconos.js @@ -1,85 +1,84 @@ -// ********************************************************************************************************// Libreria de scripts de Javascript -// Autor: Jos� Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla -// Fecha Creaci�n: 2009-2010 -// Fecha �ltima modificaci�n: Noviembre-2005 -// Nombre del fichero:M_Iconos -// Descripci�n : -// Este fichero implementa las funciones javascript del fichero M_Iconos.php -// ******************************************************************************************************** -// Opciones -var Insertar=1; -var Eliminar=2; -var Modificar=3; -var Consultar=4; - -// Acciones -var Sin_accion=0; -var Insertar_registro=1; -var Borrar_registro=2; -var Modificar_registro=3; -var Leer_registro=4; - -var CurrentFecha=null; -//------------------------------------------------------------------------------------------------------------- -function menu(){ - w=window.parent; - w.location.href="../menu.php" -} -//------------------------------------------------------------------------------------------------------------- - function Editar(){ - document.fdatos.opcion.value=Modificar; - document.fdatos.accion.value=Leer_registro; - document.fdatos.submit() - } -//------------------------------------------------------------------------------------------------------------- - function Agregar() { - document.fdatos.opcion.value=Insertar; - document.fdatos.accion.value=Sin_accion; - document.fdatos.submit() - } -//------------------------------------------------------------------------------------------------------------- - function Borrar(){ - document.fdatos.opcion.value=Eliminar; - document.fdatos.accion.value=Leer_registro; - document.fdatos.submit() - } -//------------------------------------------------------------------------------------------------------------- - function Cancelar() { - document.fdatos.opcion.value=Insertar; - document.fdatos.accion.value=Sin_accion; - document.fdatos.idicono.value=0; - document.fdatos.submit() - } -//------------------------------------------------------------------------------------------------------------- -function Confirmar() { - var sw; - sw=parseInt(document.fdatos.opcion.value); - switch (sw) { - case Insertar : - if (comprobar_datos()){ - document.fdatos.accion.value=Insertar_registro; - document.fdatos.submit() - } - break; - case Eliminar : - document.fdatos.accion.value=Borrar_registro; - document.fdatos.submit(); - break; - case Modificar : - if (comprobar_datos()){ - document.fdatos.accion.value=Modificar_registro; - document.fdatos.submit() - } - break - } -} -//---------------------------------------------------------------------------------------------- -function comprobar_datos(){ - - if (document.fdatos.descripcion.value==""){ - alert(TbMsg["DESCRIP"]); - document.forms.fdatos.descripcion.focus(); - return(false) - } - return(true) -} +// ********************************************************************************************************// Libreria de scripts de Javascript +// Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla +// Fecha Creación: 2009-2010 +// Fecha última modificación: Noviembre-2005 +// Nombre del fichero:M_Iconos +// Descripción: +// Este fichero implementa las funciones javascript del fichero M_Iconos.php +// ******************************************************************************************************** +// Opciones +var Insertar=1; +var Eliminar=2; +var Modificar=3; +var Consultar=4; + +// Acciones +var Sin_accion=0; +var Insertar_registro=1; +var Borrar_registro=2; +var Modificar_registro=3; +var Leer_registro=4; + +var CurrentFecha=null; +//------------------------------------------------------------------------------------------------------------- +function menu(){ + w=window.parent; + w.location.href="../menu.php" +} +//------------------------------------------------------------------------------------------------------------- + function Editar(){ + document.fdatos.opcion.value=Modificar; + document.fdatos.accion.value=Leer_registro; + document.fdatos.submit() + } +//------------------------------------------------------------------------------------------------------------- + function Agregar() { + document.fdatos.opcion.value=Insertar; + document.fdatos.accion.value=Sin_accion; + document.fdatos.submit() + } +//------------------------------------------------------------------------------------------------------------- + function Borrar(){ + document.fdatos.opcion.value=Eliminar; + document.fdatos.accion.value=Leer_registro; + document.fdatos.submit() + } +//------------------------------------------------------------------------------------------------------------- + function Cancelar() { + document.fdatos.opcion.value=Insertar; + document.fdatos.accion.value=Sin_accion; + document.fdatos.idicono.value=0; + document.fdatos.submit() + } +//------------------------------------------------------------------------------------------------------------- +function Confirmar() { + var sw; + sw=parseInt(document.fdatos.opcion.value); + switch (sw) { + case Insertar : + if (comprobar_datos()){ + document.fdatos.accion.value=Insertar_registro; + document.fdatos.submit() + } + break; + case Eliminar : + document.fdatos.accion.value=Borrar_registro; + document.fdatos.submit(); + break; + case Modificar : + if (comprobar_datos()){ + document.fdatos.accion.value=Modificar_registro; + document.fdatos.submit() + } + break + } +} +//---------------------------------------------------------------------------------------------- +function comprobar_datos(){ + if (document.fdatos.descripcion.value==""){ + alert(TbMsg["DESCRIP"]); + document.forms.fdatos.descripcion.focus(); + return(false) + } + return(true) +} -- cgit v1.2.3-18-g5258 From ddb3298a85389c81e0360507ef128da26bab38d8 Mon Sep 17 00:00:00 2001 From: Fredy Date: Fri, 18 May 2018 12:15:51 +0200 Subject: New feature first commit --- server/lib/supportsave | 205 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100644 server/lib/supportsave diff --git a/server/lib/supportsave b/server/lib/supportsave new file mode 100644 index 00000000..9adff530 --- /dev/null +++ b/server/lib/supportsave @@ -0,0 +1,205 @@ +#!/bin/bash +######################################################################## +# # +# This script creates a tarball containing all logs and necesary files # +# in order to debug a remote system. Initially the tarball would be # +# manually sent by the final user to the support team. On a second # +# stage this support save would be inclued in the GUI. # +# # +# Autor: Fredy 2018 Q1 # +# # +######################################################################## + +# Basic structure +# Date, Hostname and Paths +# List of desired files to be saved +# Usefull system commands output to be saved (ie. uname -a > file.txt) +# Final compression + +PATH=/bin:/sbin:/usr/bin:/usr/sbin + +if [ "$(whoami)" != "root" ]; then + echo "ERROR: Need to be root." >&2 + exit 1 +fi + +tmp_name=`date +%Y%m%d_%H%M` +hostname=`hostname` +home_dir="/opt/opengnsys" +ss_dir="supportsave_${hostname}_${tmp_name}" +prefix="/tmp" + +if [ ! -d ${home_dir} ]; then + echo "ERROR: The OpenGnsys directory does not exist." >&2 + exit 1 +fi + +if [ -d "$1" ]; then + prefix=${1} +fi + +backup_dir="${prefix}/${ss_dir}" + +config_paths="${home_dir}/etc ${home_dir}/tftpboot/menu.lst ${home_dir}/client/etc ${home_dir}/log /etc/default/opengnsys" +other_paths="/var/log/syslog* /var/log/messages*" + +echo "Saving information for support in the path ${backup_dir}.tar.gz" +mkdir -p $backup_dir + + +echo "Saving system information:" +################################# + +echo "- System version" +if which lsb_release &>/dev/null; then + lsb_release -a >> $backup_dir/operating_system.txt 2>&1 +elif [ -r /etc/os-release ]; then + cat /etc/os-release >> $backup_dir/operating_system.txt 2>&1 +elif [ -r /etc/system-release ]; then + cat /etc/system-release >> $backup_dir/operating_system.txt 2>&1 +fi + +echo "- Hardware" +echo "--- hostname ---" >> $backup_dir/hardware.txt +hostname >> $backup_dir/hardware.txt 2>&1 +echo -e "\n--- dmidecode ---" >> $backup_dir/hardware.txt +dmidecode >> $backup_dir/hardware.txt 2>&1 +echo -e "\n--- lshw -short ---" >> $backup_dir/hardware.txt +lshw -short >> $backup_dir/hardware.txt 2>&1 +echo -e "\n--- lspci ---" >> $backup_dir/hardware.txt +lspci >> $backup_dir/hardware.txt 2>&1 +echo -e "\n--- lsusb ---" >> $backup_dir/hardware.txt +lsusb >> $backup_dir/hardware.txt 2>&1 + +echo "- Kernel" +echo "--- uname -a ---" >> $backup_dir/kernel.txt +uname -a >> $backup_dir/kernel.txt 2>&1 +echo -e "\n--- lsmod ---" >> $backup_dir/kernel.txt +lsmod >> $backup_dir/kernel.txt 2>&1 + +echo "- Packages" +if [ -f /etc/debian_version ]; then + echo "--- dpkg -l ---" >> $backup_dir/package_list.txt + dpkg -l >> $backup_dir/package_list.txt 2>&1 +elif [ -f /etc/redhat-release ]; then + echo "--- rpm -qa ---" >> $backup_dir/package_list.txt + rpm -qa | sort >> $backup_dir/package_list.txt 2>&1 +else + echo "- WARNING: The package list can not be retrieved" | tee $backup_dir/package_list.txt +fi + +echo "- Processes" +echo "ps aux" >> $backup_dir/ps.txt +ps aux >> $backup_dir/ps.txt 2>&1 + +echo "- Resources" +echo "--- Uptime information ---" >> $backup_dir/system_resources.txt +uptime >> $backup_dir/system_resources.txt 2>&1 +echo -e "\n--- Memory information ---" >> $backup_dir/system_resources.txt +free -m >> $backup_dir/system_resources.txt 2>&1 +echo -e "\n--- CPU information ---" >> $backup_dir/system_resources.txt +cat /proc/cpuinfo >> $backup_dir/system_resources.txt 2>&1 +echo -e "\n--- TOP information ---" >> $backup_dir/system_resources.txt +top -b -n1 >> $backup_dir/system_resources.txt 2>&1 + +echo "- Filesystems" +echo "--- cat /etc/fstab ---" >> $backup_dir/filesystems.txt +cat /etc/fstab >> $backup_dir/filesystems.txt 2>&1 +echo -e "\n--- df -h ---" >> $backup_dir/filesystems.txt +df -h >> $backup_dir/filesystems.txt 2>&1 +echo -e "\n--- blkid ---" >> $backup_dir/filesystems.txt +blkid >> $backup_dir/filesystems.txt 2>&1 +echo -e "\n--- lsblk -Jbp ---" >> $backup_dir/filesystems.txt +lsblk -Jbp >> $backup_dir/filesystems.txt 2>&1 + + +echo "Saving network information:" +################################## + +echo "- Interfaces" +ifconfig -a >> $backup_dir/ifconfig.txt 2>&1 +ip link show >> $backup_dir/ip_link.txt 2>&1 +ip addr show >> $backup_dir/ip_addr.txt 2>&1 + +echo "- Routes" +for i in `cat /etc/iproute2/rt_tables | grep "table_" | awk {'print $2'}` +do + echo "ip route list table $i" >> $backup_dir/route.txt + ip route list table $i >> $backup_dir/route.txt 2>&1 +done +echo "ip route list table main" >> $backup_dir/route.txt +ip route list table main >> $backup_dir/route.txt 2>&1 +echo "ip rule list" >> $backup_dir/route.txt +ip rule list >> $backup_dir/route.txt 2>&1 + +echo "- Sockets" +echo "netstat -putan" >> $backup_dir/netstat.txt +netstat -putan >> $backup_dir/netstat.txt 2>&1 +echo "netstat -nr" >> $backup_dir/netstat.txt +netstat -nr >> $backup_dir/netstat.txt 2>&1 + +echo "- Netfilter" +echo "Filter table " >> $backup_dir/netfilter.txt +iptables -nL -t filter >> $backup_dir/netfilter.txt 2>&1 +echo -e "\nNAT table " >> $backup_dir/netfilter.txt +iptables -nL -t nat >> $backup_dir/netfilter.txt 2>&1 +echo -e "\nMangle table " >> $backup_dir/netfilter.txt +iptables -nL -t mangle >> $backup_dir/netfilter.txt 2>&1 +echo -e "\nRaw table " >> $backup_dir/netfilter.txt +iptables -nL -t raw >> $backup_dir/netfilter.txt 2>&1 + +echo "- nf_conntrack" +if which conntrack &>/dev/null; then + conntrack -L >> $backup_dir/conntrack.txt 2>&1 +fi + +echo "- ipset" +if which ipset &>/dev/null; then + ipset save >> $backup_dir/ipset_tables.txt 2>&1 +fi + +echo "Saving OpenGnsys information:" +################################## + +echo "- OpenGnsys version" +#echo `dpkg -l | grep opengnsys\ | awk '{print $3}'` > $backup_dir/opengnsys_version +curl -ks --connect-timeout 10 https://localhost/opengnsys/rest/info | jq . > ${backup_dir}/opengnsys_version.txt 2>/dev/null +if [ ! -s ${backup_dir}/opengnsys_version.txt ]; then + cp -a ${home_dir}/doc/VERSION.txt ${backup_dir}/opengnsys_version.txt 2>&1 +fi + +echo "- Directory list" +ls -Ral ${home_dir} >> $backup_dir/opengnsys_files.txt 2>&1 + +if [ -r ${home_dir}/etc/ogAdmServer.cfg ]; then + echo "- Database schema" + source ${home_dir}/etc/ogAdmServer.cfg + mysqldump -u "$USUARIO" -p"$PASSWORD" -d "$CATALOG" >> ${backup_dir}/opengnsys_schema.sql 2>&1 +else + echo "- WARNING: The OpenGnsys database can not be accessed" | tee ${backup_dir}/db_schema.txt +fi + +echo "- Configuration and log files" +# Looking for huge log files (> 1 MB). +for log in $(find ${home_dir}/log -name "*.log" -size +1024 -print); do + # Copying last 5000 lines and excluding file. + tail -5000 ${log} > ${log}-tail5k 2>&1 + config_paths="$config_paths --exclude=${log}" +done +tar zcf ${backup_dir}/opengnsys_config.tar.gz ${config_paths} 2>/dev/null + +echo "Saving other files" +############################## +tar zcf ${backup_dir}/logs.tar.gz ${other_paths} 2>/dev/null + +echo "Packing supportsave" +########################## +cd ${prefix} +tar zcf ${ss_dir}.tar.gz ${ss_dir} 2>/dev/null +cd - >/dev/null + +echo "Cleaning temporal files" +########################## +rm -rf ${backup_dir} ${home_dir}/log/*-tail5k + +ls -lh ${backup_dir}.tar.gz -- cgit v1.2.3-18-g5258 From 5ed4db4af43589aa801891963fbde9b7c2d14804 Mon Sep 17 00:00:00 2001 From: Fredy Date: Fri, 18 May 2018 12:31:56 +0200 Subject: Added boot messages --- server/lib/supportsave | 3 +++ 1 file changed, 3 insertions(+) mode change 100644 => 100755 server/lib/supportsave diff --git a/server/lib/supportsave b/server/lib/supportsave old mode 100644 new mode 100755 index 9adff530..67da7ed2 --- a/server/lib/supportsave +++ b/server/lib/supportsave @@ -76,6 +76,9 @@ echo "--- uname -a ---" >> $backup_dir/kernel.txt uname -a >> $backup_dir/kernel.txt 2>&1 echo -e "\n--- lsmod ---" >> $backup_dir/kernel.txt lsmod >> $backup_dir/kernel.txt 2>&1 +echo "- Kernel boot messages" +echo "--- dmesg ---" >> $backup_dir/kernel.txt +dmesg >> $backup_dir/kernel.txt 2>&1 echo "- Packages" if [ -f /etc/debian_version ]; then -- cgit v1.2.3-18-g5258 From 9199fc761629d6ab0f117415f1052ba160ec0297 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Wed, 23 May 2018 14:48:04 +0200 Subject: #708: Corregir error en verificación de administrdor de UO. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + admin/WebConsole/rest/remotepc.php | 24 +++++------ admin/WebConsole/rest/server.php | 82 +++++++++++++++++++------------------- 3 files changed, 54 insertions(+), 53 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..485dee64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/admin/WebConsole/rest/remotepc.php b/admin/WebConsole/rest/remotepc.php index 39224636..4bf7b6b5 100644 --- a/admin/WebConsole/rest/remotepc.php +++ b/admin/WebConsole/rest/remotepc.php @@ -81,7 +81,7 @@ $app->post('/ous/:ouid/images/:imageid/reserve(/)', 'validateApiKey', writeRemotepcLog($app->request()->getResourceUri(). ": Parameters: labid=$labid, maxtime=$maxtime"); // Choose older not-reserved client with image installed and get ogAdmServer data. $cmd->texto = <<Abrir()) return(false); // Error opening recordset. // Check if user is admin and client exists. $rs->Primero(); - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idordenador"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idordenador"])) { // Read query data. $serverip = $rs->campos["ipserveradm"]; $serverport = $rs->campos["portserveradm"]; @@ -290,13 +290,13 @@ $app->post('/ous/:ouid/labs/:labid/clients/:clntid/events', 'validateApiKey', writeRemotepcLog($app->request()->getResourceUri(). ": Parameters: urlLogin=$urlLogin, urlLogout=$urlLogout"); // Select client data for UDS compatibility. $cmd->texto = <<Abrir()) return(false); // Error opening recordset. // Check if user is admin and client exists. $rs->Primero(); - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idordenador"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idordenador"])) { // Check if client is reserved. if (! is_null($rs->campos["reserved"])) { // Updating DB if client is reserved. @@ -381,12 +381,12 @@ $app->post('/ous/:ouid/labs/:labid/clients/:clntid/session', 'validateApiKey', writeRemotepcLog($app->request()->getResourceUri(). ": Parameters: deadLine=$deadLine"); // Get client's data. $cmd->texto = <<Abrir()) return(false); // Error opening recordset. // Check if user is admin and client exists. $rs->Primero(); - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idordenador"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idordenador"])) { // Check if client is reserved. if (! is_null($rs->campos["urllogin"])) { // Read query data. @@ -479,13 +479,13 @@ $app->delete('/ous/:ouid/labs/:labid/clients/:clntid/unreserve', 'validateApiKey // Select client data for UDS compatibility. $cmd->texto = <<Abrir()) return(false); // Error opening recordset. // Check if user is admin and client exists. $rs->Primero(); - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idordenador"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idordenador"])) { // Check if client is reserved. if (! is_null($rs->campos["reserved"])) { // Read query data. diff --git a/admin/WebConsole/rest/server.php b/admin/WebConsole/rest/server.php index 258b0160..1721411d 100644 --- a/admin/WebConsole/rest/server.php +++ b/admin/WebConsole/rest/server.php @@ -90,12 +90,12 @@ function getStatus($ouid, $labid, $clntid=0) { // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin and asset exists. - if (checkAdmin($rs->campos["idadministradorcentro"]) and (($single and checkParameter($rs->campos["idordenador"])) or (! $single and checkParameter($rs->campos["idaula"])))) { + if (checkAdmin($rs->campos["idusuario"]) and (($single and checkParameter($rs->campos["idordenador"])) or (! $single and checkParameter($rs->campos["idaula"])))) { // First, try to connect to ogAdmCleint service. $serverip = $rs->campos["ipserveradm"]; $serverport = $rs->campos["portserveradm"]; @@ -321,7 +321,7 @@ $app->get('/ous/:ouid(/)', 'validateApiKey', SELECT * FROM centros RIGHT JOIN administradores_centros USING(idcentro) - WHERE administradores_centros.idadministradorcentro = '$userid' + WHERE administradores_centros.idusuario = '$userid' AND centros.idcentro = '$ouid' LIMIT 1; EOD; @@ -329,7 +329,7 @@ EOD; $rs->Comando=&$cmd; if (!$rs->Abrir()) return(false); // Error oppening recordset. $rs->Primero(); - if (checkAdmin($rs->campos["idadministradorcentro"]) and + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idcentro"])) { $response['id'] = (int)$ouid; $response['name'] = $rs->campos["nombrecentro"]; @@ -353,10 +353,10 @@ $app->get('/ous/:ouid/groups(/)', 'validateApiKey', function($ouid) { $ouid = htmlspecialchars($ouid); // List group of labs if user is OU's admin. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin. - if (checkAdmin($rs->campos["idadministradorcentro"])) { + if (checkAdmin($rs->campos["idusuario"])) { $response = Array(); // Read data. if (! is_null($rs->campos["idcentro"])) { @@ -401,12 +401,12 @@ $app->get('/ous/:ouid/labs(/)', 'validateApiKey', $ouid = htmlspecialchars($ouid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error opening recordset. // Check if user is an UO admin. $rs->Primero(); - if (checkAdmin($rs->campos["idadministradorcentro"])) { + if (checkAdmin($rs->campos["idusuario"])) { $response = Array(); if (! is_null($rs->campos["idcentro"])) { while (!$rs->EOF) { @@ -478,11 +478,11 @@ $app->get('/ous/:ouid/labs/:labid(/)', 'validateApiKey', $labid = htmlspecialchars($labid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin and lab exists. - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idaula"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idaula"])) { $response['id'] = (int)$rs->campos["idaula"]; $response['name'] = $rs->campos["nombreaula"]; $response['location'] = $rs->campos["ubicacion"]; @@ -543,11 +543,11 @@ $app->get('/ous/:ouid/labs/:labid/clients(/)', 'validateApiKey', $labid = htmlspecialchars($labid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin and lab exists. - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["labid"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["labid"])) { $response = Array(); while (!$rs->EOF) { if (!is_null($rs->campos["idordenador"])) { @@ -604,12 +604,12 @@ $app->get('/ous/:ouid/labs/:labid/clients/:clntid(/)', 'validateApiKey', $clntid = htmlspecialchars($clntid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin, lab exists and client exists. - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idaula"]) and checkParameter($rs->campos["idordenador"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idaula"]) and checkParameter($rs->campos["idordenador"])) { // Read data. $response['id'] = (int)$rs->campos["idordenador"]; $response['name'] = $rs->campos["nombreordenador"]; @@ -661,7 +661,7 @@ $app->get('/ous/:ouid/labs/:labid/clients/:clntid/hardware(/)', 'validateApiKey' $clntid = htmlspecialchars($clntid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin and client exists. - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idordenador"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idordenador"])) { // Read data. $response['id'] = (int)$rs->campos["idordenador"]; $response['name'] = $rs->campos["nombreordenador"]; @@ -717,7 +717,7 @@ $app->get('/ous/:ouid/labs/:labid/clients/:clntid/diskcfg(/)', 'validateApiKey', $clntid = htmlspecialchars($clntid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin and client exists. - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["clientid"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["clientid"])) { // Read data. $response['id'] = (int)$rs->campos["clientid"]; $response['name'] = $rs->campos["nombreordenador"]; @@ -815,10 +815,10 @@ $app->get('/ous/:ouid/repos(/)', 'validateApiKey', $ouid = htmlspecialchars($ouid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin. - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["ouid"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["ouid"])) { $response = Array(); while (!$rs->EOF) { if (! is_null($rs->campos["idcentro"])) { @@ -860,10 +860,10 @@ $app->get('/ous/:ouid/repos/:repoid(/)', 'validateApiKey', $repoid = htmlspecialchars($repoid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin and repo exists. - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idrepositorio"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idrepositorio"])) { // Read data. $response['id'] = (int)$rs->campos["idrepositorio"]; $response['name'] = $rs->campos["nombrerepositorio"]; @@ -899,10 +899,10 @@ $app->get('/ous/:ouid/images(/)', 'validateApiKey', $ouid = htmlspecialchars($ouid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin. - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["ouid"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["ouid"])) { $response = Array(); while (!$rs->EOF) { if (! is_null($rs->campos["idcentro"])) { @@ -944,12 +944,12 @@ $app->get('/ous/:ouid/images/:imgid(/)', 'validateApiKey', $imgid = htmlspecialchars($imgid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin and repo exists. - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idimagen"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idimagen"])) { // Read data. $response['id'] = (int)$rs->campos["idimagen"]; $response['name'] = $rs->campos["nombreca"]; @@ -1007,7 +1007,7 @@ EOD; $imgid = htmlspecialchars($imgid); // Database query. $cmd->texto = <<Abrir()) return(false); // Error oppening recordset. $rs->Primero(); // Check if user is an UO admin and repo exists. - if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idimagen"])) { + if (checkAdmin($rs->campos["idusuario"]) and checkParameter($rs->campos["idimagen"])) { $response['id'] = (int)$rs->campos["idimagen"]; $response['name'] = $rs->campos["nombreca"]; if (is_null($rs->campos["nombreso"])) { -- cgit v1.2.3-18-g5258 From 884b6ce68e87a1693df1f150e4a4704d6aa833c2 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Thu, 24 May 2018 20:24:56 +0200 Subject: #840: Usar repositorio de GitHub en instalación y actualización. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/opengnsys_installer.sh | 39 +++++++++++----------- installer/opengnsys_update.sh | 71 +++++++++++++++++++++++----------------- 2 files changed, 61 insertions(+), 49 deletions(-) diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 76563275..6fe905dc 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -95,17 +95,19 @@ done echo -e "\\n==============================" -# Comprobar si se ha descargado el paquete comprimido (USESVN=0) o sólo el instalador (USESVN=1). +# Comprobar si se ha descargado el paquete comprimido (REMOTE=0) o sólo el instalador (REMOTE=1). PROGRAMDIR=$(readlink -e "$(dirname "$0")") PROGRAMNAME=$(basename "$0") OPENGNSYS_SERVER="opengnsys.es" DOWNLOADURL="https://$OPENGNSYS_SERVER/trac/downloads" if [ -d "$PROGRAMDIR/../installer" ]; then - USESVN=0 + REMOTE=0 else - USESVN=1 + REMOTE=1 fi -SVN_URL="https://$OPENGNSYS_SERVER/svn/branches/version1.1/" +BRANCH="devel" +CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" +API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" WORKDIR=/tmp/opengnsys_installer mkdir -p $WORKDIR @@ -167,7 +169,7 @@ OSVERSION="${OSVERSION%%.*}" # Configuración según la distribución GNU/Linux (usar minúsculas). case "$OSDISTRIB" in ubuntu|debian|linuxmint) - DEPENDENCIES=( subversion apache2 php php-ldap libapache2-mod-php mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget curl doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast shim-signed grub-efi-amd64-signed ) + DEPENDENCIES=( apache2 php php-ldap libapache2-mod-php mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget curl doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast shim-signed grub-efi-amd64-signed ) UPDATEPKGLIST="apt-get update" INSTALLPKG="apt-get -y install --force-yes" CHECKPKG="dpkg -s \$package 2>/dev/null | grep Status | grep -qw install" @@ -204,7 +206,7 @@ case "$OSDISTRIB" in TFTPCFGDIR=/var/lib/tftpboot ;; fedora|centos) - DEPENDENCIES=( subversion httpd mod_ssl php php-ldap mysql-server mysql-devel mysql-devel.i686 php-mysql dhcp tftp-server tftp xinetd binutils gcc gcc-c++ glibc-devel glibc-devel.i686 glibc-static glibc-static.i686 libstdc++-devel.i686 make wget curl doxygen graphviz ctorrent samba samba-client rsync unzip debootstrap schroot squashfs-tools python-crypto arp-scan procps-ng gettext moreutils jq net-tools http://ftp.altlinux.org/pub/distributions/ALTLinux/5.1/branch/$(arch)/RPMS.classic/netpipes-4.2-alt1.$(arch).rpm ) + DEPENDENCIES=( httpd mod_ssl php php-ldap mysql-server mysql-devel mysql-devel.i686 php-mysql dhcp tftp-server tftp xinetd binutils gcc gcc-c++ glibc-devel glibc-devel.i686 glibc-static glibc-static.i686 libstdc++-devel.i686 make wget curl doxygen graphviz ctorrent samba samba-client rsync unzip debootstrap schroot squashfs-tools python-crypto arp-scan procps-ng gettext moreutils jq net-tools http://ftp.altlinux.org/pub/distributions/ALTLinux/5.1/branch/$(arch)/RPMS.classic/netpipes-4.2-alt1.$(arch).rpm ) INSTALLEXTRADEPS=( 'pushd /tmp; wget -t3 http://download.bittornado.com/download/BitTornado-0.3.18.tar.gz && tar xvzf BitTornado-0.3.18.tar.gz && cd BitTornado-CVS && python setup.py install && ln -fs btlaunchmany.py /usr/bin/btlaunchmany && ln -fs bttrack.py /usr/bin/bttrack; popd' ) INSTALLPKG="yum install -y libstdc++ libstdc++.i686" CHECKPKG="rpm -q --quiet \$package" @@ -786,11 +788,11 @@ EOF ##################################################################### -####### Funciones para el manejo de Subversion +####### Funciones para la descarga de código ##################################################################### -# Obtiene el código fuente del proyecto desde el servidor SVN. -function svnExportCode() +# Obtiene el código fuente del proyecto desde el repositorio de GitHub. +function downloadCode() { if [ $# -ne 1 ]; then errorAndLog "${FUNCNAME}(): invalid number of parameters" @@ -799,14 +801,15 @@ function svnExportCode() local url="$1" - echoAndLog "${FUNCNAME}(): downloading subversion code..." + echoAndLog "${FUNCNAME}(): downloading code..." - svn export --force "$url" opengnsys + curl "${url}" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error getting OpenGnsys code from $url" return 1 fi - echoAndLog "${FUNCNAME}(): subversion code downloaded" + rm -f opengnsys.zip + echoAndLog "${FUNCNAME}(): code was downloaded" return 0 } @@ -1073,7 +1076,6 @@ function installWebFiles() errorAndLog "${FUNCNAME}(): Error copying web files." exit 1 fi - find $INSTALL_TARGET/www -name .svn -type d -exec rm -fr {} \; 2>/dev/null # Descomprimir librerías: Slim y Swagger-UI. unzip -o $WORKDIR/opengnsys/admin/$SLIMFILE -d $INSTALL_TARGET/www/rest @@ -1397,7 +1399,6 @@ function copyClientFiles() errorAndLog "${FUNCNAME}(): error while copying client estructure" errstatus=1 fi - find $INSTALL_TARGET/client -name .svn -type d -exec rm -fr {} \; 2>/dev/null echoAndLog "${FUNCNAME}(): Copying OpenGnsys Cloning Engine files." mkdir -p $INSTALL_TARGET/client/lib/engine/bin @@ -1557,8 +1558,8 @@ function installationSummary() [ -f $VERSIONFILE ] || echo "OpenGnsys Server" >$VERSIONFILE # Incluir datos de revisión, si se está instaladno desde el repositorio # de código o si no está incluida en el fichero de versión. - if [ $USESVN -eq 1 ] || [ -z "$(awk '$3~/r[0-9]*/ {print}' $VERSIONFILE)" ]; then - local REVISION=$(LANG=C svn info $SVN_URL|awk '/Rev:/ {print "r"$4}') + if [ $REMOTE -eq 1 ] || [ -z "$(awk '$3~/r[0-9]*/ {print}' $VERSIONFILE)" ]; then + local REVISION=$(curl -s "$API_URL" | jq -r ".commit.commit.committer.date" | awk '{gsub(/[^0-9]/,""); print}') sed -ri "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE fi @@ -1656,10 +1657,10 @@ if [ $? -ne 0 ]; then fi # Si es necesario, descarga el repositorio de código en directorio temporal -if [ $USESVN -eq 1 ]; then - svnExportCode $SVN_URL +if [ $REMOTE -eq 1 ]; then + downloadCode $CODE_URL if [ $? -ne 0 ]; then - errorAndLog "Error while getting code from svn" + errorAndLog "Error while getting code from the repository" exit 1 fi else diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index 212501db..63512336 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -64,16 +64,19 @@ if [ -z "$OPENGNSYS_DATABASE" -o -z "$OPENGNSYS_DBUSER" -o -z "$OPENGNSYS_DBPASS exit 1 fi -# Comprobar si se ha descargado el paquete comprimido (USESVN=0) o sólo el instalador (USESVN=1). +# Comprobar si se ha descargado el paquete comprimido (REMOTE=0) o sólo el instalador (REMOTE=1). PROGRAMDIR=$(readlink -e $(dirname "$0")) PROGRAMNAME=$(basename "$0") OPENGNSYS_SERVER="opengnsys.es" if [ -d "$PROGRAMDIR/../installer" ]; then - USESVN=0 + REMOTE=0 else - USESVN=1 + REMOTE=1 fi -SVN_URL="https://$OPENGNSYS_SERVER/svn/branches/version1.1/" +BRANCH="devel" +CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" +API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" +RAW_URL="https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH" WORKDIR=/tmp/opengnsys_update mkdir -p $WORKDIR @@ -113,7 +116,7 @@ function autoConfigure() # Configuración según la distribución de Linux. if [ -f /etc/debian_version ]; then - # Distribución basada en paquetes Deb. + # Distribución basada en paquetes Deb. DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast ) UPDATEPKGLIST="add-apt-repository -y ppa:ondrej/php; apt-get update" INSTALLPKGS="apt-get -y install" @@ -133,7 +136,7 @@ function autoConfigure() APACHEGROUP="www-data" INETDCFGDIR=/etc/xinetd.d elif [ -f /etc/redhat-release ]; then - # Distribución basada en paquetes rpm. + # Distribución basada en paquetes rpm. DEPENDENCIES=( curl rsync btrfs-progs procps-ng arp-scan gettext moreutils jq net-tools ) # En CentOS 7 instalar arp-scan de CentOS 6. [ "$OSDISTRIB$OSVERSION" == "centos7" ] && DEPENDENCIES=( ${DEPENDENCIES[*]/arp-scan/http://dag.wieers.com/redhat/el6/en/$(arch)/dag/RPMS/arp-scan-1.9-1.el6.rf.$(arch).rpm} ) @@ -174,8 +177,8 @@ function checkAutoUpdate() local update=0 # Actaulizar el script si ha cambiado o no existe el original. - if [ $USESVN -eq 1 ]; then - svn export $SVN_URL/installer/$PROGRAMNAME + if [ $REMOTE -eq 1 ]; then + curl -s $RAW_URL/installer/$PROGRAMNAME -o $PROGRAMNAME if ! diff -q $PROGRAMNAME $INSTALL_TARGET/lib/$PROGRAMNAME 2>/dev/null || ! test -f $INSTALL_TARGET/lib/$PROGRAMNAME; then mv $PROGRAMNAME $INSTALL_TARGET/lib update=1 @@ -394,10 +397,10 @@ function installDependencies() ##################################################################### -####### Funciones para el manejo de Subversion +####### Funciones para descargar código ##################################################################### -function svnExportCode() +function downloadCode() { if [ $# -ne 1 ]; then errorAndLog "${FUNCNAME}(): invalid number of parameters" @@ -406,14 +409,15 @@ function svnExportCode() local url="$1" - echoAndLog "${FUNCNAME}(): downloading subversion code..." + echoAndLog "${FUNCNAME}(): downloading code..." - svn checkout "${url}" opengnsys + curl "${url}" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error getting code from ${url}, verify your user and password" return 1 fi - echoAndLog "${FUNCNAME}(): subversion code downloaded" + rm -f opengnsys.zip + echoAndLog "${FUNCNAME}(): code was downloaded" return 0 } @@ -426,7 +430,14 @@ function svnExportCode() function checkNetworkConnection() { OPENGNSYS_SERVER=${OPENGNSYS_SERVER:-"opengnsys.es"} - wget --spider -q $OPENGNSYS_SERVER + if which curl &>/dev/null; then + curl --connect-timeout 10 -s $OPENGNSYS_SERVER -o /dev/null + elif which wget &>/dev/null; then + wget --spider -q $OPENGNSYS_SERVER + else + echoAndLog "${FUNCNAME}(): Cannot execute \"wget\" nor \"curl\"." + return 1 + fi } # Comprobar si la versión es anterior a la actual. @@ -436,8 +447,8 @@ function checkVersion() # Obtener versión actual y versión a actualizar. OLDVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt 2>/dev/null) - if [ $USESVN -eq 1 ]; then - NEWVERSION=$(curl -s $SVN_URL/doc/VERSION.txt 2>/dev/null | awk '{print $2}') + if [ $REMOTE -eq 1 ]; then + NEWVERSION=$(curl -s $RAW_URL/doc/VERSION.txt 2>/dev/null | awk '{print $2}') else NEWVERSION=$(awk '{print $2}' $PROGRAMDIR/doc/VERSION.txt 2>/dev/null) fi @@ -480,16 +491,15 @@ function updateClientFiles() # Actualizar ficheros del cliente. backupFile $ENGINECFG echoAndLog "${FUNCNAME}(): Updating OpenGnsys Client files" - rsync --exclude .svn -irplt $WORKDIR/opengnsys/client/shared/* $INSTALL_TARGET/client + rsync -irplt $WORKDIR/opengnsys/client/shared/* $INSTALL_TARGET/client if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error while updating client structure" exit 1 fi - find $INSTALL_TARGET/client -name .svn -type d -exec rm -fr {} \; 2>/dev/null # Actualizar librerías del motor de clonación. echoAndLog "${FUNCNAME}(): Updating OpenGnsys Cloning Engine files" - rsync --exclude .svn -irplt $WORKDIR/opengnsys/client/engine/*.lib* $INSTALL_TARGET/client/lib/engine/bin + rsync -irplt $WORKDIR/opengnsys/client/engine/*.lib* $INSTALL_TARGET/client/lib/engine/bin if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error while updating engine files" exit 1 @@ -604,7 +614,7 @@ function updateWebFiles() # Copiar los ficheros nuevos conservando el archivo de configuración de acceso. backupFile $INSTALL_TARGET/www/controlacceso.php mv $INSTALL_TARGET/www $INSTALL_TARGET/WebConsole - rsync --exclude .svn -irplt $WORKDIR/opengnsys/admin/WebConsole $INSTALL_TARGET + rsync -irplt $WORKDIR/opengnsys/admin/WebConsole $INSTALL_TARGET ERRCODE=$? mv $INSTALL_TARGET/WebConsole $INSTALL_TARGET/www rm -fr $INSTALL_TARGET/www/xajax @@ -649,7 +659,7 @@ function updateDownloadableFiles() mv $PROGRAMDIR/$FILENAME $TARGETFILE else echoAndLog "${FUNCNAME}(): Downloading $FILENAME" - wget $DOWNLOADURL/$FILENAME -O $TARGETFILE + curl $DOWNLOADURL/$FILENAME -o $TARGETFILE fi if [ ! -s $TARGETFILE ]; then errorAndLog "${FUNCNAME}(): Cannot download $FILENAME" @@ -660,7 +670,7 @@ function updateDownloadableFiles() tar xvzf $TARGETFILE -C $INSTALL_TARGET/www/descargas if [ $? != 0 ]; then errorAndLog "${FUNCNAME}(): Error uncompressing archive $FILENAME" - exit 1 + return 1 fi } @@ -672,7 +682,7 @@ function updateInterfaceAdm() # Crear carpeta y copiar Interface echoAndLog "${FUNCNAME}(): Copying Administration Interface Folder" mv $INSTALL_TARGET/client/interfaceAdm $INSTALL_TARGET/client/Interface - rsync --exclude .svn -irplt $WORKDIR/opengnsys/admin/Interface $INSTALL_TARGET/client + rsync -irplt $WORKDIR/opengnsys/admin/Interface $INSTALL_TARGET/client errcoce=$? mv $INSTALL_TARGET/client/Interface $INSTALL_TARGET/client/interfaceAdm if [ $errcode -ne 0 ]; then @@ -829,7 +839,7 @@ function updateServerFiles() local i for (( i = 0; i < ${#SOURCES[@]}; i++ )); do if [ -d "$INSTALL_TARGET/${TARGETS[i]}" ]; then - rsync --exclude .svn -irplt "${SOURCES[i]}" $(dirname $(readlink -e "$INSTALL_TARGET/${TARGETS[i]}")) + rsync -irplt "${SOURCES[i]}" $(dirname $(readlink -e "$INSTALL_TARGET/${TARGETS[i]}")) else rsync -irplt "${SOURCES[i]}" $(readlink -m "$INSTALL_TARGET/${TARGETS[i]}") fi @@ -962,7 +972,7 @@ function updateClient() oglivecli convert fi # Comprobar si debe actualizarse el cliente. - SOURCELENGTH=$(LANG=C wget --spider $SOURCEFILE 2>&1 | awk '/Length:/ {print $2}') + SOURCELENGTH=$(curl -sI $SOURCEFILE 2>&1 | awk '/Content-Length:/ {print $2}') TARGETLENGTH=$(stat -c "%s" $TARGETFILE 2>/dev/null) [ -z $TARGETLENGTH ] && TARGETLENGTH=0 if [ "$SOURCELENGTH" != "$TARGETLENGTH" ]; then @@ -1017,8 +1027,9 @@ function checkFiles() function updateSummary() { # Actualizar fichero de versión y revisión. - local VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" - local REVISION=$(LANG=C svn info $SVN_URL|awk '/Rev:/ {print "r"$4}') + local VERSIONFILE REVISION + VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" + REVISION=$(curl -s "$API_URL" | jq -r ".commit.commit.committer.date" | awk '{gsub(/[^0-9]/,""); print}') [ -f $VERSIONFILE ] || echo "OpenGnsys" >$VERSIONFILE perl -pi -e "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE @@ -1112,10 +1123,10 @@ if [ $? -ne 0 ]; then fi # Si es necesario, descarga el repositorio de código en directorio temporal -if [ $USESVN -eq 1 ]; then - svnExportCode $SVN_URL +if [ $REMOTE -eq 1 ]; then + downloadCode $CODE_URL if [ $? -ne 0 ]; then - errorAndLog "Error while getting code from svn server" + errorAndLog "Error while getting code from repository" exit 1 fi else -- cgit v1.2.3-18-g5258 From b1fa0237e6662289b0a77c99faf4cc92eaa2da4b Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Mon, 28 May 2018 08:16:04 +0200 Subject: #840: Incluir directorios que faltaban en instalación; nueva info de instalación y adaptar algunos ficheros Vagrant para descargar desde Github. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/INSTALL.es.txt | 6 +- installer/opengnsys_installer.sh | 2 +- installer/vagrant/README.es.txt | 4 +- installer/vagrant/Vagrantfile-devel-vbox | 6 +- installer/vagrant/Vagrantfile-prod-vbox | 164 +++++++++++++++++++++++++++++++ installer/vagrant/Vagrantfile-trunk-vbox | 164 ------------------------------- 6 files changed, 173 insertions(+), 173 deletions(-) create mode 100644 installer/vagrant/Vagrantfile-prod-vbox delete mode 100644 installer/vagrant/Vagrantfile-trunk-vbox diff --git a/installer/INSTALL.es.txt b/installer/INSTALL.es.txt index 33070d26..0fd5ba75 100644 --- a/installer/INSTALL.es.txt +++ b/installer/INSTALL.es.txt @@ -1,5 +1,5 @@ -Instalación y Actualización de OpenGnsys 1.1.0 -============================================== +Instalación y Actualización de OpenGnsys 1.1.1pre +================================================= Instalación inicial @@ -12,7 +12,7 @@ Descargar una versión completa y desccomprimir el fichero "opengnsys-version.ta cd opengnsys/installer O bien, descargar el instalador desde la última reversión del repositorio: - svn export https://opengnsys.es/svn/branches/version1.1/installer/opengnsys_installer.sh + wget https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh Opcionalmente, puede descargarse la imagen del cliente; si no se realiza este paso, el instalador la descargará automáticamente. wget https://opengnsys.es/downloads/ogLive-versioncliente.iso diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 6fe905dc..ba6b0bf2 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1204,7 +1204,7 @@ function createDirs() echoAndLog "${FUNCNAME}(): creating directory paths in $path_opengnsys_base" mkdir -p $path_opengnsys_base mkdir -p $path_opengnsys_base/bin - mkdir -p $path_opengnsys_base/client + mkdir -p $path_opengnsys_base/client/{images,log} mkdir -p $path_opengnsys_base/doc mkdir -p $path_opengnsys_base/etc mkdir -p $path_opengnsys_base/lib diff --git a/installer/vagrant/README.es.txt b/installer/vagrant/README.es.txt index ce40f709..6f300afe 100644 --- a/installer/vagrant/README.es.txt +++ b/installer/vagrant/README.es.txt @@ -5,7 +5,7 @@ Preparar entorno virtual de desarrollo para OpenGnsys Ficheros de configuración disponibles: - - Vagrantfile-trunk-vbox Vagrantfile para OpenGnsys estable con proveedor VirtualBox. + - Vagrantfile-prod-vbox Vagrantfile para OpenGnsys estable con proveedor VirtualBox. - Vagrantfile-devel-vbox Vagrantfile para OpenGnsys en desarrollo con proveedor VirtualBox. - Vagrantfile-boottools-vbox Vagrantfile para preparar el entorno de generación del cliente ogLive (recomendado solo para desarrolladores experimentados). - Vagrantfile-browser-vbox Vagrantfile para preparar el entorno de desarrollo del Browser del cliente (recomendado solo para miembros del grupo de desarrollo). @@ -25,7 +25,7 @@ El entorno de trabajo de OpenGnsys. - pc12 - ogclientN: MV clientes para restaurar con disco vacío. -Ejecutar el entorno virtual (Vagrantfile-trunk-vbox y Vagrantfile-devel-vbox). +Ejecutar el entorno virtual (Vagrantfile-prod-vbox y Vagrantfile-devel-vbox). - Crear un directorio de trabajo. - Copiar el fichero Vagrantfile-...-vbox correspondiente en dicho directorio como Vagrantfile. diff --git a/installer/vagrant/Vagrantfile-devel-vbox b/installer/vagrant/Vagrantfile-devel-vbox index c8eb022f..4d41afd0 100644 --- a/installer/vagrant/Vagrantfile-devel-vbox +++ b/installer/vagrant/Vagrantfile-devel-vbox @@ -1,4 +1,4 @@ -# Vagrantfile to install OpenGnsys 1.1 virtual environment using VirtualBox provider. +# Vagrantfile to install OpenGnsys virtual environment (development version) using VirtualBox provider. VAGRANTFILE_API_VERSION = "2" # VM provider: Oracle VM VirtualBox. @@ -38,7 +38,7 @@ if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then mount -a fi # Install OpenGnsys and change server address. -wget -q https://opengnsys.es/svn/branches/version1.1/installer/opengnsys_installer.sh -O - | bash || exit $? +curl -s https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh | bash || exit $? mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log echo y | /opt/opengnsys/bin/setserveraddr enp0s8 # Insert DHCP data. @@ -94,7 +94,7 @@ OGAGENTPKG = "ogagent_1.1.0_all.deb" MODELSCRIPT = <> /etc/fstab + mount -a +fi +# Install OpenGnsys and change server address. +curl -s https://raw.githubusercontent.com/opengnsys/OpenGnsys/master/installer/opengnsys_installer.sh | bash || exit $? +mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log +echo y | /opt/opengnsys/bin/setserveraddr enp0s8 +# 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%,}" +#/opt/opengnsys/bin/setclientmode ogLiveAdmin pc11 PERM +#for ((i=12; i<=#{NCLIENTS+10}; i++)); do +# /opt/opengnsys/bin/setclientmode ogLive pc$i PERM +#done +echo "Notes:" +echo "- OpenGnsys Server URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" +exit 0 +EOT + +# Client 1 OS provisioning script. +OGAGENTPKG = "ogagent_1.1.0_all.deb" +MODELSCRIPT = <> /etc/fstab - mount -a -fi -# Install OpenGnsys and change server address. -wget -q https://opengnsys.es/svn/trunk/installer/opengnsys_installer.sh -O - | bash || exit $? -mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log -echo y | /opt/opengnsys/bin/setserveraddr enp0s8 -# 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%,}" -#/opt/opengnsys/bin/setclientmode ogLiveAdmin pc11 PERM -#for ((i=12; i<=#{NCLIENTS+10}; i++)); do -# /opt/opengnsys/bin/setclientmode ogLive pc$i PERM -#done -echo "Notes:" -echo "- OpenGnsys Server URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" -exit 0 -EOT - -# Client 1 OS provisioning script. -OGAGENTPKG = "ogagent_1.1.0_all.deb" -MODELSCRIPT = < Date: Mon, 28 May 2018 14:28:44 +0200 Subject: #840: Continuar sustitución de SVN por Git. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/INSTALL.en.txt | 14 +++++++------- doc/INSTALL.es.txt | 12 ++++++------ installer/opengnsys_installer.sh | 2 +- installer/opengnsys_makecompress.sh | 23 ++++++++++++++++++----- installer/vagrant/Vagrantfile-ogagent-vbox | 2 +- 5 files changed, 33 insertions(+), 20 deletions(-) diff --git a/doc/INSTALL.en.txt b/doc/INSTALL.en.txt index 4eef6920..732ffea4 100644 --- a/doc/INSTALL.en.txt +++ b/doc/INSTALL.en.txt @@ -1,10 +1,10 @@ -Installing OpenGnsys Server v 1.0.5 -======================================= +Installing OpenGnsys Server v 1.1.1 +=================================== Before installation ------------------- -OpenGnsys Server 1.0.5 is meant to be installed under Ubuntu Server 12.04 LTS or newer, though it has also been tested under operating systems based on Fedora 20 +OpenGnsys Server 1.1.1 is meant to be installed under Ubuntu Server 16.04 LTS or newer, though it has also been tested under operating systems based on CentOS 7. Network connection is needed in order to download the required packages, the source code and the preconfigured client. @@ -17,19 +17,19 @@ Minimum storage requirements: Installation ------------ -To install OpenGnsys, run opengnsys_installer.sh after unpacking the release file (opengnsys-release.tar.gz) o downloading it directly from https://opengnsys.es/svn/trunk/installer/opengnsys_installer.sh. +To install OpenGnsys, run opengnsys_installer.sh after unpacking the release file (opengnsys-release.tar.gz) o downloading it directly from https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh Unpacking example: - tar xvzf opengnsys-1.0.5.tar.gz + tar xvzf opengnsys-1.1.0.tar.gz cd opengnsys/installer Download examples: * Download with wget. - wget https://opengnsys.es/svn/trunk/installer/opengnsys_installer.sh -O opengnsys_installer.sh + wget https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh * Download with curl. - curl https://opengnsys.es/svn/trunk/installer/opengnsys_installer.sh > opengnsys_installer.sh + curl https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh -o opengnsys_installer.sh You must be root to run the installation script: diff --git a/doc/INSTALL.es.txt b/doc/INSTALL.es.txt index 4cc54344..d18bc5c6 100644 --- a/doc/INSTALL.es.txt +++ b/doc/INSTALL.es.txt @@ -1,10 +1,10 @@ -Instalación de OpenGnsys Server v 1.1.0 +Instalación de OpenGnsys Server v 1.1.1 ======================================= Notas iniciales --------------- -Se presupone que el servidor de OpenGnsys va a ser instalado en una distribución del sistema operativo Ubuntu Server a partir de la versión 14.04 LTS (también ha sido probado en sistemas basados en CentOS 7). +Se presupone que el servidor de OpenGnsys va a ser instalado en una distribución del sistema operativo Ubuntu Server a partir de la versión 16.04 LTS (también ha sido probado en sistemas basados en CentOS 7). El serividor debe tener acceso a Internet para descargar los paquetes necesarios, el código del proyecto y el cliente preconfigurado. @@ -18,20 +18,20 @@ Requisitos mínimos de almacenamiento: Instalación ----------- -La instalación de OpenGnsys se realiza ejecutando el script de instalación opengnsys_installer.sh, el cual puede obtenerse descomprimiendo el fichero de la versión opengnsys-Version.tar.gz o descargándolo directamente de la dirección: https://opengnsys.es/svn/branches/version1.1/installer/opengnsys_installer.sh +La instalación de OpenGnsys se realiza ejecutando el script de instalación opengnsys_installer.sh, el cual puede obtenerse descomprimiendo el fichero de la versión opengnsys-Version.tar.gz o descargándolo directamente de la dirección: https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh Ejemplos de descompresión del programa: - tar xvzf opengnsys-1.0.5.tar.gz + tar xvzf opengnsys-1.1.0.tar.gz cd opengnsys/installer Ejemplos de descarga con varias herramientas: * Descargar con wget. - wget https://opengnsys.es/svn/branches/version1.1/installer/opengnsys_installer.sh -O opengnsys_installer.sh + wget https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh * Descargar con curl. - curl https://opengnsys.es/svn/branches/version1.1/installer/opengnsys_installer.sh > opengnsys_installer.sh + curl https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh -o opengnsys_installer.sh El script de instalación debe ser ejecutado como usuario root: diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index ba6b0bf2..fb852fa9 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1204,7 +1204,7 @@ function createDirs() echoAndLog "${FUNCNAME}(): creating directory paths in $path_opengnsys_base" mkdir -p $path_opengnsys_base mkdir -p $path_opengnsys_base/bin - mkdir -p $path_opengnsys_base/client/{images,log} + mkdir -p $path_opengnsys_base/client/{cache,images,log} mkdir -p $path_opengnsys_base/doc mkdir -p $path_opengnsys_base/etc mkdir -p $path_opengnsys_base/lib diff --git a/installer/opengnsys_makecompress.sh b/installer/opengnsys_makecompress.sh index ab05b5ce..0fbec746 100755 --- a/installer/opengnsys_makecompress.sh +++ b/installer/opengnsys_makecompress.sh @@ -7,28 +7,41 @@ # Versión: 1.0 - Incluido en OpenGnSys 1.0.1 # Autor: Ramón Gómez, Universidad de Sevilla # Fecha: 10/05/2011 +# Versión: 1.1.1 - Descarga desde repositorio de GitHub +# Autor: Ramón Gómez, Universidad de Sevilla +# Fecha: 27/05/2018 + +# Comprobaciones. +for PROG in jq unzip; do + if ! which $PROG &>/dev/null; then + echo "Please, install \"$PROG\" package." + exit 1 + fi +done # Variables -SVNURL="https://opengnsys.es/svn/branches/version1.1/" -SVNREV=$(LANG=C svn info $SVNURL | awk '/Last Changed Rev:/ {print "r"$4}') +BRANCH="devel" +CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" +API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" +REVISION=$(curl -s "$API_URL" | jq -r ".commit.commit.committer.date" | awk '{gsub(/[^0-9]/,""); print}') # Descargar repositorio SVN cd /tmp rm -fr opengnsys -svn export $SVNURL opengnsys || exit 1 +curl "$CODE_URL" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys # Asisgnar propietario de los ficheros descargados. chown -R root.root opengnsys WARNING=$? # Parchear datos de revisión del código. -perl -pi -e "s/$/ $SVNREV/" opengnsys/doc/VERSION.txt +perl -pi -e "s/$/ $REVISION/" opengnsys/doc/VERSION.txt # Generar fichero comprimido. VERSION=$(awk '{print $2"-"$3}' opengnsys/doc/VERSION.txt) tar cvzf opengnsys-$VERSION.tar.gz opengnsys -rm -fr opengnsys +rm -fr opengnsys opengnsys.zip # Revisar salida. [ $WARNING != 0 ] && echo "*** WARNING: cannot change owner of files to \"root\" user before compressing." diff --git a/installer/vagrant/Vagrantfile-ogagent-vbox b/installer/vagrant/Vagrantfile-ogagent-vbox index 22ddfe54..9e909973 100644 --- a/installer/vagrant/Vagrantfile-ogagent-vbox +++ b/installer/vagrant/Vagrantfile-ogagent-vbox @@ -33,7 +33,7 @@ wget -q https://atom.io/download/rpm -O /tmp/atom.rpm && dnf install -y /tmp/ato # Comment out next line if you prefer to install Eclipse IDE for Python (it needs more disk space). #dnf install -y eclipse-pydev eclipse-nls-${LANG%_*} # Download OGAgent environment installer. -svn export https://opengnsys.es/svn/branches/version1.1/installer/ogagent-devel-installer.sh /home/vagrant +wget -q https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/ogagent-devel-installer.sh -O /home/vagrant/ogagent-devel-installer.sh # Instructions. echo "Manual operations:" echo "- Reboot VM or launch desktop: startxfce4 &" -- cgit v1.2.3-18-g5258 From 3cc5bd2682ef58587718b5b57bbb41295747e85b Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Sat, 2 Jun 2018 13:41:56 +0200 Subject: #840: Sustitución de SVN por Git en Vagrant y actualizar la MV base para generar agentes OGAgent. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/ogagent-devel-installer.sh | 10 ++++++---- installer/vagrant/Vagrantfile-ogagent-vbox | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/installer/ogagent-devel-installer.sh b/installer/ogagent-devel-installer.sh index 18574ed2..71f7c7c0 100755 --- a/installer/ogagent-devel-installer.sh +++ b/installer/ogagent-devel-installer.sh @@ -11,8 +11,9 @@ # Variables. -PROGDIR=$PWD/ogagent -SVNURL=https://opengnsys.es/svn/branches/version1.1/admin/Sources/Clients/ogagent +PROGDIR="$PWD/ogagent" +BRANCH="branches/devel" +SVNURL="https://github.com/opengnsys/OpenGnsys/$BRANCH/admin/Sources/Clients/ogagent" # Show prerequisites needed to build the environment. mkdir -p $PROGDIR || exit 1 @@ -22,20 +23,21 @@ OGAgent devoloping environment installation Prerequisites: - Install packages, if needed: + - Subversion - Wine for 32-bit (Winetricks may be required) - Python 2.7 with pyqt4-dev-tools - realpath - dpkg-dev - rpmbuild - xar -- Open a web browser and download Microsoft Visual C++ 2010 Redistributable Package (x86) from: http://www.microsoft.com/en-us/download/details.aspx?id=5555 -- Copy or move "vcredist_x86.exe" file to $PROGDIR directory. Press [Enter] key when ready to continue. EOT read # Importing OGAgent source code. svn export --force $SVNURL $PROGDIR || exit 1 +# Downloading Visual C++ Redistributable. +wget --unlink https://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe # Update PyQt components. pushd ogagent/src >/dev/null diff --git a/installer/vagrant/Vagrantfile-ogagent-vbox b/installer/vagrant/Vagrantfile-ogagent-vbox index 9e909973..1bf48faa 100644 --- a/installer/vagrant/Vagrantfile-ogagent-vbox +++ b/installer/vagrant/Vagrantfile-ogagent-vbox @@ -33,7 +33,9 @@ wget -q https://atom.io/download/rpm -O /tmp/atom.rpm && dnf install -y /tmp/ato # Comment out next line if you prefer to install Eclipse IDE for Python (it needs more disk space). #dnf install -y eclipse-pydev eclipse-nls-${LANG%_*} # Download OGAgent environment installer. -wget -q https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/ogagent-devel-installer.sh -O /home/vagrant/ogagent-devel-installer.sh +BRANCH="devel" +wget -qc --unlink https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH/installer/ogagent-devel-installer.sh -O /home/vagrant/ogagent-devel-installer.sh +chmod +x /home/vagrant/ogagent-devel-installer.sh # Instructions. echo "Manual operations:" echo "- Reboot VM or launch desktop: startxfce4 &" @@ -60,7 +62,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vb.gui = true end # VM base and host name. - ag.vm.box = "fedora/25-cloud-base" + ag.vm.box = "fedora/27-cloud-base" ag.vm.hostname = "ogAgent" # Comment to disable synced folder. ag.vm.synced_folder ".", "/vagrant" -- cgit v1.2.3-18-g5258 From 82dbaff33f6f214d66911565a689d95506a12ac9 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Sun, 3 Jun 2018 13:07:00 +0200 Subject: #840: Creación de nuevos OGAgent para versión 1.1.1 en desarrollo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/Sources/Clients/ogagent/INSTALL.es.txt | 4 +--- .../Clients/ogagent/linux/build-packages.sh | 6 +++--- .../Sources/Clients/ogagent/linux/debian/changelog | 8 +++++++- admin/Sources/Clients/ogagent/macos/build-pkg.sh | 6 +++--- admin/Sources/Clients/ogagent/src/VERSION | 2 +- .../Clients/ogagent/src/opengnsys/__init__.py | 11 +++++++---- admin/Sources/Clients/ogagent/src/setup.py | 23 ++++++++++++++-------- admin/Sources/Clients/ogagent/src/update.sh | 1 + 8 files changed, 38 insertions(+), 23 deletions(-) diff --git a/admin/Sources/Clients/ogagent/INSTALL.es.txt b/admin/Sources/Clients/ogagent/INSTALL.es.txt index 3f43206f..9eb2e174 100644 --- a/admin/Sources/Clients/ogagent/INSTALL.es.txt +++ b/admin/Sources/Clients/ogagent/INSTALL.es.txt @@ -36,10 +36,8 @@ Instalar OGAgent en cliente modelo - Descargar el fichero correspondiente en el sistema operativo del cliente. - Ubuntu, Debian y derivados: - - Instalar dependencias (NOTA: revisar dependencias para Ubuntu 12.04): - sudo apt-get install -y libxss1 policykit-1 python python-requests python-qt4 python-six python-prctl - Descargar e instalar el agente: - sudo dpkg -i ogagent_Version_all.deb + sudo apt install ./ogagent_Version_all.deb - Configurar el agente: sudo sed -i "0,/remote=/ s,remote=.*,remote=https://IPServidorOpenGnsys/opengnsys/rest/," /usr/share/OGAgent/cfg/ogagent.cfg - Iniciar el servicio (se iniciará automáticamente en el proceso de arranque): diff --git a/admin/Sources/Clients/ogagent/linux/build-packages.sh b/admin/Sources/Clients/ogagent/linux/build-packages.sh index b4f11077..02b5ee12 100755 --- a/admin/Sources/Clients/ogagent/linux/build-packages.sh +++ b/admin/Sources/Clients/ogagent/linux/build-packages.sh @@ -1,11 +1,11 @@ #!/bin/bash -VERSION=1.1.0 -RELEASE=1 - cd $(dirname "$0") top=`pwd` +[ -r ../src/VERSION ] && VERSION="$(cat ../src/VERSION)" || VERSION="1.1.0" +RELEASE="1" + # Debian based dpkg-buildpackage -b -d diff --git a/admin/Sources/Clients/ogagent/linux/debian/changelog b/admin/Sources/Clients/ogagent/linux/debian/changelog index 01fd564d..176cac0d 100644 --- a/admin/Sources/Clients/ogagent/linux/debian/changelog +++ b/admin/Sources/Clients/ogagent/linux/debian/changelog @@ -1,8 +1,14 @@ +ogagent (1.1.1) unstable; urgency=medium + + * OGAgent code retrieved from GitHub + + -- Ramón M. Gómez Sun, 3 Jun 2018 13:00:00 +0200 + ogagent (1.1.0) stable; urgency=medium * Functional OpenGnsys Agent interacting with OpenGnsys Server 1.1.0 - -- Ramón M. Gómez Tue, 13 Oct 2016 17:00:00 +0200 + -- Ramón M. Gómez Tue, 13 Oct 2016 17:00:00 +0100 ogagent (1.0.0) stable; urgency=medium diff --git a/admin/Sources/Clients/ogagent/macos/build-pkg.sh b/admin/Sources/Clients/ogagent/macos/build-pkg.sh index 500da58e..29f5545a 100755 --- a/admin/Sources/Clients/ogagent/macos/build-pkg.sh +++ b/admin/Sources/Clients/ogagent/macos/build-pkg.sh @@ -2,11 +2,11 @@ # Create macOS installation packages. # Based on bomutils tutorail: http://bomutils.dyndns.org/tutorial.html -VERSION=1.1.0 +cd $(dirname $0) +[ -r ../src/VERSION ] && VERSION="$(cat ../src/VERSION)" || VERSION="1.1.0" AUTHOR="OpenGnsys Project" # Create empty directories. -cd $(dirname $0) rm -fr build mkdir -p build && cd build mkdir -p flat/base.pkg flat/Resources/en.lproj @@ -57,7 +57,7 @@ mkbom -u 0 -g 80 root flat/base.pkg/Bom cat << EOT > flat/Distribution - OGAgent 1.1.0 + OGAgent $VERSION diff --git a/admin/Sources/Clients/ogagent/src/VERSION b/admin/Sources/Clients/ogagent/src/VERSION index 9084fa2f..524cb552 100644 --- a/admin/Sources/Clients/ogagent/src/VERSION +++ b/admin/Sources/Clients/ogagent/src/VERSION @@ -1 +1 @@ -1.1.0 +1.1.1 diff --git a/admin/Sources/Clients/ogagent/src/opengnsys/__init__.py b/admin/Sources/Clients/ogagent/src/opengnsys/__init__.py index 48453fb7..02e7c341 100644 --- a/admin/Sources/Clients/ogagent/src/opengnsys/__init__.py +++ b/admin/Sources/Clients/ogagent/src/opengnsys/__init__.py @@ -26,9 +26,9 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -''' +""" @author: Adolfo Gómez, dkmaster at dkmon dot com -''' +""" from __future__ import unicode_literals # On centos, old six release does not includes byte2int, nor six.PY2 @@ -37,7 +37,11 @@ import six import modules from RESTApi import REST, RESTError -VERSION = '1.1.0' +try: + with open('VERSION', 'r') as v: + VERSION = v.read() +except IOError: + VERSION = '1.1.0' __title__ = 'OpenGnsys Agent' __version__ = VERSION @@ -46,7 +50,6 @@ __author__ = 'Adolfo Gómez' __license__ = "BSD 3-clause" __copyright__ = "Copyright VirtualCable S.L.U." - if not hasattr(six, 'byte2int'): if six.PY3: import operator diff --git a/admin/Sources/Clients/ogagent/src/setup.py b/admin/Sources/Clients/ogagent/src/setup.py index f80bf33b..15254f4f 100644 --- a/admin/Sources/Clients/ogagent/src/setup.py +++ b/admin/Sources/Clients/ogagent/src/setup.py @@ -26,12 +26,10 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -''' +""" @author: Adolfo Gómez, dkmaster at dkmon dot com @author: Ramón M. Gómez, ramongomez at us dot es -''' - -VERSION = '1.1.0' +""" # ModuleFinder can't handle runtime changes to __path__, but win32com uses them try: @@ -44,7 +42,8 @@ try: import py2exe.mf as modulefinder except ImportError: import modulefinder - import win32com, sys + import win32com + import sys for p in win32com.__path__[1:]: modulefinder.AddPackagePath("win32com", p) for extra in ["win32com.shell"]: # ,"win32com.mapi" @@ -56,13 +55,21 @@ except ImportError: # no build path setup, no worries. pass +import os from distutils.core import setup -import py2exe + import sys -import os + +# Reading version file: +try: + with open('VERSION', 'r') as v: + VERSION = v.read() +except IOError: + VERSION = '1.1.0' sys.argv.append('py2exe') + def get_requests_cert_file(): """Add Python requests or certifi .pem file for installers.""" import requests @@ -115,7 +122,7 @@ setup( } ], service=[udsservice], - data_files=[('', [get_requests_cert_file()]),('cfg', ['cfg/ogagent.cfg', 'cfg/ogclient.cfg'])], + data_files=[('', [get_requests_cert_file()]), ('cfg', ['cfg/ogagent.cfg', 'cfg/ogclient.cfg'])], options={ 'py2exe': { 'bundle_files': 3, diff --git a/admin/Sources/Clients/ogagent/src/update.sh b/admin/Sources/Clients/ogagent/src/update.sh index 1019ea85..e6e02ab3 100755 --- a/admin/Sources/Clients/ogagent/src/update.sh +++ b/admin/Sources/Clients/ogagent/src/update.sh @@ -33,6 +33,7 @@ function process { } cd $(dirname "$0") +[ -r VERSION ] && sed -i "s/Version [^<]*/Version $(cat VERSION)/" about-dialog.ui pyrcc4 -py3 OGAgent.qrc -o OGAgent_rc.py -- cgit v1.2.3-18-g5258 From 228dd16463fb5e095869246963808ff9b9a40de9 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Mon, 4 Jun 2018 08:13:58 +0200 Subject: #840: Instalador vuelve a usar Subversion como dependencia para poder adaptar la BD en el script de importación. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/opengnsys_import.sh | 4 ++-- installer/opengnsys_installer.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/installer/opengnsys_import.sh b/installer/opengnsys_import.sh index 6f15ed90..26b7ede3 100755 --- a/installer/opengnsys_import.sh +++ b/installer/opengnsys_import.sh @@ -33,7 +33,8 @@ MYSQLFILE="$TMPDIR/$CATALOG.sql" MYSQLBCK="$OPENGNSYS/doc/$CATALOG.sql-$DATE" LOG_FILE=$OPENGNSYS/log/${PROG%.sh}.log -OPENGNSYS_SERVER="opengnsys.es" +BRANCH="branches/devel" +SVN_URL="https://github.com/opengnsys/OpenGnsys/$BRANCH/admin/Database" DEFAULT_MYSQL_ROOT_PASSWORD="passwordroot" # Clave por defecto root de MySQL # Si se solicita, mostrar ayuda. @@ -231,7 +232,6 @@ if [ $OLDVERSION != $NEWVERSION ] ; then exit 0 fi # Nos bajamos los archivos de actualización de la base de datos - SVN_URL="https://$OPENGNSYS_SERVER/svn/branches/version${NEWVERSION%.*}/admin/Database" svn checkout "$SVN_URL" $TMPDIR/Database [ $? -ne 0 ] && errorAndLog "$PROG: Error getting code from $SVN_URL" && exit 6 diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index fb852fa9..a9c54f0f 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -169,7 +169,7 @@ OSVERSION="${OSVERSION%%.*}" # Configuración según la distribución GNU/Linux (usar minúsculas). case "$OSDISTRIB" in ubuntu|debian|linuxmint) - DEPENDENCIES=( apache2 php php-ldap libapache2-mod-php mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget curl doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast shim-signed grub-efi-amd64-signed ) + DEPENDENCIES=( subversion apache2 php php-ldap libapache2-mod-php mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget curl doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast shim-signed grub-efi-amd64-signed ) UPDATEPKGLIST="apt-get update" INSTALLPKG="apt-get -y install --force-yes" CHECKPKG="dpkg -s \$package 2>/dev/null | grep Status | grep -qw install" @@ -206,7 +206,7 @@ case "$OSDISTRIB" in TFTPCFGDIR=/var/lib/tftpboot ;; fedora|centos) - DEPENDENCIES=( httpd mod_ssl php php-ldap mysql-server mysql-devel mysql-devel.i686 php-mysql dhcp tftp-server tftp xinetd binutils gcc gcc-c++ glibc-devel glibc-devel.i686 glibc-static glibc-static.i686 libstdc++-devel.i686 make wget curl doxygen graphviz ctorrent samba samba-client rsync unzip debootstrap schroot squashfs-tools python-crypto arp-scan procps-ng gettext moreutils jq net-tools http://ftp.altlinux.org/pub/distributions/ALTLinux/5.1/branch/$(arch)/RPMS.classic/netpipes-4.2-alt1.$(arch).rpm ) + DEPENDENCIES=( subversion httpd mod_ssl php php-ldap mysql-server mysql-devel mysql-devel.i686 php-mysql dhcp tftp-server tftp xinetd binutils gcc gcc-c++ glibc-devel glibc-devel.i686 glibc-static glibc-static.i686 libstdc++-devel.i686 make wget curl doxygen graphviz ctorrent samba samba-client rsync unzip debootstrap schroot squashfs-tools python-crypto arp-scan procps-ng gettext moreutils jq net-tools http://ftp.altlinux.org/pub/distributions/ALTLinux/5.1/branch/$(arch)/RPMS.classic/netpipes-4.2-alt1.$(arch).rpm ) INSTALLEXTRADEPS=( 'pushd /tmp; wget -t3 http://download.bittornado.com/download/BitTornado-0.3.18.tar.gz && tar xvzf BitTornado-0.3.18.tar.gz && cd BitTornado-CVS && python setup.py install && ln -fs btlaunchmany.py /usr/bin/btlaunchmany && ln -fs bttrack.py /usr/bin/bttrack; popd' ) INSTALLPKG="yum install -y libstdc++ libstdc++.i686" CHECKPKG="rpm -q --quiet \$package" -- cgit v1.2.3-18-g5258 From 832e27bbe8a82ad46ba2d3ea9550728751e79b99 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Tue, 5 Jun 2018 12:36:47 +0200 Subject: #840: Adaptar valor de revisión según fecha y parte del commit de Git en instalador y actualizador; continuar sustituyendo URLs de Git. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/boot-tools/boottoolsfunctions.lib | 4 ++-- installer/opengnsys_installer.sh | 9 ++++++--- installer/opengnsys_makecompress.sh | 4 ++-- installer/opengnsys_update.sh | 5 +++-- installer/vagrant/Vagrantfile-boottools-vbox | 2 +- installer/vagrant/Vagrantfile-browser-vbox | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/client/boot-tools/boottoolsfunctions.lib b/client/boot-tools/boottoolsfunctions.lib index babb2e06..c615a9fb 100755 --- a/client/boot-tools/boottoolsfunctions.lib +++ b/client/boot-tools/boottoolsfunctions.lib @@ -141,8 +141,8 @@ case "${1,,}" in exit 1 ;; esac -SVNURL="https://opengnsys.es/svn/branches/version1.1/client" -VERSIONSVN=$(LC_ALL=C svn info $SVNURL | awk '/Rev:/ {print "r"$4}') +SVNURL="https://github.com/opengnsys/OpenGnsys/branches/devel/client" +VERSIONSVN=$(LC_ALL=C svn info $SVNURL | awk '/Date:/ {gsub(/-/,""); print ""$4}' NAMEISOCLIENT="$VERSIONBOOTTOOLS-$OSCODENAME-$OSRELEASE-$OSARCH-$VERSIONSVN" NAMEHOSTCLIENT="$VERSIONBOOTTOOLS-$OSCODENAME-$VERSIONSVN" export OSDISTRIB OSCODENAME OSRELEASE OSARCH OSHTTP diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index a9c54f0f..7d41bd6b 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1553,14 +1553,17 @@ EOT function installationSummary() { + local VERSIONFILE REVISION + # Crear fichero de versión y revisión, si no existe. - local VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" + VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" [ -f $VERSIONFILE ] || echo "OpenGnsys Server" >$VERSIONFILE # Incluir datos de revisión, si se está instaladno desde el repositorio # de código o si no está incluida en el fichero de versión. if [ $REMOTE -eq 1 ] || [ -z "$(awk '$3~/r[0-9]*/ {print}' $VERSIONFILE)" ]; then - local REVISION=$(curl -s "$API_URL" | jq -r ".commit.commit.committer.date" | awk '{gsub(/[^0-9]/,""); print}') - sed -ri "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE + # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit). + REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') + sed -ri "s/($| r[.0-9a-f]+)/ $REVISION/" $VERSIONFILE fi # Mostrar información. diff --git a/installer/opengnsys_makecompress.sh b/installer/opengnsys_makecompress.sh index 0fbec746..5c8aa729 100755 --- a/installer/opengnsys_makecompress.sh +++ b/installer/opengnsys_makecompress.sh @@ -24,7 +24,7 @@ done BRANCH="devel" CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" -REVISION=$(curl -s "$API_URL" | jq -r ".commit.commit.committer.date" | awk '{gsub(/[^0-9]/,""); print}') +REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') # Descargar repositorio SVN cd /tmp @@ -36,7 +36,7 @@ chown -R root.root opengnsys WARNING=$? # Parchear datos de revisión del código. -perl -pi -e "s/$/ $REVISION/" opengnsys/doc/VERSION.txt +sed -ri "s/$/ $REVISION/" opengnsys/doc/VERSION.txt # Generar fichero comprimido. VERSION=$(awk '{print $2"-"$3}' opengnsys/doc/VERSION.txt) diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index 63512336..f8689673 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -1029,10 +1029,11 @@ function updateSummary() # Actualizar fichero de versión y revisión. local VERSIONFILE REVISION VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" - REVISION=$(curl -s "$API_URL" | jq -r ".commit.commit.committer.date" | awk '{gsub(/[^0-9]/,""); print}') + # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit). + REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') [ -f $VERSIONFILE ] || echo "OpenGnsys" >$VERSIONFILE - perl -pi -e "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE + sed -ri "s/($| r[.0-9a-f]+)/ $REVISION/" $VERSIONFILE echo echoAndLog "OpenGnsys Update Summary" diff --git a/installer/vagrant/Vagrantfile-boottools-vbox b/installer/vagrant/Vagrantfile-boottools-vbox index 1a7c9e5a..83348f02 100644 --- a/installer/vagrant/Vagrantfile-boottools-vbox +++ b/installer/vagrant/Vagrantfile-boottools-vbox @@ -24,7 +24,7 @@ apt-get install -y subversion groupadd opengnsys mkdir -p /opt/opengnsys/client /tmp/opengnsys_installer/opengnsys ln -fs /var/lib/tftpboot /opt/opengnsys -svn export https://opengnsys.es/svn/branches/version1.1/client /tmp/opengnsys_installer/opengnsys/client +svn export https://github.com/opengnsys/OpenGnsys/branches/devel/client /tmp/opengnsys_installer/opengnsys/client echo "Connect to this VM, launch boot-tools generation script and follow instructions:" echo " sudo /tmp/opengnsys_installer/opengnsys/client/boot-tools/boottoolsgenerator.sh" echo "Warning: this process may take a long time." diff --git a/installer/vagrant/Vagrantfile-browser-vbox b/installer/vagrant/Vagrantfile-browser-vbox index 9cf3661c..bc8d55d4 100644 --- a/installer/vagrant/Vagrantfile-browser-vbox +++ b/installer/vagrant/Vagrantfile-browser-vbox @@ -29,7 +29,7 @@ echo "yes" | ./configure -opensource -embedded x86 -webkit -openssl -qt-gfx-vnc make make install # Compile Browser. -svn export https://opengnsys.es/svn/branches/version1.1/client/browser ../browser +svn export https://github.com/opengnsys/OpenGnsys/branches/devel/client/browser ../browser cd browser qmake browser.pro make -- cgit v1.2.3-18-g5258 From 22087adb0242fbd6ed6896a6227bb41c1c1af668 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Tue, 12 Jun 2018 11:49:15 +0200 Subject: #843: New version file. --- doc/VERSION.json | 7 +++++++ doc/VERSION.txt | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 doc/VERSION.json delete mode 100644 doc/VERSION.txt diff --git a/doc/VERSION.json b/doc/VERSION.json new file mode 100644 index 00000000..d9d28325 --- /dev/null +++ b/doc/VERSION.json @@ -0,0 +1,7 @@ +{ + "project": "OpenGnsys", + "version": "1.1.1pre", + "codename": "Espeto", + "definition": "http://www.andalucia.com/gastronomy/espeto.htm", + "release": "" +} diff --git a/doc/VERSION.txt b/doc/VERSION.txt deleted file mode 100644 index b7f4b4fc..00000000 --- a/doc/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -OpenGnsys 1.1.1pre -- cgit v1.2.3-18-g5258 From 3bbaf79bf5961f05f2a6f278f6f222b8e3ba49f7 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Tue, 12 Jun 2018 11:54:56 +0200 Subject: #843: Installer and updater use new version file. --- installer/opengnsys_installer.sh | 15 ++++++++------- installer/opengnsys_update.sh | 14 ++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 7d41bd6b..523aaaf2 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1556,21 +1556,22 @@ function installationSummary() local VERSIONFILE REVISION # Crear fichero de versión y revisión, si no existe. - VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" - [ -f $VERSIONFILE ] || echo "OpenGnsys Server" >$VERSIONFILE - # Incluir datos de revisión, si se está instaladno desde el repositorio + VERSIONFILE="$INSTALL_TARGET/doc/VERSION.json" + [ -f $VERSIONFILE ] || echo '{ "project": "OpenGnsys" }' >$VERSIONFILE + # Incluir datos de revisión, si se está instalando desde el repositorio # de código o si no está incluida en el fichero de versión. - if [ $REMOTE -eq 1 ] || [ -z "$(awk '$3~/r[0-9]*/ {print}' $VERSIONFILE)" ]; then + if [ $REMOTE -eq 1 ] || [ -z "$(jq -r '.release' $VERSIONFILE)" ]; then # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit). - REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') - sed -ri "s/($| r[.0-9a-f]+)/ $REVISION/" $VERSIONFILE + REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') + jq ".release=$REVISION" $VERSIONFILE | sponge $VERSIONFILE fi + VERSION="$(jq -r '[.project, .version, .codename, .release] | join(" ")' $VERSIONFILE 2>/dev/null)" # Mostrar información. echo echoAndLog "OpenGnsys Installation Summary" echo "==============================" - echoAndLog "Project version: $(cat $VERSIONFILE 2>/dev/null)" + echoAndLog "Project version: $VERSION" echoAndLog "Installation directory: $INSTALL_TARGET" echoAndLog "Installation log file: $LOG_FILE" echoAndLog "Repository directory: $INSTALL_TARGET/images" diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index f8689673..642d948d 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -1028,17 +1028,19 @@ function updateSummary() { # Actualizar fichero de versión y revisión. local VERSIONFILE REVISION - VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" + VERSIONFILE="$INSTALL_TARGET/doc/VERSION.json" # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit). - REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') - - [ -f $VERSIONFILE ] || echo "OpenGnsys" >$VERSIONFILE - sed -ri "s/($| r[.0-9a-f]+)/ $REVISION/" $VERSIONFILE + REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') + [ -f $VERSIONFILE ] || echo '{ "project": "OpenGnsys" }' > $VERSIONFILE + jq ".release=$REVISION" $VERSIONFILE | sponge $VERSIONFILE + VERSION="$(jq -r '[.project, .version, .codename, .release] | join(" ")' $VERSIONFILE 2>/dev/null)" + # Borrar antiguo fichero de versión. + rm -f "${VERSIONFILE/json/txt}" echo echoAndLog "OpenGnsys Update Summary" echo "========================" - echoAndLog "Project version: $(cat $VERSIONFILE)" + echoAndLog "Project version: $VERSION" echoAndLog "Update log file: $LOG_FILE" if [ -n "$NEWFILES" ]; then echoAndLog "Check new config files: $(echo $NEWFILES)" -- cgit v1.2.3-18-g5258 From c00832504a4a2d0c569850525ed95214a1cffbaa Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Tue, 12 Jun 2018 12:33:14 +0200 Subject: #843: API REST uses new version file. --- admin/WebConsole/rest/common.php | 22 +++++++++++++--------- admin/WebConsole/rest/opengnsys-api.yml | 8 +++++++- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/admin/WebConsole/rest/common.php b/admin/WebConsole/rest/common.php index 8d192035..bc39ced9 100644 --- a/admin/WebConsole/rest/common.php +++ b/admin/WebConsole/rest/common.php @@ -13,6 +13,7 @@ // Common constants. define('REST_LOGFILE', '/opt/opengnsys/log/rest.log'); +define('VERSION_FILE', '/opt/opengnsys/doc/VERSION.json'); // Set time zone. if (function_exists("date_default_timezone_set")) { @@ -247,25 +248,28 @@ $app->hook('slim.after', function() use ($app) { * @return JSON object with basic server information (version, services, etc.) */ $app->get('/info', function() { + $response = new \stdClass; // Reading version file. - @list($project, $version, $release) = explode(' ', file_get_contents('/opt/opengnsys/doc/VERSION.txt')); - $response['project'] = trim($project); - $response['version'] = trim($version); - $response['release'] = trim($release); + $data = json_decode(@file_get_contents(VERSION_FILE)); + if (isset($data->project)) { + $response = $data; + } else { + $response->project = 'OpenGnsys'; + } // Getting actived services. @$services = parse_ini_file('/etc/default/opengnsys'); - $response['services'] = Array(); + $response->services = Array(); if (@$services["RUN_OGADMSERVER"] === "yes") { - array_push($response['services'], "server"); + array_push($response->services, "server"); $hasOglive = true; } - if (@$services["RUN_OGADMREPO"] === "yes") array_push($response['services'], "repository"); - if (@$services["RUN_BTTRACKER"] === "yes") array_push($response['services'], "tracker"); + if (@$services["RUN_OGADMREPO"] === "yes") array_push($response->services, "repository"); + if (@$services["RUN_BTTRACKER"] === "yes") array_push($response->services, "tracker"); // Reading installed ogLive information file. if ($hasOglive === true) { $data = json_decode(@file_get_contents('/opt/opengnsys/etc/ogliveinfo.json')); if (isset($data->oglive)) { - $response['oglive'] = $data->oglive; + $response->oglive = $data->oglive; } } jsonResponse(200, $response); diff --git a/admin/WebConsole/rest/opengnsys-api.yml b/admin/WebConsole/rest/opengnsys-api.yml index fcd4961f..13ea37a1 100644 --- a/admin/WebConsole/rest/opengnsys-api.yml +++ b/admin/WebConsole/rest/opengnsys-api.yml @@ -87,6 +87,12 @@ paths: version: description: project version type: string + codename: + description: version codename + type: string + definition: + description: codename definition URL + type: string release: description: project release type: string @@ -122,7 +128,7 @@ paths: description: ISO file type: string required: [ distribution, kernel, architecture, revision, directory, iso ] - required: [ project, version, release, services ] + required: [ project, services ] tags: - server - repository -- cgit v1.2.3-18-g5258 From 9815cac93139ec0a4a155934819a887b6436081a Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Tue, 12 Jun 2018 13:08:52 +0200 Subject: #843: Scripts in in^Caller directory use new version file. --- installer/ogGenerateDoc.sh | 8 +++++--- installer/opengnsys_export.sh | 4 ++-- installer/opengnsys_import.sh | 6 +++--- installer/opengnsys_installer.sh | 4 ++-- installer/opengnsys_makecompress.sh | 6 +++--- installer/opengnsys_update.sh | 7 ++++--- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/installer/ogGenerateDoc.sh b/installer/ogGenerateDoc.sh index 34a16ced..62839ef2 100755 --- a/installer/ogGenerateDoc.sh +++ b/installer/ogGenerateDoc.sh @@ -20,8 +20,10 @@ fi if [ $# = 2 ] then mkdir -p "$2" -VERSION=$(cat $(dirname "$0")/../doc/VERSION.txt) 2>/dev/null -VERSION=${VERSION:-"1.1"} +PROJECT=$(jq '.project' $(dirname "$0")/../doc/VERSION.json) 2>/dev/null +PROJECT=${PROJECT:-"OpenGnsys"} +VERSION=$(jq '.version+" "+.codename' $(dirname "$0")/../doc/VERSION.json) 2>/dev/null +VERSION=${VERSION:-"1.1.1"} cat > /tmp/doxyfile << EOF # Doxyfile 1.5.6 # Fichero para documentar codigo shellscripts linux. @@ -30,7 +32,7 @@ cat > /tmp/doxyfile << EOF # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "Proyecto OpenGnsys" +PROJECT_NAME = $PROJECT PROJECT_NUMBER = $VERSION OUTPUT_DIRECTORY = $2 PROJECT_LOGO = $(dirname "$0")/../doc/opengnsys-logo.png diff --git a/installer/opengnsys_export.sh b/installer/opengnsys_export.sh index 8e9c9ccd..747a795a 100755 --- a/installer/opengnsys_export.sh +++ b/installer/opengnsys_export.sh @@ -99,8 +99,8 @@ tar -cvzf $BACKUPFILE --transform="s!^!$BACKUPPREFIX/!" \ -C $TMPDIR IPSERVER.txt \ -C $DHCPDIR dhcpd.conf \ -C $OPENGNSYS/tftpboot menu.lst \ - -C $OPENGNSYS/doc VERSION.txt \ - -C $OPENGNSYS/client/etc engine.cfg \ + -C $OPENGNSYS/doc VERSION.json \ + -C $OPENGNSYS/client/etc engine.cfg engine.json \ -C $OPENGNSYS/www menus \ -C /etc default/opengnsys &>/dev/null diff --git a/installer/opengnsys_import.sh b/installer/opengnsys_import.sh index 26b7ede3..b2a9463b 100755 --- a/installer/opengnsys_import.sh +++ b/installer/opengnsys_import.sh @@ -220,12 +220,12 @@ if [ $? -ne 0 ]; then fi # Comprobamos si es la misma versión -OLDVERSION=$(awk '{print $2}' $TMPDIR/VERSION.txt) -NEWVERSION=$(awk '{print $2}' $OPENGNSYS/doc/VERSION.txt) +OLDVERSION=$(jq -r '.version' $TMPDIR/VERSION.json) +NEWVERSION=$(jq -r '.version' $OPENGNSYS/doc/VERSION.json) # FALTA: Comprobar que la versión OLD es menor que la NEW if [ $OLDVERSION != $NEWVERSION ] ; then echo "La versión del servidor no coincide con la del backup." - cat $OPENGNSYS/doc/VERSION.txt $TMPDIR/VERSION.txt + jq -r '[.project, .version, .codename] | join(" ")' $OPENGNSYS/doc/VERSION.json $TMPDIR/VERSION.json read -p "¿Quiere continuar? (y/n): " ANSWER if [ "${ANSWER^^}" != "Y" ]; then echo "Operación cancelada." diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 523aaaf2..c5375050 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1711,7 +1711,7 @@ if [ $? -ne 0 ]; then errorAndLog "Error while copying the server files!" exit 1 fi -INSTVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt) +INSTVERSION=$(jq -r '.version' $INSTALL_TARGET/doc/VERSION.json) # Instalar base de datos de OpenGnsys Admin. isInArray notinstalled "mysql-server" || isInArray notinstalled "mariadb-server" @@ -1771,7 +1771,7 @@ if [ $? -eq 0 ]; then fi else # Si existe fichero ogBDAdmin-VersLocal-VersRepo.sql; aplicar cambios. - REPOVERSION=$(awk '{print $2}' $WORKDIR/opengnsys/doc/VERSION.txt) + REPOVERSION=$(jq -r '.version' $WORKDIR/opengnsys/doc/VERSION.json) OPENGNSYS_DB_UPDATE_FILE="opengnsys/admin/Database/$OPENGNSYS_DATABASE-$INSTVERSION-$REPOVERSION.sql" if [ -f $WORKDIR/$OPENGNSYS_DB_UPDATE_FILE ]; then echoAndLog "Updating tables from version $INSTVERSION to $REPOVERSION" diff --git a/installer/opengnsys_makecompress.sh b/installer/opengnsys_makecompress.sh index 5c8aa729..ff267b1e 100755 --- a/installer/opengnsys_makecompress.sh +++ b/installer/opengnsys_makecompress.sh @@ -24,7 +24,7 @@ done BRANCH="devel" CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" -REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') +REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') # Descargar repositorio SVN cd /tmp @@ -36,10 +36,10 @@ chown -R root.root opengnsys WARNING=$? # Parchear datos de revisión del código. -sed -ri "s/$/ $REVISION/" opengnsys/doc/VERSION.txt +jq ".release=$REVISION" opengnsys/doc/VERSION.json | sponge opengnsys/doc/VERSION.json # Generar fichero comprimido. -VERSION=$(awk '{print $2"-"$3}' opengnsys/doc/VERSION.txt) +VERSION=$(jq -r '.version+"-"+.release' opengnsys/doc/VERSION.json) tar cvzf opengnsys-$VERSION.tar.gz opengnsys rm -fr opengnsys opengnsys.zip diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index 642d948d..3635f3d8 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -446,11 +446,12 @@ function checkVersion() local PRE # Obtener versión actual y versión a actualizar. - OLDVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt 2>/dev/null) + [ -f $INSTALL_TARGET/doc/VERSION.txt ] && OLDVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt 2>/dev/null) + [ -f $INSTALL_TARGET/doc/VERSION.json ] && OLDVERSION=$(jq -r '.version' $INSTALL_TARGET/doc/VERSION.json 2>/dev/null) if [ $REMOTE -eq 1 ]; then - NEWVERSION=$(curl -s $RAW_URL/doc/VERSION.txt 2>/dev/null | awk '{print $2}') + NEWVERSION=$(curl -s $RAW_URL/doc/VERSION.json 2>/dev/null | jq -r '.version') else - NEWVERSION=$(awk '{print $2}' $PROGRAMDIR/doc/VERSION.txt 2>/dev/null) + NEWVERSION=$(jq -r '.version' $PROGRAMDIR/doc/VERSION.json 2>/dev/null) fi [[ "$NEWVERSION" =~ pre ]] && PRE=1 -- cgit v1.2.3-18-g5258 From bf4b65c18d8d8a2eb156883863c2de8814718e9a Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Tue, 12 Jun 2018 15:25:43 +0200 Subject: #843: Web interface uses new version file and correcting some errata. --- admin/WebConsole/barramenu.php | 2 +- admin/WebConsole/index.php | 17 +++++++++++------ admin/WebConsole/nada.php | 9 ++++++++- admin/WebConsole/principal/acercade.php | 18 ++++++++++++------ installer/opengnsys_import.sh | 3 ++- installer/vagrant/Vagrantfile-devel-vbox | 2 +- 6 files changed, 35 insertions(+), 16 deletions(-) diff --git a/admin/WebConsole/barramenu.php b/admin/WebConsole/barramenu.php index d6561cfc..dfb618ed 100644 --- a/admin/WebConsole/barramenu.php +++ b/admin/WebConsole/barramenu.php @@ -13,7 +13,7 @@ if(stripos($device,'iphone') !== false ){$device="iphone";} elseif (stripos($device,'ipad') !== false) {$device="ipad";} elseif (stripos($device,'android') !== false){$device="android";} else{$device=0;} -$version=exec("cat /opt/opengnsys/doc/VERSION.txt"); +$version=@json_decode(file_get_contents("/opt/opengnsys/doc/VERSION.json"))->version; if(preg_match("/1.0.4/",$version) == TRUE ){$version=4;} // ******************************************************************************************************** include_once("./includes/ctrlacc.php"); diff --git a/admin/WebConsole/index.php b/admin/WebConsole/index.php index f416b7f3..2b522d59 100644 --- a/admin/WebConsole/index.php +++ b/admin/WebConsole/index.php @@ -120,15 +120,20 @@ function PulsaEnter(oEvento){
+ '; - include ($versionfile); - echo ''; +// Añadir versión en el enlace a la URL del proyecto. +$data = json_decode(@file_get_contents(__DIR__ . '/../doc/VERSION.json')); +if (empty($data->project)) { + echo "OpenGnsys"; +} else { + echo @$data->project.' ' + .@$data->version.' ' + .(isset($data->codename) ? '('.$data->codename.') ' : '') + .@$data->release; } ?> +
diff --git a/admin/WebConsole/nada.php b/admin/WebConsole/nada.php index 52d0d028..84e7b490 100644 --- a/admin/WebConsole/nada.php +++ b/admin/WebConsole/nada.php @@ -152,6 +152,13 @@ $vernav=end($buscavernav); if ($device == "ipad" || $device == "iphone" || $device == "android" ) { +$data = json_decode(@file_get_contents(__DIR__ . '/../doc/VERSION.json')); +if (empty($data->project)) { + $version = "OpenGnsys"; +} else { + $version = @$data->project.' ' . @$data->version.' ' + . (isset($data->codename) ? '('.$data->codename.') ' : '') . @$data->release; +} ?> @@ -168,7 +175,7 @@ if ($device == "ipad" || $device == "iphone" || $device == "android" ) - +   diff --git a/admin/WebConsole/principal/acercade.php b/admin/WebConsole/principal/acercade.php index 2981ce0e..f95e07c1 100644 --- a/admin/WebConsole/principal/acercade.php +++ b/admin/WebConsole/principal/acercade.php @@ -24,10 +24,15 @@ include_once("../idiomas/php/".$idioma."/acercade_".$idioma.".php");

project)) { + echo "OpenGnsys"; +} else { + echo @$data->project.' ' + .@$data->version.' ' + .(isset($data->codename) ? '('.$data->codename.') ' : '') + .@$data->release; +} ?>

".$TbMsg["CHANGE"].""; - include ($versionfile);} + echo "".$TbMsg["CHANGE"]."" + .@$data->project.' '.@$data->version.' '.(isset($data->codename)?'('.$data->codename.')':''); + } ?>

".$TbMsg["MANUAL"]."";?>

diff --git a/installer/opengnsys_import.sh b/installer/opengnsys_import.sh index b2a9463b..c3b343ee 100755 --- a/installer/opengnsys_import.sh +++ b/installer/opengnsys_import.sh @@ -220,7 +220,8 @@ if [ $? -ne 0 ]; then fi # Comprobamos si es la misma versión -OLDVERSION=$(jq -r '.version' $TMPDIR/VERSION.json) +[ -f $TMPDIR/VERSION.txt ] && OLDVERSION=$(awk '{print $2}' $TMPDIR/VERSION.txt) +[ -f $TMPDIR/VERSION.json ] && OLDVERSION=$(jq -r '.version' $TMPDIR/VERSION.json) NEWVERSION=$(jq -r '.version' $OPENGNSYS/doc/VERSION.json) # FALTA: Comprobar que la versión OLD es menor que la NEW if [ $OLDVERSION != $NEWVERSION ] ; then diff --git a/installer/vagrant/Vagrantfile-devel-vbox b/installer/vagrant/Vagrantfile-devel-vbox index 4d41afd0..00d7dab6 100644 --- a/installer/vagrant/Vagrantfile-devel-vbox +++ b/installer/vagrant/Vagrantfile-devel-vbox @@ -25,7 +25,7 @@ LOCALWEBPORT = 8443 # OpenGnsys Server provisioning script: prepare repo disk, install OpenGnsys, change default interface, configure DHCP server. OGSERVERSCRIPT = < Date: Tue, 12 Jun 2018 18:50:20 +0200 Subject: Updating changelog. --- doc/CHANGELOG.es.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/CHANGELOG.es.txt b/doc/CHANGELOG.es.txt index f86cb6af..3ce47074 100644 --- a/doc/CHANGELOG.es.txt +++ b/doc/CHANGELOG.es.txt @@ -6,6 +6,15 @@ LISTA DE CAMBIOS CHANGELOG.es.txt Lista de cambios incluidos en OpenGnsys 1.1.1 --------------------------------------------- +Tickets resueltos en módulo OpenGnsys Web Admin Console: +#772 Módulo de administración web para dispositivos smartphones y tablets (no se resolverá) +#816 Marcar ordenador de profesor +#824 Iniciar sistema restaurado (no integrado) +#835 Problemas al listar plantillas en Nerboot Avanzado + +Tickets genéricos resueltos: +#843 Incluir nombre de versión + Lista de cambios incluidos en OpenGnsys 1.1.0 --------------------------------------------- -- cgit v1.2.3-18-g5258 From a3a1ff21dde647ae1e3d8d9fc8552e039bcc3022 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Wed, 13 Jun 2018 08:10:25 +0200 Subject: #840: Checking permissions and directories after Git downloads. --- installer/opengnsys_update.sh | 3 ++- server/bin/checkperms | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index 3635f3d8..be36d643 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -179,6 +179,7 @@ function checkAutoUpdate() # Actaulizar el script si ha cambiado o no existe el original. if [ $REMOTE -eq 1 ]; then curl -s $RAW_URL/installer/$PROGRAMNAME -o $PROGRAMNAME + chmod +x $PROGRAMNAME if ! diff -q $PROGRAMNAME $INSTALL_TARGET/lib/$PROGRAMNAME 2>/dev/null || ! test -f $INSTALL_TARGET/lib/$PROGRAMNAME; then mv $PROGRAMNAME $INSTALL_TARGET/lib update=1 @@ -204,7 +205,7 @@ function getDateTime() # Escribe a fichero y muestra por pantalla function echoAndLog() { - echo $1 + echo "$1" DATETIME=`getDateTime` echo "$DATETIME;$SSH_CLIENT;$1" >> $LOG_FILE } diff --git a/server/bin/checkperms b/server/bin/checkperms index 0d80183c..fbe3be0f 100755 --- a/server/bin/checkperms +++ b/server/bin/checkperms @@ -37,6 +37,7 @@ if [ -z "$(getent passwd "$APACHE_USER" 2>/dev/null)" -o -z "$(getent group "$AP exit 1 fi +mkdir -p $OPENGNSYS_DIR/{log/clients,images/groups} chown -R :$OPENGNSYS_USER $OPENGNSYS_DIR/{log/clients,images/groups} find $OPENGNSYS_DIR/log/clients -type f -exec chmod 664 {} \; find $OPENGNSYS_DIR/images -maxdepth 1 -exec chown :$OPENGNSYS_USER {} \; @@ -50,8 +51,8 @@ chmod 600 $OPENGNSYS_DIR/etc/{ogAdmServer,ogAdmAgent}*.cfg chown root:$APACHE_GROUP $OPENGNSYS_DIR/{www/controlacceso*.php,etc/ogAdmRepo*.cfg} chmod 640 $OPENGNSYS_DIR/{www/controlacceso*.php,etc/ogAdmRepo*.cfg} chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/images/{fotos,iconos} -chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/api -chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/tmp # ??? +mkdir -p $OPENGNSYS_DIR/www/{api,tmp} +chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/{api,tmp} chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/tftpboot/menu.lst chown -R :$OPENGNSYS_USER $OPENGNSYS_DIR/tftpboot/ogLive* find -L $OPENGNSYS_DIR/tftpboot -type d -exec chmod 755 {} \; -- cgit v1.2.3-18-g5258 From e0e4c021382f2c8a66402c545229aa8e528750f9 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Thu, 14 Jun 2018 10:31:38 +0200 Subject: #840: Updating changelog, installation notes and README file. --- README.md | 23 +++++++++++++++++++++++ doc/CHANGELOG.es.txt | 4 ++-- doc/INSTALL.en.txt | 42 +++++++++++++++++++++++------------------- doc/INSTALL.es.txt | 4 ++-- 4 files changed, 50 insertions(+), 23 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..618df4fa --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# OpenGnsys + +The OpenGnsys Project (pronounced _Open Genesis_) brings together the combined efforts of +several Spanish Public Universities to provide a number of free and open source tools for +managing and deploying computers. These tools supply a complete, versatile and intuitive +system that allows the arrangement, installation and deployment of different operating +systems. + +OpenGnsys is based on a modular architecture separated into different service layers which +allows its implementation in several educational and organizational IT environments, both +in a centralized or distributed way. The main management of the system is carried out by +means of a simple web interface which supports delegated administration. OpenGnsys is also +suitable for isolated environments, being able to work in network failure conditions +(offline mode). + +OpenGnsys website: https://opengnsys.es/ + + +## Installation notes + +Please, read installer/README.en.txt (or installer/README.es.txt) for detailled +instructions. + diff --git a/doc/CHANGELOG.es.txt b/doc/CHANGELOG.es.txt index 3ce47074..9838335b 100644 --- a/doc/CHANGELOG.es.txt +++ b/doc/CHANGELOG.es.txt @@ -3,8 +3,8 @@ LISTA DE CAMBIOS CHANGELOG.es.txt -Lista de cambios incluidos en OpenGnsys 1.1.1 ---------------------------------------------- +Lista de cambios incluidos en OpenGnsys 1.1.1 Espeto +---------------------------------------------------- Tickets resueltos en módulo OpenGnsys Web Admin Console: #772 Módulo de administración web para dispositivos smartphones y tablets (no se resolverá) diff --git a/doc/INSTALL.en.txt b/doc/INSTALL.en.txt index 732ffea4..ef57ea18 100644 --- a/doc/INSTALL.en.txt +++ b/doc/INSTALL.en.txt @@ -1,23 +1,25 @@ -Installing OpenGnsys Server v 1.1.1 -=================================== +Installing OpenGnsys Server 1.1.1 (codename "Espeto") +===================================================== Before installation ------------------- -OpenGnsys Server 1.1.1 is meant to be installed under Ubuntu Server 16.04 LTS or newer, though it has also been tested under operating systems based on CentOS 7. +OpenGnsys Server 1.1.1 (Espeto) is mean to be installed under Ubuntu Server 16.04 LTS or newer, though it has also been tested under operating systems based on CentOS 7. Network connection is needed in order to download the required packages, the source code and the preconfigured client. Minimum storage requirements: - 100 MB in /tmp (for the installation process) -- 450 MB in /var/lib/tftpboot (or /srv in Debian systems) -- 500 MB in the installation folder (/opt/opengnsys) in addition to the space required for logging (100 MB if ogLive client is already downloaded). +- 600 MB in /var/lib/tftpboot (or /srv in Debian systems) for every installed ogLive client. +- 250 MB in the installation folder (/opt/opengnsys) plus 600 MB for every downloaded ISO image. - Enough disk space for the image repository in /opt/opengnsys/images (it is recommended to mount it on an independent file system) -Installation ------------- -To install OpenGnsys, run opengnsys_installer.sh after unpacking the release file (opengnsys-release.tar.gz) o downloading it directly from https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh + +Installing +---------- + +To install OpenGnsys, run opengnsys_installer.sh script after unpacking the release file (opengnsys-release.tar.gz) o downloading it directly from https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh Unpacking example: tar xvzf opengnsys-1.1.0.tar.gz @@ -41,23 +43,25 @@ The following information will be requested in order to configure the access to * Web console user and OpenGnsys Super Administrator * Web console user's password * Client's password for accessing remote services + * Choose which ogLive clients to install. + The following processes will be carried out: * Gathering of the basic network parameters. - * Checking the installed packages. + * Checking installed packages. * Downloading and installing dependencies. * Creating OpenGnsys basic folder sctructure. - * Download the code repository to a temporal folder (/tmp/opengnsys_installer). In upcoming releases this process will not be necessary. + * Download code from the repository to a temporal folder (/tmp/opengnsys_installer). In upcoming releases this process will not be necessary. * Compiling and installing OpenGnsys services. * Basic configuration of OpenGnsys network services (DHCP, PXE and Samba) using the existing configuration templates. * Copying additional server management files. - * Creating the database and configuring OpenGnsys administration console web server. - * Copying web administration console pages. - * Copying the OpenGnsys client folder structure. + * Creating database and configuring OpenGnsys administration console web server. + * Copying administration console pages. + * Copying OpenGnsys client folder structure. * Downloading OpenGnsys client initial image. * Basic configuration of OpenGnsys services using network parameters. -Once the installation is finished you can start working with the system: +Once the installation process is finished, you can start working with the system: * Configuring DHCP. * Adding information in the administration console. * Customizing administration scripts. @@ -79,12 +83,12 @@ You must be root to run this script: -Uninstall ---------- +Uninstalling +------------ -There is also an uninstall script for the OpenGnsys components: - * OpenGnsys files and data base will be deleted. - * Packages belonging to the operating system and their configuration files will be preserved. +There is also an uninstallation script to remove the OpenGnsys components: + * OpenGnsys files and database will be deleted. + * Operating system packages and their configuration files will be preserved. * The image folder and its content will not be deleted. You must be root to run this script: diff --git a/doc/INSTALL.es.txt b/doc/INSTALL.es.txt index d18bc5c6..280ba648 100644 --- a/doc/INSTALL.es.txt +++ b/doc/INSTALL.es.txt @@ -1,5 +1,5 @@ -Instalación de OpenGnsys Server v 1.1.1 -======================================= +Instalación de OpenGnsys Server 1.1.1 (Espeto) +============================================== Notas iniciales --------------- -- cgit v1.2.3-18-g5258