diff options
22 files changed, 366 insertions, 77 deletions
diff --git a/admin/WebConsole/idiomas/php/cat/estados_cat.php b/admin/WebConsole/idiomas/php/cat/estados_cat.php index dfedfa42..8c3fd1da 100644 --- a/admin/WebConsole/idiomas/php/cat/estados_cat.php +++ b/admin/WebConsole/idiomas/php/cat/estados_cat.php @@ -19,5 +19,5 @@ $TbMsg["STATUS_LNXS"]="Sessió GNU/Linux"; $TbMsg["STATUS_OSX"]="macOS"; $TbMsg["STATUS_WIN"]="Windows"; $TbMsg["STATUS_WINS"]="Sessió Windows"; - - +// Estats WoL +$TbMsg["STATUS_WOL_SENT"]="WoL enviat"; diff --git a/admin/WebConsole/idiomas/php/eng/estados_eng.php b/admin/WebConsole/idiomas/php/eng/estados_eng.php index c5f2ed7b..85af4c41 100644 --- a/admin/WebConsole/idiomas/php/eng/estados_eng.php +++ b/admin/WebConsole/idiomas/php/eng/estados_eng.php @@ -19,3 +19,5 @@ $TbMsg["STATUS_LNXS"]="GNU/Linux session"; $TbMsg["STATUS_OSX"]="MacOS"; $TbMsg["STATUS_WIN"]="Windows"; $TbMsg["STATUS_WINS"]="Windows session"; +// WoL states +$TbMsg["STATUS_WOL_SENT"]="WoL sent"; diff --git a/admin/WebConsole/idiomas/php/esp/estados_esp.php b/admin/WebConsole/idiomas/php/esp/estados_esp.php index b1fce40f..3b54cc90 100644 --- a/admin/WebConsole/idiomas/php/esp/estados_esp.php +++ b/admin/WebConsole/idiomas/php/esp/estados_esp.php @@ -19,5 +19,5 @@ $TbMsg["STATUS_LNXS"]="Sesión GNU/Linux"; $TbMsg["STATUS_OSX"]="macOS"; $TbMsg["STATUS_WIN"]="Windows"; $TbMsg["STATUS_WINS"]="Sesión Windows"; - - +// Estados WoL +$TbMsg["STATUS_WOL_SENT"]="WoL enviado"; diff --git a/admin/WebConsole/images/ordenador_WOL_SENT.png b/admin/WebConsole/images/ordenador_WOL_SENT.png Binary files differnew file mode 100644 index 00000000..d8bef72e --- /dev/null +++ b/admin/WebConsole/images/ordenador_WOL_SENT.png diff --git a/admin/WebConsole/jscripts/aula.js b/admin/WebConsole/jscripts/aula.js index ce87b6e2..fa119ecb 100644 --- a/admin/WebConsole/jscripts/aula.js +++ b/admin/WebConsole/jscripts/aula.js @@ -138,6 +138,9 @@ function soIMG(so) case 'VDI': MimgOrdenador="ordenador_VDI.png"; // Virtual break; + case 'WOL_SENT': + MimgOrdenador="ordenador_WOL_SENT.png"; // Wol enviado + break; default: MimgOrdenador="ordenador_OFF.png"; // Apagado break; diff --git a/admin/WebConsole/principal/aula.php b/admin/WebConsole/principal/aula.php index 447a5727..efc09178 100644 --- a/admin/WebConsole/principal/aula.php +++ b/admin/WebConsole/principal/aula.php @@ -363,7 +363,7 @@ function pintaordenadores(){ } echo ' </tr>'; echo ' <tr align="center" valign="top">'; - foreach (Array ("OFF", "MNT") as $status) { + foreach (Array ("OFF", "MNT", "WOL_SENT") as $status) { echo ' <td><img src="../images/ordenador_'.$status.'.png" alt="'.$status.'" width="24" style="opacity: '.(1-0.5*($status=="MNT")).'" /><br /><font color="#003300" size="1" face="Arial, Helvetica, sans-serif">'.str_replace(" ", "<br>", $TbMsg["STATUS_$status"]).'</font></td>'; } echo ' </tr>'; diff --git a/admin/WebConsole/principal/configuraciones.php b/admin/WebConsole/principal/configuraciones.php index 19ecff7d..fca880ab 100644 --- a/admin/WebConsole/principal/configuraciones.php +++ b/admin/WebConsole/principal/configuraciones.php @@ -356,7 +356,7 @@ function datos_sesiones($cmd, $idordenador) } if ($ip) { foreach (file(LOG_FILE) as $line) { - if (strstr($line, "ip=$ip")) { + if (strstr($line, "ip=$ip,")) { $fields = preg_split("/[:,=]/", rtrim($line, ". \t\n\r\0\x0B")); $date_time = str_replace("T", " ", $fields[0]) . ":" . $fields[1] . ":" . preg_replace("/\+.*$/", "", $fields[2]); diff --git a/admin/WebConsole/rest/remotepc.php b/admin/WebConsole/rest/remotepc.php index 6a897e0a..6dc5a62d 100644 --- a/admin/WebConsole/rest/remotepc.php +++ b/admin/WebConsole/rest/remotepc.php @@ -185,6 +185,9 @@ INSERT INTO acciones idcentro=$ouid; EOD; $t2 = $cmd->Ejecutar(); + create_schedule_now(strval($timestamp), + $EJECUCION_COMANDO, + "auto-queue-remotepc-reserve-".$timestamp); // Create event to remove reservation on timeout (15 min.). $timeout = "15 MINUTE"; $cmd->texto = <<<EOD @@ -679,6 +682,9 @@ INSERT INTO acciones idcentro=$ouid; EOD; $cmd->Ejecutar(); + create_schedule_now(strval($timestamp), + $EJECUCION_COMANDO, + "auto-queue-remotepc-init-".$timestamp); // Create event to remove the operation on timeout (15 min.). $timeout = "15 MINUTE"; $cmd->texto = <<<EOD diff --git a/admin/WebConsole/rest/server.php b/admin/WebConsole/rest/server.php index a6256a2e..12b874ed 100644 --- a/admin/WebConsole/rest/server.php +++ b/admin/WebConsole/rest/server.php @@ -81,6 +81,7 @@ function getStatus($ouid, $labid, $clntid=0) { 'LNX'=>"linux", 'OSX'=>"macos", 'WIN'=>"windows", + 'WOL_SENT'=>"wol_sent", 'UNK'=>"unknown"]; // Parameters. $ouid = htmlspecialchars($ouid); diff --git a/client/engine/Cache.lib b/client/engine/Cache.lib index 40715946..cacba40d 100755 --- a/client/engine/Cache.lib +++ b/client/engine/Cache.lib @@ -275,7 +275,7 @@ ogDevToDisk ${PART%% *} 2>/dev/null function ogFormatCache () { # Variables locales. -local DEV MNTDIR +local DEV MNTDIR OPTIONS # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then ogHelp "$FUNCNAME" "$FUNCNAME" @@ -288,7 +288,9 @@ DEV=$(ogDiskToDev $DEV) || return $? # Formatear sistema de ficheros. ogUnmountCache 2>/dev/null -mkfs.ext4 -q -F $DEV -L "CACHE" -O extent,large_file 2>/dev/null || ogRaiseError $OG_ERR_PARTITION "CACHE" || return $? +OPTIONS="extent,large_file" +[[ $(uname -r) =~ ^5 ]] && OPTIONS+=",uninit_bg,^metadata_csum,^64bit" +mkfs.ext4 -q -F $DEV -L "CACHE" -O "$OPTIONS" 2>/dev/null || ogRaiseError $OG_ERR_PARTITION "CACHE" || return $? # Crear estructura básica. MNTDIR=$(ogMountCache) diff --git a/client/shared/bin/poweroffconf b/client/shared/bin/poweroffconf index de6726b4..c8cdf39c 100755 --- a/client/shared/bin/poweroffconf +++ b/client/shared/bin/poweroffconf @@ -21,6 +21,7 @@ OPENGNSYS=${OPENGNSYS:-/opt/opengnsys} # Instalación de OpenGnsys OGETC=${OGETC:-$OPENGNSYS/etc} # Configuración de OpenGnsys POWEROFFCONF=/etc/poweroff.conf # Configuración del script +OGCLIENT=ogclient # Error si no existe el fichero de configuración de ahorro de energía. if [ ! -f $POWEROFFCONF ]; then @@ -62,7 +63,7 @@ case $# in esac # Comprobar si hay algún script en ejecución (verificando compatibilidad de "pgrep"). [ -n "$(pgrep -fa 2>&1 | grep "invalid")" ] && PGREP="pgrep -fl" || PGREP="pgrep -fa" -if [ -n "$($PGREP $OPENGNSYS | egrep -v "$OGETC|$0")" ]; then +if [ -n "$($PGREP $OPENGNSYS | egrep -v "$OGETC|$0|$OGCLIENT")" ]; then # Eliminar tiempo de inicio de espera, si se está ejecutando operación. perl -pi -e 's/POWEROFFTIME=.*$/POWEROFFTIME=/' $POWEROFFCONF else diff --git a/doc/CHANGELOG.en.txt b/doc/CHANGELOG.en.txt new file mode 100644 index 00000000..d33d92f9 --- /dev/null +++ b/doc/CHANGELOG.en.txt @@ -0,0 +1,60 @@ +CHANGELOG.en.txt +================ + + +Changes included in OpenGnsys 1.2.0 +----------------------------------- + +#140 Unified configuration file (duplicated) +#803 Delete drop-down of images from different partition (won't be resolved) +#837 Install OpenGnsys using deb package (duplicated) +#838 Problema con parámetros vga en ogLive +#901 Investigate if connections to the database are made correctly +#902 Unclear error message (won't be resolved) +#941 Use libdbi in ogAdmServer +#942 Remove ogAdmAgent +#944 Show computer distribution in a lab +#968 Choose allowed operations in OGAgent agents +#970 Use autotools in ogAdmServer +#971 Remove unused code in ogAdmServer, ogAdmAgent and ogAdmClient +#975 New OGAgent option to obtain system status in detail +#976 ogBootMbrGeneric: improve GPT compatibility (won't be resolved) +#980 Add REST API to ogClient +#981 add native systemd unit file for ogAdmServer +#986 Rename ogAdmServer to ogServer +#987 Use systemctl to disable/enable services in Debian/Ubuntu +#990 Use client broadcast address on WoL +#991 Define computer in maintenance status +#997 Releasing OpenGnsys version 1.2.0 +#998 disable incremental image updates +#999 ogClient session command do not boot the selected OS +#1000 Fix ogClient HTTP lenght handling +#1001 Remove trailing \r and \n in some scripts +#1002 Fix update script to not remove ogAdmRepo.cfg +#1003 Fix ogClient update +#1005 Fix support for computer groups in RemotePC +#1006 Fix RemotePC IP retrieving on running clients +#1007 opengnsys_update.sh does not generate VERSION.json file +#1008 Add support to several disks +#1009 Fix ogclient permissions +#1010 Clean up and fix /software +#1011 Windows hibernation error +#1012 Support disk larger than 2Tb +#1013 ogClient (live mode) hangs busy when createImage script fails +#1014 ogGetImageInfo function fails with Windows 10 2009 update +#1015 PXE files are not updated when needed +#1017 Default ogLive crash after system update, symlinks don't exist (not valid) +#1018 opengnsys_update script cannot start or stop ogserver service +#1019 ogClient cannot execute some queued instructions +#1020 logrotate does not rotate opengnsys log files +#1022 Software inventory crashes when it exceeds 64 Kb +#1024 Disable function move a single computer +#1026 Installation and update scripts must report the operating system prerequisites (and previous version of OpenGnsys in the case of update scripts) +#1027 opengnsys_update.sh does not include the server IP in ogclient.json file +#1028 ogServer: modify its status when uninstalling or changing the server's IP address +#1029 Final message of installation and upgrade scripts +#1031 Admin console doesn't show the statistics +#1032 Running a task causes a malfunction in action queue +#1033 ogLive 5.4 incompatible with "opengnsys-cache" netboot option +#1034 Error is displayed during the execution of opengnsys_export.sh + diff --git a/doc/CHANGELOG.es.txt b/doc/CHANGELOG.es.txt index ba7f5fb6..6cdde072 100644 --- a/doc/CHANGELOG.es.txt +++ b/doc/CHANGELOG.es.txt @@ -6,40 +6,67 @@ Lista de cambios incluidos en OpenGnsys 1.2.0 --------------------------------------------- Tickets resueltos en módulo OpenGnsys Cloning Engine: +#976 ogBootMbrGeneric: mejora en la compatibilidad con GPT (no se resolverá) #1011 Error con Windows hibernado #1014 ogGetImageInfo falla con la actualización de Windows de octubre 2020 Tickets resueltos en módulo OpenGnsys Client: -#980 Add REST API to ogClient -#999 ogClient session command do not boot the selected OS (corrección) -#1000 Fix ogClient HTTP lenght handling (corrección) -#1009 Fix ogclient permissions (corrección) +#980 Se añade API REST API a ogClient +#999 El comando "session" de ogClient no arranque el SO seleccionado (corrección) +#1000 Se arregla el manejo de la longitud HTTP (corrección) +#1009 Se arreglan los permisos de ogclient (corrección) +#1013 ogClient (en modo live) se cuelga mostrando estado ocupado cuando falla createImage +#1019 El agente ogclient del oglive no ejecuta algunas instrucciones encoladas +#1027 opengnsys_update.sh: no configura ip del servidor en ogclient.json +#1033 ogLive 5.4 incompatible con opción del netboot opengnsys-cache + +Tickets resueltos en módulo OpenGnsys Agent: +#968 Elegir operaciones permitidas en agentes OGAgent +#975 Definir opción para que OGAgent devuelva estado detallado del sistema Tickets resueltos en módulo OpenGnsys Server: -#941 Use libdbi in ogAdmServer (mejora) -#942 Remove ogAdmAgent (mejora) -#970 Use autotools in ogAdmServer -#971 Remove unused code in ogAdmServer, ogAdmAgent and ogAdmClient -#981 add native systemd unit file for ogAdmServer -#986 Rename ogAdmServer to ogServer -#990 Use client broadcast address on WoL (mejora) +#140 Fichero de configuración unificado (duplicado) +#941 Utilizar libdbi en ogAdmServer (mejora) +#942 Eliminar ogAdmAgent (mejora) +#970 Utilizar autotools en ogAdmServer +#971 Eliminar código innecesario en ogAdmServer, ogAdmAgent y ogAdmClient +#981 Añadir fichero de inicio para ogAdmServer con systemd +#986 Renombrar ogAdmServer a ogServer +#990 Utilizar la dirección del cliente para WoL por broadcast (mejora) #1002 Fix update script to not remove ogAdmRepo.cfg (corrección) -#1008 Add support to several disk (mejora) -#1010 Clean up and fix /software +#1008 Añadir soporte para varios discos (mejora) +#1010 Limpiar y corregir código +#1017 Falla ogLive (por defecto) tras una actualización, los enlaces del tftpboot oglive y oclient no están. (no válido) +#1018 Servicio ogserver no se para ni se inicia durante el proceso de opengnsys_update +#1020 logrotate no rota los ficheros de log de opengnsys +#1022 NO realiza Inventario Software cuando supera los 64 kb +#1028 servicio ogserver: modificar su estado al desinstalar o cambiar la ip del servidor. +#1034 opengnsys_export.sh muestra falso error durante su ejecución Tickets resueltos en módulo OpenGnsys Web Admin Console: +#803 Consola Web: Eliminar desplegable imágenes de distinta partición (no se resolverá) #838 Problema con parámetros vga en ogLive -#901 Investigate if connections to the database are made correctly +#901 Revisión de las conexiones a la base de datos +#902 Unclear error message (no se resolverá) #944 Mostrar la distribución de equipos en el aula (mejora) -#998 disable incremental image updates -#1001 Remove trailing \r and \n in some scripts (corrección) -#1005 Fix support for computer groups in RemotePC (corrección) -#1006 Fix RemotePC IP retrieving on running clients +#991 Definir ordenador en estado de mantenimiento +#998 Deshabilitar imágenes sincronizadas +#1001 Eliminar finales en \r y \n en algunos scripts (corrección) +#1005 Arreglar el soporte para grupos de ordenadores en RemotePC (corrección) +#1006 Arreglar la recuperación de IP de clientes en ejecución en RemotePC #1012 Soporte disco mayores de 2Tb +#1015 Los ficheros de arranque PXE files no se actualizan cuando es necesario +#1024 Se dehabilita la función de mover un único equipo +#1031 La consola de administración no muestra las estadísticas +#1032 La ejecución de tareas provoca el mal funcionamiento de la cola de acciones Tickets resueltos en módulo OpenGnsys Installer: -#987 Use systemctl to disable/enable services in Debian/Ubuntu (mejora) -#1003 Fix ogClient update +#837 Paquete deb para instalar OpenGnsys (duplicado) +#987 Utilizar systemctl para habilitar/deshabilitar los servicios en Debian/Ubuntu (mejora) +#1003 Arreglar la actualizacion del ogClient +#1007 Error en opengnsys_update.sh: no genera archivo version.json +#1026 Los script de instalación y actualización deben mostrar los prerequisitos de OpenGnsys (y el de actualizacion la versión previa) +#1029 Los script de instalación y actualización muestran aviso sobre el nivel de depuración de syslog. Lista de cambios incluidos en OpenGnsys 1.1.1c (versión de mantenimiento) diff --git a/doc/COMPATIBILITY.en.txt b/doc/COMPATIBILITY.en.txt index 03f81c55..c8d89ab1 100644 --- a/doc/COMPATIBILITY.en.txt +++ b/doc/COMPATIBILITY.en.txt @@ -1,5 +1,5 @@ -OpenGnsys 1.1.1 (Espeto) Compatibility Notes +OpenGnsys 1.2.0 (Gazpacho) Compatibility Notes ============================================== @@ -8,9 +8,7 @@ OpenGnsys Administration Server and Repository Manager Installation of OpenGnsys services has been tested on the following GNU/Linux distributions: - - Ubuntu Server 18.04 LTS 64-bit (recommended) - - Ubuntu Server 16.04 LTS 64-bit (not fully tested) - - CentOS 7.x 64-bit (not fully tested) + - Ubuntu Server 18.04 LTS 64-bit OpenGnsys Clients @@ -18,8 +16,8 @@ OpenGnsys Clients Installation and cloning operations have been tested on the following operating systems and filesystems: - - Ubuntu Desktop 14.04 LTS 64-bit, 16.04 LTS 64-bit and 18.04 LTS 64-bit with Ext4 filesystem and Swap partition + - Ubuntu Desktop 14.04 LTS 64-bit, 16.04 LTS 64-bit, 18.04 LTS 64-bit, and 20.04 LTS 64-bit with Ext4 filesystem and swap partition or swap file - Windows 7 Enterprise 64-bit with NTFS filesystem - - Windows 10 Education 1709 64-bit, 1803 64-bit, 1809 64-bit and 1903 64-bit with NTFS filesystem + - Windows 10 Education 1709 64-bit, 1803 64-bit, 1809 64-bit, 1903 64-bit, 2004 64-bit, and 2009 64-bit with NTFS filesystem diff --git a/doc/INSTALL.en.txt b/doc/INSTALL.en.txt index 84492e6e..02062ef9 100644 --- a/doc/INSTALL.en.txt +++ b/doc/INSTALL.en.txt @@ -1,10 +1,10 @@ -Installing OpenGnsys Server 1.1.1 (Espeto) -========================================== +Installing OpenGnsys Server 1.2.0 (Gazpacho) +============================================ Before installation ------------------- -OpenGnsys Server 1.1.1 (codename Espeto) is meant to be installed under Ubuntu Server 18.04 LTS or newer (some tests have been done on CentOS 7-based systems). +OpenGnsys Server 1.2.0 (codename Gazpacho) is meant to be installed under Ubuntu Server 18.04 LTS 64-bit. Network connection is needed in order to download the required packages, the source code and the preconfigured client. @@ -71,7 +71,7 @@ Once the installation process is finished, you can start working with the system Updating / upgrading -------------------- -Warning: if you are going to upgrade OpenGnsys from a version earlier than 1.1.1 (Espeto), you must first upgrade Ubuntu to version 18.04 LTS and restart the server. +Warning: if you are going to upgrade OpenGnsys from a version earlier than 1.2.0 (Gazpacho), you must first upgrade Ubuntu to version 18.04 LTS and restart the server. There is a system self-upgrading script with the following features: * Network connection is needed to obtain the latest updates / upgrades. diff --git a/doc/INSTALL.es.txt b/doc/INSTALL.es.txt index a8fd4e00..75c844dc 100644 --- a/doc/INSTALL.es.txt +++ b/doc/INSTALL.es.txt @@ -1,10 +1,10 @@ -Instalación de OpenGnsys Server 1.1.1 (Espeto) -============================================== +Instalación de OpenGnsys Server 1.2.0 (Gazpacho) +================================================ Notas iniciales --------------- -Se presupone que el servidor de OpenGnsys 1.1.1 (Espeto) va a ser instalado en una distribución del sistema operativo Ubuntu Server a partir de la versión 18.04 LTS (se han hecho algunas pruebas en sistemas basados en CentOS 7). +Se recomienda que el servidor de OpenGnsys 1.2.0 (Gazpacho) sea instalado en una distribución del sistema operativo Ubuntu Server versión 18.04 LTS de 64 bits. El serividor debe tener acceso a Internet para descargar los paquetes necesarios, el código del proyecto y el cliente preconfigurado. @@ -71,7 +71,7 @@ Una vez finalizada la ejecución del instalador, puede empezarse a trabajar con Actualización ------------- -Nota importante: si se va a actualizar OpenGnsys desde una versión anterior a la 1.1.1 (Espeto), debe actualizarse antes la distribución de Ubuntu a la versión 18.04 LTS y reiniciar el servidor. +Nota importante: si se va a actualizar OpenGnsys desde una versión anterior a la 1.2.0 (Gazpacho), debe actualizarse antes la distribución de Ubuntu a la versión 18.04 LTS y reiniciar el servidor. Se dispone de un script de auto-actualización del sistema, con las siguientes características: * Es necesario conexión a Internet para obtener las últimas actualizaciones. diff --git a/doc/VERSION.json b/doc/VERSION.json index 94dd81ed..cbbd5c0d 100644 --- a/doc/VERSION.json +++ b/doc/VERSION.json @@ -1,6 +1,6 @@ { "project": "OpenGnsys", - "version": "1.2.0", + "version": "1.2.1", "codename": "Gazpacho", "definition": "https://www.andalucia.com/gastronomy/gazpacho.htm", "release": "", diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index ed892df0..972ea71a 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -114,24 +114,26 @@ function userData () OPENGNSYS_CLIENT_PASSWD="$PASSWORD" unset PASSWORD + # El ogclient sólo es compatible con ogLive de kernel 5.x. Se comenta la elección de ogLive. # Selección de clientes ogLive para descargar. - while : ; do - echo -e "\\n\\nChoose ogLive client to install." - echo -e "1) Kernel 5.4, 64-bit, EFI-compatible" - echo -e "2) Kernel 3.2, 32-bit" - echo -e "3) Both" - echo -n -e "Please, type a valid number (1): " - read -r OPT - case "$OPT" in - 1|"") OGLIVE="$DEFAULT_OGLIVE" - break ;; - 2) OGLIVE="ogLive-precise-3.2.0-23-generic-r5159.iso" - break ;; - 3) OGLIVE=" $DEFAULT_OGLIVE ogLive-precise-3.2.0-23-generic-r5159.iso"; - break ;; - *) echo -e "\\aERROR: unknown option, try again." - esac - done + #while : ; do + # echo -e "\\n\\nChoose ogLive client to install." + # echo -e "1) Kernel 5.4, 64-bit, EFI-compatible" + # echo -e "2) Kernel 3.2, 32-bit" + # echo -e "3) Both" + # echo -n -e "Please, type a valid number (1): " + # read -r OPT + # case "$OPT" in + # 1|"") OGLIVE="$DEFAULT_OGLIVE" + # break ;; + # 2) OGLIVE="ogLive-precise-3.2.0-23-generic-r5159.iso" + # break ;; + # 3) OGLIVE=" $DEFAULT_OGLIVE ogLive-precise-3.2.0-23-generic-r5159.iso"; + # break ;; + # *) echo -e "\\aERROR: unknown option, try again." + # esac + #done + OGLIVE="$DEFAULT_OGLIVE" echo -e "\\n==============================" } @@ -833,7 +835,7 @@ function downloadCode() echoAndLog "${FUNCNAME}(): downloading code..." - curl "${url}" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys + curl "${url}" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-${BRANCH#v}" opengnsys if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error getting OpenGnsys code from $url" return 1 @@ -1360,7 +1362,7 @@ function ogServerCompilation () echoAndLog "${FUNCNAME}(): ogServer code was downloaded" echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Server" - pushd "$WORKDIR/ogServer-$BRANCH" + pushd "$WORKDIR/ogServer-${BRANCH#v}" autoreconf -fi && ./configure && make && mv ogserver $INSTALL_TARGET/sbin if [ $? -ne 0 ]; then echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Server" @@ -1427,7 +1429,7 @@ function copyClientFiles() if ! (curl "${ogclientUrl}" -o ogclient.zip && \ unzip -qo ogclient.zip && \ - mv "ogClient-$BRANCH" $INSTALL_TARGET/client/ogClient) + mv "ogClient-${BRANCH#v}" $INSTALL_TARGET/client/ogClient) then errorAndLog "${FUNCNAME}(): "\ "error getting ogClient code from ${ogclientUrl}" @@ -1496,7 +1498,7 @@ function openGnsysConfigure() cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.service \ /lib/systemd/system/opengnsys.service - cp -a $WORKDIR/ogServer-$BRANCH/cfg/ogserver.service \ + cp -a $WORKDIR/ogServer-${BRANCH#v}/cfg/ogserver.service \ /lib/systemd/system/ogserver.service cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default /etc/default/opengnsys # Deshabilitar servicios de BitTorrent si no están instalados. diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index 4b244b28..3a21072d 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -139,7 +139,7 @@ function autoConfigure() # Configuración según la distribución de Linux. if [ -f /etc/debian_version ]; then # Distribución basada en paquetes Deb. - DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast libev-dev libjansson-dev libssl-dev shim-signed grub-efi-amd64-signed php-fpm gawk libdbi-dev libdbi1 libdbd-mysql automake liblz4-tool ) + DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast libev-dev libjansson-dev libssl-dev shim-signed grub-efi-amd64-signed php-fpm gawk libdbi-dev libdbi1 libdbd-mysql automake liblz4-tool software-properties-common ) # Paquete correcto para realpath. [ -z "$(apt-cache pkgnames realpath)" ] && DEPENDENCIES=( ${DEPENDENCIES[@]//realpath/coreutils} ) UPDATEPKGLIST="add-apt-repository -y ppa:ondrej/php; apt-get update" @@ -221,8 +221,9 @@ function chooseVersion() [ -f $INSTALL_TARGET/doc/VERSION.txt ] && read -pe INSTVERSION INSTRELEASE <<< $(awk '{print $2,$3}' $INSTALL_TARGET/doc/VERSION.txt) # Fetch tags (releases) data from GitHub. while read -pe TAG URL; do - if [[ $TAG =~ ^opengnsys- ]]; then + if [[ $TAG =~ ^(opengnsys-|v)[0-9] ]]; then [ "${TAG#opengnsys-}" \< "${INSTVERSION%pre}" ] && continue + [ "${TAG#v}" \< "${INSTVERSION%pre}" ] && continue RELDATE=$(curl -s "$URL" | jq -r '.commit.committer.date | split("-") | join("")[:8]') RELEASES+=( "${TAG} ($RELDATE)" ) DOWNLOADS+=( "$URL" ) @@ -496,13 +497,12 @@ function downloadCode() fi local url="$1" - echoAndLog "${FUNCNAME}(): downloading code..." curl "$url" -o opengnsys.zip && \ unzip -qo opengnsys.zip && \ rm -fr opengnsys && \ - mv "OpenGnsys-$BRANCH" opengnsys + mv "OpenGnsys-${BRANCH#v}" opengnsys if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error getting code from ${url}, verify your user and password" return 1 @@ -1097,7 +1097,7 @@ function ogServerCompilation() echoAndLog "${FUNCNAME}(): ogServer code was downloaded" echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Admin Server" - pushd "$WORKDIR/ogServer-$BRANCH" + pushd "$WORKDIR/ogServer-${BRANCH#v}" autoreconf -fi && ./configure && make && moveNewService ogserver $INSTALL_TARGET/sbin if [ $? -ne 0 ]; then echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Server" @@ -1142,7 +1142,7 @@ function ogServerCompilation() $INSTALL_TARGET/bin/settoken -f # Updating service file, if needed if ! diff -q \ - "$WORKDIR"/ogServer-"$BRANCH"/cfg/ogserver.service \ + "$WORKDIR"/ogServer-"${BRANCH#v}"/cfg/ogserver.service \ /lib/systemd/system/ogserver.service 2>/dev/null; then service="opengnsys" $STOPSERVICE @@ -1151,7 +1151,7 @@ function ogServerCompilation() service="ogserver" $STOPSERVICE cp -a \ - "$WORKDIR"/ogServer-"$BRANCH"/cfg/ogserver.service \ + "$WORKDIR"/ogServer-"${BRANCH#v}"/cfg/ogserver.service \ /lib/systemd/system/ogserver.service systemctl daemon-reload $STARTSERVICE @@ -1236,14 +1236,14 @@ function updateOgClient() return 1 fi if [ -e $INSTALL_TARGET/client/ogClient/cfg/ogclient.json ]; then - rm -f ogClient-"$BRANCH"/cfg/ogclient.json + rm -f ogClient-"${BRANCH#v}"/cfg/ogclient.json else CLIENTPASS=$(awk -F":" '{print $2}' /etc/rsyncd.secrets) sed -i -e 's/127.0.0.1/'$ServidorAdm'/' \ -e 's/pass'.*$'/pass\": "'$CLIENTPASS'"/' \ - ogClient-"$BRANCH"/cfg/ogclient.json + ogClient-"${BRANCH#v}"/cfg/ogclient.json fi - rsync -irplt "ogClient-$BRANCH/" $INSTALL_TARGET/client/ogClient + rsync -irplt "ogClient-${BRANCH#v}/" $INSTALL_TARGET/client/ogClient rm -f ogclient.zip echoAndLog "${FUNCNAME}(): ogClient code was downloaded and updated" diff --git a/installer/vagrant/Vagrantfile-1.2.0-vbox b/installer/vagrant/Vagrantfile-1.2.0-vbox index 3cecfdd2..b6659841 100644 --- a/installer/vagrant/Vagrantfile-1.2.0-vbox +++ b/installer/vagrant/Vagrantfile-1.2.0-vbox @@ -46,7 +46,7 @@ if which curl &>/dev/null; then elif which wget &>/dev/null; then DOWNLOAD="wget -q -O -" fi -BRANCH="opengnsys-#{OGVERSION}" +BRANCH="v#{OGVERSION}" $DOWNLOAD "https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH/installer/opengnsys_installer.sh" | bash || exit $? mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log echo y | /opt/opengnsys/bin/setserveraddr $(ip -o link show | tail -1 | cut -d: -f2) diff --git a/installer/vagrant/Vagrantfile-master-libvirt b/installer/vagrant/Vagrantfile-master-libvirt new file mode 100644 index 00000000..32261dcd --- /dev/null +++ b/installer/vagrant/Vagrantfile-master-libvirt @@ -0,0 +1,187 @@ +# Vagrantfile to install OpenGnsys virtual environment (development version) using VirtualBox provider. + +VAGRANTFILE_API_VERSION = "2" +# VM provider: Oracle VM VirtualBox. +ENV['VAGRANT_DEFAULT_PROVIDER'] = "libvirt" +# OGAgent version. +OGAGENTVERSION="1.1.2" +# Language (accepted values: es_ES, ca_ES, en_GB). +LANGUAGE = "es_ES" +ENV['LC_ALL'] = LANGUAGE + ".UTF-8" +# Number of OpenGnsys clients (accepted values: from 2 to 9). +NCLIENTS = 4 +# Repository virtual disk: file and size (GB). +REPODISK = "ogRepo.vdi" +REPOSIZE = 50 +# Amount of memory for server and clients (MB) +SERVERMEM = 1024 # Minimum: 512 +CLIENTMEM = 512 # Minimum: 256 +# Amount of CPU for server and clients (MB) +SERVERCPU = 1 +CLIENTCPU = 1 +# Prefixes for MAC and IP addresses. +MACPREFIX = "08:00:27:0E:65" +NETPREFIX = "192.168.2" +# OpenGnsys Server IP address. +SERVERIP = "#{NETPREFIX}.10" +# Local port to access OpenGnsys Server. +LOCALWEBPORT = 8443 + +# OpenGnsys Server provisioning script: prepare repo disk, install OpenGnsys, change default interface, configure DHCP server. +OGSERVERSCRIPT = <<EOT +# Exit if OpenGnsys is installed. +[ -f /opt/opengnsys/doc/VERSION.json ] && echo "Cannot provision, OpenGnsys is already installed." && exit 1 + +# Create repository disk using LVM, if necesary. +if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get -y install lvm2 + pvcreate /dev/vdb + vgcreate og /dev/vdb + vgchange -ay + lvcreate -ay -n images -l 100%VG og + mkfs -t ext4 /dev/mapper/og-images + mkdir -p /opt/opengnsys/images + echo "/dev/mapper/og-images /opt/opengnsys/images ext4 defaults 0 0" >> /etc/fstab + mount -t ext4 /dev/mapper/og-images /opt/opengnsys/images +fi +# Install OpenGnsys and change server address. +if which curl &>/dev/null; then + DOWNLOAD="curl -s" +elif which wget &>/dev/null; then + DOWNLOAD="wget -q -O -" +fi +BRANCH="master" +$DOWNLOAD "https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH/installer/opengnsys_installer.sh" | bash || exit $? +mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log +echo y | /opt/opengnsys/bin/setserveraddr $(ip -o link show | tail -1 | cut -d: -f2) +# Insert DHCP data. +for ((i=#{NCLIENTS+10}; i>10; i--)); do + sed -i "/^}$/ i host pc${i} { hardware ethernet #{MACPREFIX}:${i}; fixed-address #{NETPREFIX}.${i}; }" /etc/dhcp/dhcpd.conf +done +service isc-dhcp-server restart +# Set language. +export LANG="#{LANGUAGE}.UTF-8" +echo "LANG=\\\"$LANG\\\"" > /etc/default/locale +echo "LANG=\\\"$LANG\\\"" >> /etc/environment +locale-gen --lang #{LANGUAGE} +sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\\\"${LANG%_*}\\\"/" /etc/default/keyboard +dpkg-reconfigure -fnoninteractive console-setup +# Comment out next lines for automatic data insertion. +#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}.1', '255.255.255.0', '', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" +#for ((i=11; i<=#{NCLIENTS+10}; i++)); do +# SQL="$SQL ('pc$i', '#{NETPREFIX}.$i', REPLACE('#{MACPREFIX}$i',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif')," +#done +#mysql -u usuog -ppassusuog -D ogAdmBD -e "${SQL%,}" +#read -pe PORT TOKEN <<< $(jq -r '.rest.port+" "+.rest.api_token' /opt/opengnsys/etc/ogserver.json) +#DATA='{"clients": ["#{NETPREFIX}.11"], "mode": "19pxeADMIN"}' +#curl -ks -H "Authorization: $TOKEN" -d "$DATA" "http://localhost:$PORT/mode" +#DATA='{"clients": ["#{NETPREFIX}.'$(seq -s '", "#{NETPREFIX}.' 12 #{NCLIENTS+10})'"], "mode": "pxe"}' +#curl -ks -H "Authorization: $TOKEN" -d "$DATA" "http://localhost:$PORT/mode" + +# Tftpboot: Change grldr to new version +cp /opt/opengnsys/tftpboot/grldr /opt/opengnsys/tftpboot/grldr.orig +cp /opt/opengnsys/tftpboot/grldr-0.4.4 /opt/opengnsys/tftpboot/grldr + +echo "Notes:" +echo "- OpenGnsys Server URL: https://#{SERVERIP}/opengnsys/" +exit 0 +EOT + +# Client 1 OS provisioning script. +MODELSCRIPT = <<EOT +# Comment out next lines to install and configure OGAgent for Ubuntu. +#export DEBIAN_FRONTEND=noninteractive +#OGAGENTPKG="ogagent_#{OGAGENTVERSION}_all.deb" +#apt-get update -y +#apt-get install -y curl +#curl -ks https://#{SERVERIP}/opengnsys/descargas/$OGAGENTPKG -o /tmp/$OGAGENTPKG +#if [ -f /tmp/$OGAGENTPKG ]; then +# apt-get install -y /tmp/$OGAGENTPKG || exit $? +# sed -i "0,/remote=/ s,remote=.*,remote=https://#{SERVERIP}/opengnsys/rest/," /usr/share/OGAgent/cfg/ogagent.cfg +# rm -f /tmp/$OGAGENTPKG +#else +# echo "Warning: cannot install OGAgent package $OGAGENTPKG" +#fi +echo "Notes:" +echo "- After now, use virt-manager GUI to disable network interface 1, reconfigure boot network and restart this VM." +# Leave VM halted. +sleep 2 +poweroff & +EOT + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + # OpenGnsys Server VM definition. + config.vm.define :ogAdministrator, primary: true do |og| + # Specific VirtualBox configuration. + og.vm.provider "libvirt" do |vb| + # VM name, memory and CPUs. + vb.memory = SERVERMEM + vb.cpus = SERVERCPU + # 2nd virtual disk. + vb.storage :file, :size => REPOSIZE, + :path => REPODISK, + :allow_existing => true + end + # VM base and host name. + og.vm.box = "peru/ubuntu-18.04-server-amd64" + og.vm.hostname = "ogAdministrator" + # Network configuration: forward web port and attach new interface to VMs private network. + og.vm.network :forwarded_port, guest: 443, host: LOCALWEBPORT, host_ip: "127.0.0.1" + og.vm.network :private_network, + :libvirt__network_name => "virtualLab0", + :mac => "#{MACPREFIX}10".tr(":",""), + :ip => "#{SERVERIP}", + :libvirt__dhcp_enabled => false, + :libvirt__forward_mode => "none" + # Comment out to disable synced folder. + #og.vm.synced_folder ".", "/vagrant", disabled: true + # Launch provisioning script. + og.vm.provision "shell", inline: OGSERVERSCRIPT + end + + # Client 1 VM definition. + config.vm.define "pc11", autostart: false do |v1| + v1.vm.box = "peru/ubuntu-18.04-server-amd64" + v1.vm.synced_folder ".", "/vagrant", disabled: true + v1.ssh.insert_key = false + v1.vm.boot_timeout = 5 + v1.vm.network :private_network, + :libvirt__network_name => "virtualLab0", + :libvirt__forward_mode => "none", + :libvirt__dhcp_enabled => false, + :mac => "#{MACPREFIX}11".tr(":","") + v1.vm.provider "libvirt" do |vb| + vb.cpu_mode = 'host-passthrough' + vb.memory = CLIENTMEM + vb.cpus = CLIENTCPU + boot_network = {'network' => "vagrant_libvirt"} + vb.boot boot_network + end + v1.vm.provision "shell", inline: MODELSCRIPT + end + + # Clonable clients definition. + (2..NCLIENTS).each do |i| + config.vm.define "pc#{i+10}", autostart: false do |cl| + cl.vm.synced_folder ".", "/vagrant", disabled: true + cl.ssh.insert_key = false + cl.vm.boot_timeout = 5 + cl.vm.network :private_network, + :libvirt__network_name => "virtualLab0", + :libvirt__forward_mode => "none", + :libvirt__dhcp_enabled => false, + :mac => "#{MACPREFIX}#{i+10}".tr(":","") + cl.vm.provider :libvirt do |vb| + vb.storage :file, :size => '100G', :type => 'qcow2' + vb.memory = CLIENTMEM + vb.cpus = CLIENTCPU + boot_network = {'network' => "virtualLab0"} + vb.boot boot_network + end + cl.vm.post_up_message = "- After now, use virt-manager GUI to disable network interface 1 and restart this VM." + end + end +end diff --git a/installer/vagrant/Vagrantfile-prod-vbox b/installer/vagrant/Vagrantfile-prod-vbox index 0d1bf07b..86bd3055 120000 --- a/installer/vagrant/Vagrantfile-prod-vbox +++ b/installer/vagrant/Vagrantfile-prod-vbox @@ -1 +1 @@ -Vagrantfile-1.1.1c-vbox
\ No newline at end of file +Vagrantfile-1.2.0-vbox
\ No newline at end of file |