summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--README.md23
-rw-r--r--admin/Sources/Clients/ogagent/INSTALL.es.txt4
-rwxr-xr-xadmin/Sources/Clients/ogagent/linux/build-packages.sh6
-rw-r--r--admin/Sources/Clients/ogagent/linux/debian/changelog8
-rwxr-xr-xadmin/Sources/Clients/ogagent/macos/build-pkg.sh6
-rw-r--r--admin/Sources/Clients/ogagent/src/VERSION2
-rw-r--r--admin/Sources/Clients/ogagent/src/opengnsys/__init__.py11
-rw-r--r--admin/Sources/Clients/ogagent/src/setup.py23
-rwxr-xr-xadmin/Sources/Clients/ogagent/src/update.sh1
-rw-r--r--admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp4
-rw-r--r--admin/WebConsole/asistentes/jscripts/CrearImagen.js10
-rw-r--r--admin/WebConsole/asistentes/jscripts/IniciarSesion.js9
-rw-r--r--admin/WebConsole/asistentes/jscripts/InventarioSoftware.js4
-rw-r--r--admin/WebConsole/barramenu.php10
-rw-r--r--admin/WebConsole/clases/AdoPhp.php2
-rw-r--r--admin/WebConsole/clases/jscripts/ArbolVistaXML.js16
-rw-r--r--admin/WebConsole/comandos/EliminarImagenCache.php21
-rw-r--r--admin/WebConsole/estilos.css10
-rw-r--r--admin/WebConsole/gestores/gestor_aulas.php2
-rw-r--r--admin/WebConsole/gestores/gestor_ejecutaracciones.php620
-rw-r--r--admin/WebConsole/idiomas/javascripts/eng/propiedades_aulas_eng.js2
-rw-r--r--admin/WebConsole/images/M_Iconos.js169
-rw-r--r--admin/WebConsole/index.php17
-rw-r--r--admin/WebConsole/nada.php9
-rw-r--r--admin/WebConsole/principal/acercade.php18
-rw-r--r--admin/WebConsole/rest/common.php22
-rw-r--r--admin/WebConsole/rest/opengnsys-api.yml8
-rw-r--r--admin/WebConsole/rest/remotepc.php24
-rw-r--r--admin/WebConsole/rest/server.php82
-rwxr-xr-xclient/boot-tools/boottoolsfunctions.lib4
-rw-r--r--doc/CHANGELOG.es.txt13
-rw-r--r--doc/INSTALL.en.txt48
-rw-r--r--doc/INSTALL.es.txt14
-rw-r--r--doc/VERSION.json7
-rw-r--r--doc/VERSION.txt1
-rw-r--r--installer/INSTALL.es.txt6
-rwxr-xr-xinstaller/ogGenerateDoc.sh8
-rwxr-xr-xinstaller/ogagent-devel-installer.sh10
-rwxr-xr-xinstaller/opengnsys_export.sh4
-rwxr-xr-xinstaller/opengnsys_import.sh11
-rwxr-xr-xinstaller/opengnsys_installer.sh55
-rwxr-xr-xinstaller/opengnsys_makecompress.sh25
-rwxr-xr-xinstaller/opengnsys_update.sh90
-rw-r--r--installer/vagrant/README.es.txt4
-rw-r--r--installer/vagrant/Vagrantfile-boottools-vbox2
-rw-r--r--installer/vagrant/Vagrantfile-browser-vbox2
-rw-r--r--installer/vagrant/Vagrantfile-devel-vbox8
-rw-r--r--installer/vagrant/Vagrantfile-ogagent-vbox6
-rw-r--r--installer/vagrant/Vagrantfile-prod-vbox (renamed from installer/vagrant/Vagrantfile-trunk-vbox)6
-rwxr-xr-xserver/bin/checkperms5
-rwxr-xr-xserver/lib/supportsave208
52 files changed, 1008 insertions, 673 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..485dee64
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.idea
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/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 <ramongomez@us.es> 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 <ramongomez@us.es> Tue, 13 Oct 2016 17:00:00 +0200
+ -- Ramón M. Gómez <ramongomez@us.es> 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
<?xml version="1.0" encoding="utf-8"?>
<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.3" authoringToolBuild="174">
- <title>OGAgent 1.1.0</title>
+ <title>OGAgent $VERSION</title>
<options customize="never" allow-external-scripts="no"/>
<domains enable_anywhere="true"/>
<installation-check script="pm_install_check();"/>
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
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<ochecks.length;i++){
- if(ochecks[i].checked) op++;
+ if(ochecks[i].checked)
+ op++;
}
if(op==0){
- alert(TbMsg[1]);
- return(false);
+ alert(TbMsg[1]);
+ return(false);
}
return(comprobar_datosejecucion())
}
diff --git a/admin/WebConsole/asistentes/jscripts/InventarioSoftware.js b/admin/WebConsole/asistentes/jscripts/InventarioSoftware.js
index 4a1ffef6..bcbc9af0 100644
--- a/admin/WebConsole/asistentes/jscripts/InventarioSoftware.js
+++ b/admin/WebConsole/asistentes/jscripts/InventarioSoftware.js
@@ -37,8 +37,8 @@
if(ochecks[i].checked) op++;
}
if(op==0){
- alert(TbMsg[1]);
- return(false);
+ alert(TbMsg[1]);
+ return(false);
}
return(comprobar_datosejecucion());
}
diff --git a/admin/WebConsole/barramenu.php b/admin/WebConsole/barramenu.php
index 77c8c159..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");
@@ -178,10 +178,10 @@ if (!$cmd)
<TR valign=baseline>
<TD width=10><IMG src="./images/iconos/pomo.gif"></TD>
<?php if($idtipousuario!=$SUPERADMINISTRADOR){?>
- <TD onclick=eleccion(this,1); onmouseout=desresaltar(this); onmouseover=resaltar(this) >
+ <TD onclick=eleccion(this,1); onmouseout=desresaltar(this); onmouseover=resaltar(this)>
&nbsp;<A href="#" style="text-decoration: none"><IMG border=0 src="./images/iconos/centros.gif">&nbsp;<SPAN class="menupral"><?php echo $TbMsg[0]?></SPAN></A>&nbsp;</TD>
<TD width=4 align=middle><IMG src="./images/iconos/separitem.gif"></TD>
- <TD onclick=eleccion(this,2); onmouseout=desresaltar(this); onmouseover=resaltar(this); align=middle>
+ <TD onclick=eleccion(this,2); onmouseout=desresaltar(this); onmouseover=resaltar(this); align=middle>
&nbsp;<A href="#" style="text-decoration: none"><IMG border=0 src="./images/iconos/acciones.gif">&nbsp;<SPAN class=menupral ><?php echo $TbMsg[1]?></SPAN></A>&nbsp;</TD>
<TD width=4 align=middle><IMG src="./images/iconos/separitem.gif"></TD>
<TD onclick=eleccion(this,3); onmouseout=desresaltar(this); onmouseover=resaltar(this); align=middle>
@@ -202,11 +202,11 @@ if (!$cmd)
<td onclick="eleccion(this,14)" onmouseout="desresaltar(this)" onmouseover="resaltar(this)" align="middle">
&nbsp;<a href="#" style="text-decoration: none"><img border="0" src="./images/iconos/busquedas.gif">&nbsp;<span class="menupral"><?php echo $TbMsg[14] ?></span></a>&nbsp;</td>
<td width="4" align="middle"><img src="./images/iconos/separitem.gif"></td>
-
+
<!--TD onclick=eleccion(this,8) onmouseout=desresaltar(this) onmouseover=resaltar(this) align=middle>
&nbsp;<A href="#" style="text-decoration: none"><IMG border=0 src="./images/iconos/reservas.gif">&nbsp;<SPAN class=menupral ><?php echo $TbMsg[7] ?></SPAN></A>&nbsp;</TD>
<TD width=4 align=middle><IMG src="./images/iconos/separitem.gif"></TD-->
-
+
<?php }
else{
if($idtipousuario==$SUPERADMINISTRADOR){?>
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 @@
-<?php
-// *************************************************************************************************************************************************
-// Aplicación WEB: ogAdmWebCon
-// Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla
-// Fecha Creación: Año 2009-2010
-// Fecha Última modificación: Mayo-2005
-// Nombre del fichero: gestor_procedimientos.php
-// Descripción :
-// Gestiona la ejecución de procedimientos
-// *************************************************************************************************************************************************
-include_once("../includes/ctrlacc.php");
-include_once("../clases/AdoPhp.php");
-include_once("../clases/XmlPhp.php");
-include_once("../clases/ArbolVistaXML.php");
-include_once("../clases/SockHidra.php");
-include_once("../includes/CreaComando.php");
-include_once("../includes/constantes.php");
-include_once("../includes/comunes.php");
-include_once("../includes/RecopilaIpesMacs.php");
-//________________________________________________________________________________________________________
-
-$opcion=0; // Inicializa parametros
-
-$idprocedimiento=0;
-$idtarea=0;
-$ambito=0;
-$idambito=0;
-$swc=0; // switch de cliente, esta pagina la llama el cliente a través del browser
-
-if (isset($_POST["opcion"])) $opcion=$_POST["opcion"];
-if (isset($_POST["idprocedimiento"])) $idprocedimiento=$_POST["idprocedimiento"];
-if (isset($_POST["descriprocedimiento"])) $descriprocedimiento=$_POST["descriprocedimiento"];
-if (isset($_POST["ambito"])) $ambito=$_POST["ambito"];
-if (isset($_POST["idambito"])) $idambito=$_POST["idambito"];
-if (isset($_POST["idtarea"])) $idtarea=$_POST["idtarea"];
-if (isset($_POST["descritarea"])) $descritarea=$_POST["descritarea"];
-
-if (isset($_GET["opcion"])) $opcion=$_GET["opcion"];
-if (isset($_GET["idprocedimiento"])) $idprocedimiento=$_GET["idprocedimiento"];
-if (isset($_GET["descriprocedimiento"]))$descriprocedimiento=$_GET["descriprocedimiento"];
-if (isset($_GET["ambito"])) $ambito=$_GET["ambito"];
-if (isset($_GET["idambito"])) $idambito=$_GET["idambito"];
-if (isset($_GET["idtarea"])) $idtarea=$_GET["idtarea"];
-if (isset($_GET["descritarea"])) $descritarea=$_GET["descritarea"];
-
-if (isset($_GET["swc"])) $swc=$_GET["swc"]; // Switch que indica que la página la solicita un cliente a través del browser
-
-$cmd=CreaComando($cadenaconexion); // Crea objeto comando
-$resul=false;
-if ($cmd){
- $shidra=new SockHidra($servidorhidra,$hidraport);
- $cadenaid="";
- $cadenaip="";
- $cadenamac="";
- $sesion=0;
- $vez=0;
- if(opcion!=$EJECUCION_TAREA)
- RecopilaIpesMacs($cmd,$ambito,$idambito); // Recopila Ipes del ámbito
- if(opcion!=$EJECUCION_AUTOEXEC){
- //Creación parametros para inserción en tabla acciones
- $sesion=time();
- $cmd->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 '<SCRIPT language="javascript">'.chr(13);
- echo 'alert("El item se ha ejecutado correctamente");'.chr(13);
- echo 'var wurl="../varios/menucliente.php?iph='.trim($_SESSION["ogCliente"]).'";';
- echo 'history.back();';
- echo '</SCRIPT>';
- }
-}
-else{
- if(empty($swc)){
- echo $literal."(0,'".$cmd->DescripUltimoError()."')";
- }
- else{
- echo '<SCRIPT language="javascript">'.chr(13);
- echo 'alert("***ATENCIÓN:El item NO se ha podido ejecutar");'.chr(13);
- echo 'var wurl="../varios/menucliente.php?iph='.trim($_SESSION["ogCliente"]).'";';
- echo 'location.href=wurl;';
- echo '</SCRIPT>';
- }
-}
-//********************************************************************************************************
-//
-// 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;$i<sizeof($auxID);$i++){
- $cmd->ParamSetValor("@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);
-}
-?>
-
+<?php
+// *************************************************************************************************************************************************
+// Aplicación WEB: ogAdmWebCon
+// Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla
+// Fecha Creación: Año 2009-2010
+// Fecha Última modificación: Mayo-2005
+// Nombre del fichero: gestor_procedimientos.php
+// Descripción :
+// Gestiona la ejecución de procedimientos
+// *************************************************************************************************************************************************
+include_once("../includes/ctrlacc.php");
+include_once("../clases/AdoPhp.php");
+include_once("../clases/XmlPhp.php");
+include_once("../clases/ArbolVistaXML.php");
+include_once("../clases/SockHidra.php");
+include_once("../includes/CreaComando.php");
+include_once("../includes/constantes.php");
+include_once("../includes/comunes.php");
+include_once("../includes/RecopilaIpesMacs.php");
+//________________________________________________________________________________________________________
+
+$opcion=0; // Inicializa parametros
+
+$idprocedimiento=0;
+$idtarea=0;
+$ambito=0;
+$idambito=0;
+$swc=0; // switch de cliente, esta pagina la llama el cliente a través del browser
+
+if (isset($_POST["opcion"])) $opcion=$_POST["opcion"];
+if (isset($_POST["idprocedimiento"])) $idprocedimiento=$_POST["idprocedimiento"];
+if (isset($_POST["descriprocedimiento"])) $descriprocedimiento=$_POST["descriprocedimiento"];
+if (isset($_POST["ambito"])) $ambito=$_POST["ambito"];
+if (isset($_POST["idambito"])) $idambito=$_POST["idambito"];
+if (isset($_POST["idtarea"])) $idtarea=$_POST["idtarea"];
+if (isset($_POST["descritarea"])) $descritarea=$_POST["descritarea"];
+
+if (isset($_GET["opcion"])) $opcion=$_GET["opcion"];
+if (isset($_GET["idprocedimiento"])) $idprocedimiento=$_GET["idprocedimiento"];
+if (isset($_GET["descriprocedimiento"]))$descriprocedimiento=$_GET["descriprocedimiento"];
+if (isset($_GET["ambito"])) $ambito=$_GET["ambito"];
+if (isset($_GET["idambito"])) $idambito=$_GET["idambito"];
+if (isset($_GET["idtarea"])) $idtarea=$_GET["idtarea"];
+if (isset($_GET["descritarea"])) $descritarea=$_GET["descritarea"];
+
+if (isset($_GET["swc"])) $swc=$_GET["swc"]; // Switch que indica que la página la solicita un cliente a través del browser
+
+$cmd=CreaComando($cadenaconexion); // Crea objeto comando
+$resul=false;
+if ($cmd){
+ $shidra=new SockHidra($servidorhidra,$hidraport);
+ $cadenaid="";
+ $cadenaip="";
+ $cadenamac="";
+ $sesion=0;
+ $vez=0;
+ if(opcion!=$EJECUCION_TAREA)
+ RecopilaIpesMacs($cmd,$ambito,$idambito); // Recopila Ipes del ámbito
+ if(opcion!=$EJECUCION_AUTOEXEC){
+ //Creación parametros para inserción en tabla acciones
+ $sesion=time();
+ $cmd->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 '<SCRIPT language="javascript">'.chr(13);
+ echo 'alert("El item se ha ejecutado correctamente");'.chr(13);
+ echo 'var wurl="../varios/menucliente.php?iph='.trim($_SESSION["ogCliente"]).'";';
+ echo 'history.back();';
+ echo '</SCRIPT>';
+ }
+}
+else{
+ if(empty($swc)){
+ echo $literal."(0,'".$cmd->DescripUltimoError()."')";
+ }
+ else{
+ echo '<SCRIPT language="javascript">'.chr(13);
+ echo 'alert("***ATENCIÓN:El item NO se ha podido ejecutar");'.chr(13);
+ echo 'var wurl="../varios/menucliente.php?iph='.trim($_SESSION["ogCliente"]).'";';
+ echo 'location.href=wurl;';
+ echo '</SCRIPT>';
+ }
+}
+//********************************************************************************************************
+//
+// 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;$i<sizeof($auxID);$i++){
+ $cmd->ParamSetValor("@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)
+}
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){
</form>
</div>
<div class="pie">
+<span><a href="https://opengnsys.es/">
<?php
-// Añadir versión y URL al proyecto.
-$versionfile="../doc/VERSION.txt";
-if (file_exists ($versionfile)) {
- echo '<span><a href="https://opengnsys.es/">';
- include ($versionfile);
- echo '</a></span>';
+// 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;
}
?>
+</a></span>
<form action="#" name="lang" method="post">
<?php echo HTMLSELECT($cmd,0,'idiomas',$idi,'nemonico','descripcion',80); ?>
<button type="submit"><?php echo $TbMsg["ACCESS_CHOOSE"]; ?></button>
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;
+}
?>
<html>
<head>
@@ -168,7 +175,7 @@ if ($device == "ipad" || $device == "iphone" || $device == "android" )
<td colspan="3" align="center"><SPAN align=center class=cabeceras><font size="4"><?php echo $TbMsg[0] ;?></font></SPAN></td>
</tr>
<tr>
- <td colspan="3" align="center"><SPAN align=center class=cabeceras><font size="4"><?php $versionfile="../doc/VERSION.txt";if (file_exists ($versionfile)){include ($versionfile);} ;?></font></SPAN></td>
+ <td colspan="3" align="center"><SPAN align=center class=cabeceras><font size="4"><?php echo $version; ?></font></SPAN></td>
</tr>
<tr>
<td colspan="3" align="center">&nbsp;</td>
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");
<p>
<?php
// Añadir versión.
-$versionfile="../../doc/VERSION.txt";
-if (file_exists ($versionfile))
- include ($versionfile);
-
+$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) ? '(<a href="'.@$data->definition.'" target="_blank">'.$data->codename.'</a>) ' : '')
+ .@$data->release;
+}
?>
</p>
<?php
@@ -129,8 +134,9 @@ fclose($crearficheroinicio);
<p><?php
if (file_exists ($changelogfile)){
system("cp ../../doc/$buschangelog ../api");
- echo "<strong><a href='../api/$buschangelog' target='_blank'>".$TbMsg["CHANGE"]."</a></strong>";
- include ($versionfile);}
+ echo "<strong><a href='../api/$buschangelog' target='_blank'>".$TbMsg["CHANGE"]."</a></strong>"
+ .@$data->project.' '.@$data->version.' '.(isset($data->codename)?'('.$data->codename.')':'');
+ }
?></p>
<p><?php echo "<strong><a href='$ficheroinicio' target='_blank'>".$TbMsg["MANUAL"]."</a></strong>";?></p>
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
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 = <<<EOD
-SELECT adm.idadministradorcentro, entornos.ipserveradm, entornos.portserveradm,
+SELECT adm.idusuario, entornos.ipserveradm, entornos.portserveradm,
ordenadores.idordenador, ordenadores.nombreordenador, ordenadores.ip,
ordenadores.mac, ordenadores.agentkey, ordenadores_particiones.numdisk,
ordenadores_particiones.numpar, aulas.idaula, aulas.idcentro
@@ -92,7 +92,7 @@ SELECT adm.idadministradorcentro, entornos.ipserveradm, entornos.portserveradm,
RIGHT JOIN ordenadores_particiones USING(idordenador)
RIGHT JOIN imagenes USING(idimagen)
LEFT JOIN remotepc ON remotepc.id=ordenadores.idordenador
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND aulas.idcentro = '$ouid' AND aulas.idaula LIKE '$labid' AND aulas.inremotepc = 1
AND imagenes.idimagen = '$imageid' AND imagenes.inremotepc = 1
AND (remotepc.reserved < NOW() OR ISNULL(reserved))
@@ -103,7 +103,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, ordenadores.idordenador, remotepc.*
+SELECT adm.idusuario, ordenadores.idordenador, remotepc.*
FROM remotepc
RIGHT JOIN ordenadores ON remotepc.id=ordenadores.idordenador
JOIN aulas USING(idaula)
RIGHT JOIN administradores_centros AS adm USING(idcentro)
RIGHT JOIN usuarios USING(idusuario)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND idcentro = '$ouid' AND aulas.idaula ='$labid'
AND ordenadores.idordenador = '$clntid';
EOD;
@@ -305,7 +305,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, ordenadores.idordenador, remotepc.*
+SELECT adm.idusuario, ordenadores.idordenador, remotepc.*
FROM remotepc
RIGHT JOIN ordenadores ON remotepc.id=ordenadores.idordenador
JOIN aulas USING(idaula)
RIGHT JOIN administradores_centros AS adm USING(idcentro)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND aulas.idcentro = '$ouid' AND aulas.idaula = '$labid'
AND ordenadores.idordenador = '$clntid';
EOD;
@@ -395,7 +395,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, ordenadores.idordenador, ordenadores.ip, ordenadores.agentkey, remotepc.reserved
+SELECT adm.idusuario, ordenadores.idordenador, ordenadores.ip, ordenadores.agentkey, remotepc.reserved
FROM remotepc
RIGHT JOIN ordenadores ON remotepc.id=ordenadores.idordenador
JOIN aulas USING(idaula)
RIGHT JOIN administradores_centros AS adm USING(idcentro)
RIGHT JOIN usuarios USING(idusuario)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND idcentro = '$ouid' AND aulas.idaula ='$labid'
AND ordenadores.idordenador = '$clntid';
EOD;
@@ -494,7 +494,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, entornos.ipserveradm, entornos.portserveradm,
+SELECT adm.idusuario, entornos.ipserveradm, entornos.portserveradm,
aulas.idaula, ordenadores.idordenador, ordenadores.ip
FROM entornos, ordenadores
JOIN aulas USING(idaula)
RIGHT JOIN administradores_centros AS adm USING(idcentro)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND adm.idcentro='$ouid'
AND aulas.idaula='$labid'
EOD;
@@ -111,7 +111,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, grupos.*
+SELECT adm.idusuario, grupos.*
FROM grupos
RIGHT JOIN administradores_centros AS adm USING(idcentro)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND idcentro='$ouid';
EOD;
$rs=new Recordset;
@@ -364,7 +364,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, aulas.*, grp.idgrupo AS group_id,
+SELECT adm.idusuario, aulas.*, grp.idgrupo AS group_id,
grp.nombregrupoordenador, grp.grupoid AS group_group_id, grp.comentarios
FROM aulas
RIGHT JOIN administradores_centros AS adm USING(idcentro)
LEFT JOIN gruposordenadores AS grp USING(idaula)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND adm.idcentro='$ouid'
ORDER BY aulas.idaula, grp.idgrupo
EOD;
@@ -415,7 +415,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, COUNT(idordenador) AS defclients, aulas.*
+SELECT adm.idusuario, COUNT(idordenador) AS defclients, aulas.*
FROM aulas
RIGHT JOIN administradores_centros AS adm USING(idcentro)
LEFT JOIN ordenadores USING(idaula)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND idcentro='$ouid'
AND idaula='$labid';
EOD;
@@ -491,7 +491,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, ordenadores.*, aulas.idaula AS labid
+SELECT adm.idusuario, ordenadores.*, aulas.idaula AS labid
FROM ordenadores
RIGHT JOIN aulas USING(idaula)
RIGHT JOIN administradores_centros AS adm USING(idcentro)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND adm.idcentro='$ouid'
AND aulas.idaula='$labid';
EOD;
@@ -556,7 +556,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, ordenadores.*,
+SELECT adm.idusuario, ordenadores.*,
IF(ordenadores.idordenador=aulas.idordprofesor, 1, 0) AS profclient
FROM ordenadores
JOIN aulas USING(idaula)
RIGHT JOIN administradores_centros AS adm USING(idcentro)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND idcentro='$ouid'
AND idaula='$labid'
AND idordenador='$clntid';
@@ -619,7 +619,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, ordenadores.idordenador, ordenadores.nombreordenador,
+SELECT adm.idusuario, ordenadores.idordenador, ordenadores.nombreordenador,
tipohardwares.nemonico, hardwares.descripcion
FROM ordenadores
JOIN aulas USING(idaula)
@@ -669,7 +669,7 @@ SELECT adm.idadministradorcentro, ordenadores.idordenador, ordenadores.nombreord
LEFT JOIN perfileshard_hardwares USING(idperfilhard)
LEFT JOIN hardwares ON perfileshard_hardwares.idhardware=hardwares.idhardware
LEFT JOIN tipohardwares ON tipohardwares.idtipohardware=hardwares.idtipohardware
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND adm.idcentro='$ouid'
AND aulas.idaula='$labid'
AND ordenadores.idordenador='$clntid';
@@ -679,7 +679,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, ordenadores.idordenador AS clientid,
+SELECT adm.idusuario, ordenadores.idordenador AS clientid,
ordenadores.nombreordenador, ordenadores_particiones.*, tipospar.tipopar,
sistemasficheros.nemonico, nombresos.nombreso, imagenes.nombreca,
(imagenes.revision - ordenadores_particiones.revision) AS difimagen
@@ -729,7 +729,7 @@ SELECT adm.idadministradorcentro, ordenadores.idordenador AS clientid,
LEFT JOIN sistemasficheros USING(idsistemafichero)
LEFT JOIN nombresos USING(idnombreso)
LEFT JOIN imagenes USING(idimagen)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND adm.idcentro='$ouid'
AND aulas.idaula='$labid'
AND ordenadores.idordenador='$clntid'
@@ -740,7 +740,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, adm.idcentro AS ouid, repositorios.*
+SELECT adm.idusuario, adm.idcentro AS ouid, repositorios.*
FROM repositorios
RIGHT JOIN administradores_centros AS adm USING(idcentro)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND adm.idcentro='$ouid';
EOD;
$rs=new Recordset;
@@ -826,7 +826,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, repositorios.*
+SELECT adm.idusuario, repositorios.*
FROM repositorios
RIGHT JOIN administradores_centros AS adm USING(idcentro)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND adm.idcentro='$ouid'
AND idrepositorio='$repoid';
EOD;
@@ -872,7 +872,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, adm.idcentro AS ouid, imagenes.*
+SELECT adm.idusuario, adm.idcentro AS ouid, imagenes.*
FROM imagenes
RIGHT JOIN administradores_centros AS adm USING(idcentro)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND adm.idcentro='$ouid';
EOD;
$rs=new Recordset;
@@ -910,7 +910,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, imagenes.*, nombreso AS os
+SELECT adm.idusuario, imagenes.*, nombreso AS os
FROM imagenes
RIGHT JOIN administradores_centros AS adm USING(idcentro)
LEFT JOIN perfilessoft USING(idperfilsoft)
LEFT JOIN nombresos USING(idnombreso)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND adm.idcentro='$ouid'
AND idimagen='$imgid';
EOD;
@@ -958,7 +958,7 @@ EOD;
if (!$rs->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 = <<<EOD
-SELECT adm.idadministradorcentro, imagenes.idimagen, imagenes.nombreca,
+SELECT adm.idusuario, imagenes.idimagen, imagenes.nombreca,
nombresos.nombreso, softwares.descripcion
FROM imagenes
RIGHT JOIN administradores_centros AS adm USING(idcentro)
@@ -1015,7 +1015,7 @@ SELECT adm.idadministradorcentro, imagenes.idimagen, imagenes.nombreca,
LEFT JOIN nombresos USING(idnombreso)
LEFT JOIN perfilessoft_softwares USING(idperfilsoft)
LEFT JOIN softwares USING(idsoftware)
- WHERE adm.idadministradorcentro = '$userid'
+ WHERE adm.idusuario = '$userid'
AND adm.idcentro='$ouid'
AND imagenes.idimagen='$imgid'
ORDER BY softwares.descripcion ASC;
@@ -1025,7 +1025,7 @@ EOD;
if (!$rs->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"])) {
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/doc/CHANGELOG.es.txt b/doc/CHANGELOG.es.txt
index f86cb6af..9838335b 100644
--- a/doc/CHANGELOG.es.txt
+++ b/doc/CHANGELOG.es.txt
@@ -3,8 +3,17 @@ 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á)
+#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
diff --git a/doc/INSTALL.en.txt b/doc/INSTALL.en.txt
index 4eef6920..ef57ea18 100644
--- a/doc/INSTALL.en.txt
+++ b/doc/INSTALL.en.txt
@@ -1,35 +1,37 @@
-Installing OpenGnsys Server v 1.0.5
-=======================================
+Installing OpenGnsys Server 1.1.1 (codename "Espeto")
+=====================================================
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 (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://opengnsys.es/svn/trunk/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.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:
@@ -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 4cc54344..280ba648 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 1.1.1 (Espeto)
+==============================================
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/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
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/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/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/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 6f15ed90..c3b343ee 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.
@@ -219,19 +220,19 @@ 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)
+[ -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
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."
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 8998a442..e8cd38c2 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
@@ -788,11 +790,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"
@@ -801,14 +803,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
}
@@ -1075,7 +1078,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
@@ -1204,7 +1206,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/{cache,images,log}
mkdir -p $path_opengnsys_base/doc
mkdir -p $path_opengnsys_base/etc
mkdir -p $path_opengnsys_base/lib
@@ -1399,7 +1401,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
@@ -1554,21 +1555,25 @@ EOT
function installationSummary()
{
+ local VERSIONFILE REVISION
+
# Crear fichero de versión y revisión, si no existe.
- local 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 [ $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}')
- sed -ri "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE
+ 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" + (.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"
@@ -1658,10 +1663,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
@@ -1708,7 +1713,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"
@@ -1768,7 +1773,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 ab05b5ce..ff267b1e 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 | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])')
# 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
+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
+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/opengnsys_update.sh b/installer/opengnsys_update.sh
index 99eac4a9..0a6631f7 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 python-pip )
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 python-pip )
# 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,9 @@ 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
+ 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
@@ -201,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
}
@@ -396,10 +400,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"
@@ -408,14 +412,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
}
@@ -428,7 +433,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.
@@ -437,11 +449,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)
- if [ $USESVN -eq 1 ]; then
- NEWVERSION=$(curl -s $SVN_URL/doc/VERSION.txt 2>/dev/null | awk '{print $2}')
+ [ -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.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
@@ -482,16 +495,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
@@ -606,7 +618,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
@@ -651,7 +663,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"
@@ -662,7 +674,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
}
@@ -674,7 +686,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
@@ -831,7 +843,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
@@ -964,7 +976,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
@@ -1019,16 +1031,20 @@ 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}')
-
- [ -f $VERSIONFILE ] || echo "OpenGnsys" >$VERSIONFILE
- perl -pi -e "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE
+ local VERSIONFILE REVISION
+ 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" + (.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)"
@@ -1114,10 +1130,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
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-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
diff --git a/installer/vagrant/Vagrantfile-devel-vbox b/installer/vagrant/Vagrantfile-devel-vbox
index c8eb022f..00d7dab6 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.
@@ -25,7 +25,7 @@ LOCALWEBPORT = 8443
# OpenGnsys Server provisioning script: prepare repo disk, install OpenGnsys, change default interface, configure DHCP server.
OGSERVERSCRIPT = <<EOT
# Exit if OpenGnsys is installed.
-[ -f /opt/opengnsys/doc/VERSION.txt ] && echo "Cannot provision, OpenGnsys is already installed." && exit 1
+[ -f /opt/opengnsys/doc/VERSION.json ] && echo "Cannot provision, OpenGnsys is already installed." && exit 1
# Create repository disk using LVM, if necesary.
if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then
pvcreate /dev/sdb
@@ -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 = <<EOT
# Comment out next lines to install and configure OGAgent for Ubuntu.
#apt-get update -y
-#wget -q --no-check-certificate https://#{SERVERIP}/opengnsys/descargas/#{OGAGENTPKG}
+#curl -ks https://#{SERVERIP}/opengnsys/descargas/#{OGAGENTPKG} -o #{OGAGENTPKG}
#if [ -f #{OGAGENTPKG} ]; then
# dpkg -i #{OGAGENTPKG}
# apt-get install -fy || exit $?
diff --git a/installer/vagrant/Vagrantfile-ogagent-vbox b/installer/vagrant/Vagrantfile-ogagent-vbox
index 22ddfe54..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.
-svn export https://opengnsys.es/svn/branches/version1.1/installer/ogagent-devel-installer.sh /home/vagrant
+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"
diff --git a/installer/vagrant/Vagrantfile-trunk-vbox b/installer/vagrant/Vagrantfile-prod-vbox
index 75dbcd11..813ee962 100644
--- a/installer/vagrant/Vagrantfile-trunk-vbox
+++ b/installer/vagrant/Vagrantfile-prod-vbox
@@ -1,4 +1,4 @@
-# Vagrantfile to install OpenGnsys Trunk (v1.1.0) virtual environment using VirtualBox provider.
+# Vagrantfile to install OpenGnsys virtual environment (production 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/trunk/installer/opengnsys_installer.sh -O - | bash || exit $?
+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.
@@ -73,7 +73,7 @@ OGAGENTPKG = "ogagent_1.1.0_all.deb"
MODELSCRIPT = <<EOT
# Comment out next lines to install and configure OGAgent for Ubuntu.
#apt-get update -y
-#wget -q --no-check-certificate https://#{SERVERIP}/opengnsys/descargas/#{OGAGENTPKG}
+#curl -ks https://#{SERVERIP}/opengnsys/descargas/#{OGAGENTPKG} -o #{OGAGENTPKG}
#if [ -f #{OGAGENTPKG} ]; then
# dpkg -i #{OGAGENTPKG}
# apt-get install -fy || exit $?
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 {} \;
diff --git a/server/lib/supportsave b/server/lib/supportsave
new file mode 100755
index 00000000..67da7ed2
--- /dev/null
+++ b/server/lib/supportsave
@@ -0,0 +1,208 @@
+#!/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 <aluque@soleta.eu> 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 "- Kernel boot messages"
+echo "--- dmesg ---" >> $backup_dir/kernel.txt
+dmesg >> $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