From 8607e55570ef9f8e59366d35339ccb92d60b033d Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Thu, 27 Sep 2018 15:16:03 +0200 Subject: #872: Incorporar código de los tickets #835 y #840 en rama principal. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/Database/ogAdmBD-1.1.0pre-1.1.0.sql | 2 +- admin/Sources/Clients/ogagent/INSTALL.es.txt | 4 +- admin/WebConsole/principal/boot_grub4dos.php | 46 ++---- client/boot-tools/boottoolsfunctions.lib | 20 +-- client/boot-tools/boottoolsgenerator.sh | 4 +- .../etc/initramfs-tools/scripts/ogfunctions | 2 +- .../usr/bin/boot-tools/boottoolsFsOpengnsys.sh | 6 +- doc/INSTALL.en.txt | 47 +++--- doc/INSTALL.es.txt | 14 +- installer/INSTALL.es.txt | 12 +- installer/ogagent-devel-installer.sh | 10 +- installer/opengnsys_import.sh | 4 +- installer/opengnsys_installer.sh | 47 +++--- installer/opengnsys_makecompress.sh | 22 ++- installer/opengnsys_update.sh | 10 +- installer/vagrant/README.es.txt | 4 +- installer/vagrant/Vagrantfile-boottools-vbox | 4 +- installer/vagrant/Vagrantfile-browser-vbox | 2 +- installer/vagrant/Vagrantfile-devel-vbox | 6 +- installer/vagrant/Vagrantfile-ogagent-vbox | 6 +- installer/vagrant/Vagrantfile-prod-vbox | 164 +++++++++++++++++++++ installer/vagrant/Vagrantfile-trunk-vbox | 164 --------------------- server/bin/checkperms | 5 +- 23 files changed, 303 insertions(+), 302 deletions(-) create mode 100644 installer/vagrant/Vagrantfile-prod-vbox delete mode 100644 installer/vagrant/Vagrantfile-trunk-vbox diff --git a/admin/Database/ogAdmBD-1.1.0pre-1.1.0.sql b/admin/Database/ogAdmBD-1.1.0pre-1.1.0.sql index ed296e44..db52865b 100644 --- a/admin/Database/ogAdmBD-1.1.0pre-1.1.0.sql +++ b/admin/Database/ogAdmBD-1.1.0pre-1.1.0.sql @@ -148,7 +148,7 @@ CREATE PROCEDURE addcols() BEGIN INSERT INTO usuarios (idusuario, pasguor) SELECT idusuario, pasguor FROM usuarios ON DUPLICATE KEY UPDATE - pasguor=SHA2(VALUES(pasguor),224); + pasguor=SHA2(VALUES(pasguor), 224); END IF; # Crear tabla de log para la cola de acciones (ticket #782) IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS 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/WebConsole/principal/boot_grub4dos.php b/admin/WebConsole/principal/boot_grub4dos.php index 6d9fa1f8..dc3e610f 100644 --- a/admin/WebConsole/principal/boot_grub4dos.php +++ b/admin/WebConsole/principal/boot_grub4dos.php @@ -38,25 +38,15 @@ switch($litambito){ $seleccion= "and grupoid=" . $idambito . ""; break; } -//######################################################################### -// LEYENDO EL DIRECTORIO -// /var/lib/tftboot/menu.lst/templates -//######################################################################### -$dirtemplates="/var/lib/tftpboot/menu.lst/templates/"; -$directorio=dir($dirtemplates); -$pn= array();//pila de nombres -//bucle para llenar las pilas :P -while ($archivo = $directorio->read()) -{ - //no mostrar ni "." ni ".." ni "pxe" - if(($archivo!="pxe")&&($archivo!=".")&&($archivo!="..")) - { - array_push($pn, $archivo); - } -} -$directorio->close(); -//ordenar las pilas segun la pila de nombres -array_multisort($pn); + +// Leyendo el directorio de plantillas PXE (/opt/opengnsys/tftboot/menu.lst/templates) +$dirtemplates="/opt/opengnsys/tftpboot/menu.lst/templates/"; +// Leer nombres de ficheros y quitar plantilla "pxe". +chdir($dirtemplates); +$pn=glob("*"); +unset($pn[array_search("pxe", $pn)]); +sort($pn); +chdir(__DIR__); //Leemos el ultimo fichero y extraemos su numero $ultimofichero=end($pn); @@ -100,18 +90,8 @@ while($encontrado==FALSE) '; - echo ''; - }else{ - echo ''; - echo ''; - } - */ + if (empty($_SESSION["widcentro"])) { + $modo=1; } ?> @@ -119,8 +99,8 @@ while($encontrado==FALSE) +if (! empty($modo)) +{ ?> diff --git a/client/boot-tools/boottoolsfunctions.lib b/client/boot-tools/boottoolsfunctions.lib index 308c5a77..5d22e11f 100755 --- a/client/boot-tools/boottoolsfunctions.lib +++ b/client/boot-tools/boottoolsfunctions.lib @@ -14,12 +14,7 @@ function btogGetVar() { -export BTSVNBOOTTOOLS=/tmp/opengnsys_installer/opengnsys/client/boot-tools -export BTSVNSHARE=/tmp/opengnsys_installer/opengnsys/client/shared -export BTSVNENGINE=/tmp/opengnsys_installer/opengnsys/client/engine - -export BTSVNOG2=/tmp/opengnsys_installer/opengnsys2 - +export BTDIR=/tmp/opengnsys_installer/opengnsys/client/boot-tools export BTTARGETDIR=/var/lib/tftpboot/ogclient/ export BTROOTFSIMG=${BTTARGETDIR}ogclient.img export BTROOTFSMNT=${BTTARGETDIR}ogclientmount @@ -127,12 +122,13 @@ case "${1,,}" in exit 1 ;; esac -SVNURL="https://opengnsys.es/svn/trunk/client" -VERSIONSVN=$(LANG=C svn info $SVNURL | awk '/Rev:/ {print "r"$4}') -NAMEISOCLIENT="$VERSIONBOOTTOOLS-$OSCODENAME-$OSRELEASE-$OSARCH-$VERSIONSVN" -NAMEHOSTCLIENT="$VERSIONBOOTTOOLS-$OSCODENAME-$VERSIONSVN" +BRANCH="master" +GITURL="https://api.github.com/repos/opengnsys/OpenGnsys/commits?sha=$BRANCH&path=/client" +GITRELEASE=$(curl -s "$GITURL" | jq -r '"r" + (.[0].commit.committer.date | gsub("-"; "")[:8]) + "." + (.[0].sha[:7])') +NAMEISOCLIENT="$VERSIONBOOTTOOLS-$OSCODENAME-$OSRELEASE-$OSARCH-$GITRELEASE" +NAMEHOSTCLIENT="$VERSIONBOOTTOOLS-$OSCODENAME-$GITRELEASE" export OSDISTRIB OSCODENAME OSRELEASE OSARCH OSHTTP -export TYPECLIENT VERSIONSVN NAMEISOCLIENT NAMEHOSTCLIENT +export TYPECLIENT GITRELEASE NAMEISOCLIENT NAMEHOSTCLIENT ### El fichero de configuración debe sustituir a estos 3 ficheros (borrar las 3 líneas siguientes). echo "$NAMEISOCLIENT" > /tmp/opengnsys_info_rootfs echo "$NAMEHOSTCLIENT" > /tmp/opengnsys_chroot @@ -144,7 +140,7 @@ OSCODENAME="$OSCODENAME" OSRELEASE="$OSRELEASE" OSARCH="$OSARCH" OSHTTP="$OSHTTP" -VERSIONSVN="$VERSIONSVN" +GITRELEASE="$GITRELEASE" NAMEISOCLIENT="$NAMEISOCLIENT" NAMEHOSTCLIENT="$NAMEHOSTCLIENT" EOT diff --git a/client/boot-tools/boottoolsgenerator.sh b/client/boot-tools/boottoolsgenerator.sh index 4c19de07..cdbe8cf7 100755 --- a/client/boot-tools/boottoolsgenerator.sh +++ b/client/boot-tools/boottoolsgenerator.sh @@ -72,10 +72,10 @@ echo "FASE 4 - Configurar acceso schroot al Segundo Sistema de archivos (img)" cat /etc/schroot/schroot.conf | grep $BTROOTFSIMG || btogSetFsAccess ########################################################################### echo "FASE 5 - Incorporando ficheros OpenGnsys al sistema raíz rootfs " -cp -a ${BTSVNBOOTTOOLS}/includes/usr/bin/* /tmp +cp -a ${BTDIR}/includes/usr/bin/* /tmp chmod +x /tmp/boot-tools/*.sh # Incluir revisión. -sed -i "1 s/$/ $VERSIONSVN/" ${BTSVNBOOTTOOLS}/includes/etc/initramfs-tools/scripts/VERSION.txt +sed -i "1 s/$/ $GITRELEASE/" ${BTDIR}/includes/etc/initramfs-tools/scripts/VERSION.txt # En Ubuntu 13.04+ es necesario matar proceso de "udev" antes de desmontar. umount $BTROOTFSMNT 2>/dev/null || (kill -9 $(lsof -t $BTROOTFSMNT); umount $BTROOTFSMNT 2>/dev/null) schroot -p -c IMGogclient -- /tmp/boot-tools/boottoolsFsOpengnsys.sh diff --git a/client/boot-tools/includes/etc/initramfs-tools/scripts/ogfunctions b/client/boot-tools/includes/etc/initramfs-tools/scripts/ogfunctions index d46ab875..b25fcc5f 100644 --- a/client/boot-tools/includes/etc/initramfs-tools/scripts/ogfunctions +++ b/client/boot-tools/includes/etc/initramfs-tools/scripts/ogfunctions @@ -550,7 +550,7 @@ then for i in bin sbin lib $LIBS etc var usr root boot; do ogUnionLiveDir $i done - cat /tmp/mtab.preunion > /etc/mtab + [ -L /etc/mtab ] || cat /tmp/mtab.preunion > /etc/mtab else echo "Fichero imagen del cliente no encontrado" return 1 diff --git a/client/boot-tools/includes/usr/bin/boot-tools/boottoolsFsOpengnsys.sh b/client/boot-tools/includes/usr/bin/boot-tools/boottoolsFsOpengnsys.sh index 0e42a7ed..85b00b69 100755 --- a/client/boot-tools/includes/usr/bin/boot-tools/boottoolsFsOpengnsys.sh +++ b/client/boot-tools/includes/usr/bin/boot-tools/boottoolsFsOpengnsys.sh @@ -24,7 +24,7 @@ echo "$OSDISTRIB:$OSCODENAME:$OSRELEASE:$OSARCH:$OSHTTP" LERROR=TRUE -echo "$FUNCNAME: Iniciando la personalización con datos del SVN " +echo "$FUNCNAME: Iniciando la personalización con datos del repositorio" # parseamos el apt.source de la distribución (en minúsculas) sed -e "s/OSCODENAME/$OSCODENAME/g" ${SVNCLIENTDIR}/includes/etc/apt/sources.list.${OSDISTRIB,,} > ${SVNCLIENTDIR}/includes/etc/apt/sources.list @@ -77,8 +77,8 @@ if [ $? -ne 0 ]; then fi # El fichero de configuración debe sustituir a los 2 ficheros (borrar las 2 líneas). -echo "${VERSIONBOOTTOOLS}-${OSCODENAME}-${OSRELEASE}-${VERSIONSVN}" > /$NAMEISOCLIENTFILE -echo "${VERSIONBOOTTOOLS}-${OSCODENAME}-${VERSIONSVN}" > $NAMEHOSTCLIENTFILE +echo "${VERSIONBOOTTOOLS}-${OSCODENAME}-${OSRELEASE}-${GITRELEASE}" > /$NAMEISOCLIENTFILE +echo "${VERSIONBOOTTOOLS}-${OSCODENAME}-${GITRELEASE}" > $NAMEHOSTCLIENTFILE history -c diff --git a/doc/INSTALL.en.txt b/doc/INSTALL.en.txt index 4eef6920..dc244a7e 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 v 1.1.0a +==================================== 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.0 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/master/installer/opengnsys_installer.sh Unpacking example: - tar xvzf opengnsys-1.0.5.tar.gz + tar xvzf opengnsys-1.1.0a.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/master/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/master/installer/opengnsys_installer.sh -o opengnsys_installer.sh You must be root to run the installation script: @@ -41,23 +43,24 @@ 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. + * Downloading 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 +82,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 790ad58e..41bbbcb2 100644 --- a/doc/INSTALL.es.txt +++ b/doc/INSTALL.es.txt @@ -1,10 +1,10 @@ -Instalación de OpenGnsys Server v 1.1.0 -======================================= +Instalación de OpenGnsys Server v 1.1.0a +======================================== 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/trunk/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.0a.tar.gz cd opengnsys/installer Ejemplos de descarga con varias herramientas: * Descargar con wget. - wget https://opengnsys.es/svn/trunk/installer/opengnsys_installer.sh -O opengnsys_installer.sh + wget https://raw.githubusercontent.com/opengnsys/OpenGnsys/master/installer/opengnsys_installer.sh * Descargar con curl. - curl https://opengnsys.es/svn/trunk/installer/opengnsys_installer.sh > opengnsys_installer.sh + curl https://raw.githubusercontent.com/opengnsys/OpenGnsys/master/installer/opengnsys_installer.sh -o opengnsys_installer.sh El script de instalación debe ser ejecutado como usuario root: diff --git a/installer/INSTALL.es.txt b/installer/INSTALL.es.txt index b9533063..b0712a45 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.0a +=============================================== Instalación inicial @@ -8,17 +8,17 @@ Instalación inicial 1. Obtener el instalador. Descargar una versión completa y desccomprimir el fichero "opengnsys-version.tar.gz": - tar xvzf opengnsys-version.tar.gz - cd opengnsys/installer + tar xvzf opengnsys-version.tar.gz + cd opengnsys/installer O bien, descargar el instalador desde la última reversión del repositorio: - svn export https://opengnsys.es/svn/trunk/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 2. Ejecutar el instalador como root: - sudo bash opengnsys_installer.sh + sudo bash opengnsys_installer.sh Dicho script solicitará por teclado la siguiente información para configurar el acceso al servicio (si no se indica un parámetro, toma el valor por defecto): * Clave del usuario root de MySQL. diff --git a/installer/ogagent-devel-installer.sh b/installer/ogagent-devel-installer.sh index 4b619c03..a07de1d2 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/trunk/admin/Sources/Clients/ogagent +PROGDIR="$PWD/ogagent" +BRANCH="branches/master" +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_import.sh b/installer/opengnsys_import.sh index e3a04c17..3352a344 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/master" +SVN_URL="https://github.com/opengnsys/OpenGnsys/$BRANCH/admin/Database" DEFAULT_MYSQL_ROOT_PASSWORD="passwordroot" # Clave por defecto root de MySQL # Si se solicita, mostrar ayuda. @@ -231,7 +232,6 @@ if [ $OLDVERSION != $NEWVERSION ] ; then exit 0 fi # Nos bajamos los archivos de actualización de la base de datos - SVN_URL="https://$OPENGNSYS_SERVER/svn/tags/opengnsys-$NEWVERSION/admin/Database" [[ "$NEWVERSION" =~ pre ]] && 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 3316e4ff..9502d704 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/trunk/" +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 } @@ -1076,7 +1079,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: XAJAX, Slim y Swagger-UI. unzip -o $WORKDIR/opengnsys/admin/$XAJAXFILE -d $INSTALL_TARGET/www/xajax @@ -1102,6 +1104,7 @@ function installWebFiles() # Copiar ficheros en la zona de descargas de OpenGnsys Web Console. function installDownloadableFiles() { + INSTVERSION=1.1.0 ### Temporal. local FILENAME=ogagentpkgs-$INSTVERSION.tar.gz local TARGETFILE=$WORKDIR/$FILENAME @@ -1205,7 +1208,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 @@ -1303,7 +1306,7 @@ function copyServerFiles () elif [ -d "${SOURCES[$i]}" ]; then echoAndLog "Copying content of ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}" cp -a "${SOURCES[$i]}"/* "${path_opengnsys_base}/${TARGETS[$i]}" - else + else warningAndLog "Unable to copy ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}" fi done @@ -1396,7 +1399,6 @@ function copyClientFiles() errorAndLog "${FUNCNAME}(): error while copying client estructure" errstatus=1 fi - find $INSTALL_TARGET/client -name .svn -type d -exec rm -fr {} \; 2>/dev/null echoAndLog "${FUNCNAME}(): Copying OpenGnsys Cloning Engine files." mkdir -p $INSTALL_TARGET/client/lib/engine/bin @@ -1551,14 +1553,17 @@ EOT function installationSummary() { + local VERSIONFILE REVISION + # Crear fichero de versión y revisión, si no existe. - local VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" + VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" [ -f $VERSIONFILE ] || echo "OpenGnsys Server" >$VERSIONFILE # Incluir datos de revisión, si se está instaladno desde el repositorio # de código o si no está incluida en el fichero de versión. - if [ $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}') - perl -pi -e "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE + if [ $REMOTE -eq 1 ] || [ -z "$(awk '$3~/r[0-9]*/ {print}' $VERSIONFILE)" ]; then + # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit). + REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') + sed -ri "s/($| r[.0-9a-f]+)/ $REVISION/" $VERSIONFILE fi # Mostrar información. @@ -1655,10 +1660,10 @@ if [ $? -ne 0 ]; then fi # Si es necesario, descarga el repositorio de código en directorio temporal -if [ $USESVN -eq 1 ]; then - svnExportCode $SVN_URL +if [ $REMOTE -eq 1 ]; then + downloadCode $CODE_URL if [ $? -ne 0 ]; then - errorAndLog "Error while getting code from svn" + errorAndLog "Error while getting code from the repository" exit 1 fi else diff --git a/installer/opengnsys_makecompress.sh b/installer/opengnsys_makecompress.sh index 5cedcde4..1ba9d7d1 100755 --- a/installer/opengnsys_makecompress.sh +++ b/installer/opengnsys_makecompress.sh @@ -7,28 +7,40 @@ # 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/trunk/" -SVNREV=$(LANG=C svn info $SVNURL | awk '/Last Changed Rev:/ {print "r"$4}') +BRANCH="master" +CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" +API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" +REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') # 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 +sed -ri "s/$/ $REVISION/" opengnsys/doc/VERSION.txt # Generar fichero comprimido. VERSION=$(awk '{print $2"-"$3}' opengnsys/doc/VERSION.txt) tar cvzf opengnsys-$VERSION.tar.gz opengnsys -rm -fr opengnsys +rm -fr opengnsys opengnsys.zip # Revisar salida. [ $WARNING != 0 ] && echo "*** WARNING: cannot change owner of files to \"root\" user before compressing." diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index aaff523f..263260e9 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -173,6 +173,7 @@ function checkAutoUpdate() # Actaulizar el script si ha cambiado o no existe el original. if [ $REMOTE -eq 1 ]; then curl -s $RAW_URL/installer/$PROGRAMNAME -o $PROGRAMNAME + chmod +x $PROGRAMNAME if ! diff -q $PROGRAMNAME $INSTALL_TARGET/lib/$PROGRAMNAME 2>/dev/null || ! test -f $INSTALL_TARGET/lib/$PROGRAMNAME; then mv $PROGRAMNAME $INSTALL_TARGET/lib update=1 @@ -198,7 +199,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 } @@ -1011,11 +1012,12 @@ function updateSummary() { # Actualizar fichero de versión y revisión. local VERSIONFILE REVISION - VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" - REVISION=$(curl -s "$API_URL" | jq -r ".commit.commit.committer.date" | awk '{gsub(/[^0-9]/,""); print}') + # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit). + REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') + [ -f $VERSIONFILE ] || echo "OpenGnsys" >$VERSIONFILE - perl -pi -e "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE + sed -ri "s/($| r[.0-9a-f]+)/ $REVISION/" $VERSIONFILE echo echoAndLog "OpenGnsys Update Summary" diff --git a/installer/vagrant/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 e4f07837..a22e8850 100644 --- a/installer/vagrant/Vagrantfile-boottools-vbox +++ b/installer/vagrant/Vagrantfile-boottools-vbox @@ -19,12 +19,12 @@ sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"${LANG%_*}\"/" /etc/default/keyboard dpkg-reconfigure -fnoninteractive console-setup # Install dependencies. apt-get update -y -apt-get install -y subversion +apt-get install -y jq subversion syslinux syslinux-efi syslinux-utils # Prepare environment. groupadd opengnsys mkdir -p /opt/opengnsys/client /tmp/opengnsys_installer/opengnsys ln -fs /var/lib/tftpboot /opt/opengnsys -svn export https://opengnsys.es/svn/trunk/client /tmp/opengnsys_installer/opengnsys/client +svn export https://github.com/opengnsys/OpenGnsys/branches/master/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..a3b884a0 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/master/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..4d41afd0 100644 --- a/installer/vagrant/Vagrantfile-devel-vbox +++ b/installer/vagrant/Vagrantfile-devel-vbox @@ -1,4 +1,4 @@ -# Vagrantfile to install OpenGnsys 1.1 virtual environment using VirtualBox provider. +# Vagrantfile to install OpenGnsys virtual environment (development version) using VirtualBox provider. VAGRANTFILE_API_VERSION = "2" # VM provider: Oracle VM VirtualBox. @@ -38,7 +38,7 @@ if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then mount -a fi # Install OpenGnsys and change server address. -wget -q https://opengnsys.es/svn/branches/version1.1/installer/opengnsys_installer.sh -O - | bash || exit $? +curl -s https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh | bash || exit $? mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log echo y | /opt/opengnsys/bin/setserveraddr enp0s8 # Insert DHCP data. @@ -94,7 +94,7 @@ OGAGENTPKG = "ogagent_1.1.0_all.deb" MODELSCRIPT = <> /etc/fstab + mount -a +fi +# Install OpenGnsys and change server address. +curl -s https://raw.githubusercontent.com/opengnsys/OpenGnsys/master/installer/opengnsys_installer.sh | bash || exit $? +mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log +echo y | /opt/opengnsys/bin/setserveraddr enp0s8 +# Insert DHCP data. +for ((i=#{NCLIENTS+10}; i>10; i--)); do + sed -i "/^}$/ i host pc${i} { hardware ethernet #{MACPREFIX}:${i}; fixed-address #{NETPREFIX}.${i}; }" /etc/dhcp/dhcpd.conf +done +service isc-dhcp-server restart +# Set language. +export LANG="#{LANGUAGE}.UTF-8" +echo "LANG=\"$LANG\"" > /etc/default/locale +echo "LANG=\"$LANG\"" >> /etc/environment +locale-gen --lang #{LANGUAGE} +sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"${LANG%_*}\"/" /etc/default/keyboard +dpkg-reconfigure -fnoninteractive console-setup +# Comment out next lines for automatic data insertion. +#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}.1', '255.255.255.0', '', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" +#for ((i=11; i<=#{NCLIENTS+10}; i++)); do +# SQL="$SQL ('pc$i', '#{NETPREFIX}.$i', REPLACE('#{MACPREFIX}$i',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif')," +#done +#mysql -u usuog -ppassusuog -D ogAdmBD -e "${SQL%,}" +#/opt/opengnsys/bin/setclientmode ogLiveAdmin pc11 PERM +#for ((i=12; i<=#{NCLIENTS+10}; i++)); do +# /opt/opengnsys/bin/setclientmode ogLive pc$i PERM +#done +echo "Notes:" +echo "- OpenGnsys Server URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" +exit 0 +EOT + +# Client 1 OS provisioning script. +OGAGENTPKG = "ogagent_1.1.0_all.deb" +MODELSCRIPT = <> /etc/fstab - mount -a -fi -# Install OpenGnsys and change server address. -wget -q https://opengnsys.es/svn/trunk/installer/opengnsys_installer.sh -O - | bash || exit $? -mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log -echo y | /opt/opengnsys/bin/setserveraddr enp0s8 -# Insert DHCP data. -for ((i=#{NCLIENTS+10}; i>10; i--)); do - sed -i "/^}$/ i host pc${i} { hardware ethernet #{MACPREFIX}:${i}; fixed-address #{NETPREFIX}.${i}; }" /etc/dhcp/dhcpd.conf -done -service isc-dhcp-server restart -# Set language. -export LANG="#{LANGUAGE}.UTF-8" -echo "LANG=\"$LANG\"" > /etc/default/locale -echo "LANG=\"$LANG\"" >> /etc/environment -locale-gen --lang #{LANGUAGE} -sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"${LANG%_*}\"/" /etc/default/keyboard -dpkg-reconfigure -fnoninteractive console-setup -# Comment out next lines for automatic data insertion. -#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}.1', '255.255.255.0', '', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" -#for ((i=11; i<=#{NCLIENTS+10}; i++)); do -# SQL="$SQL ('pc$i', '#{NETPREFIX}.$i', REPLACE('#{MACPREFIX}$i',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif')," -#done -#mysql -u usuog -ppassusuog -D ogAdmBD -e "${SQL%,}" -#/opt/opengnsys/bin/setclientmode ogLiveAdmin pc11 PERM -#for ((i=12; i<=#{NCLIENTS+10}; i++)); do -# /opt/opengnsys/bin/setclientmode ogLive pc$i PERM -#done -echo "Notes:" -echo "- OpenGnsys Server URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" -exit 0 -EOT - -# Client 1 OS provisioning script. -OGAGENTPKG = "ogagent_1.1.0_all.deb" -MODELSCRIPT = </dev/null)" -o -z "$(getent group "$AP exit 1 fi +mkdir -p $OPENGNSYS_DIR/{log/clients,images/groups} chown -R :$OPENGNSYS_USER $OPENGNSYS_DIR/{log/clients,images/groups} find $OPENGNSYS_DIR/log/clients -type f -exec chmod 664 {} \; find $OPENGNSYS_DIR/images -maxdepth 1 -exec chown :$OPENGNSYS_USER {} \; @@ -50,8 +51,8 @@ chmod 600 $OPENGNSYS_DIR/etc/{ogAdmServer,ogAdmAgent}*.cfg chown root:$APACHE_GROUP $OPENGNSYS_DIR/{www/controlacceso*.php,etc/ogAdmRepo*.cfg} chmod 640 $OPENGNSYS_DIR/{www/controlacceso*.php,etc/ogAdmRepo*.cfg} chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/images/{fotos,iconos} -chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/api -chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/tmp # ??? +mkdir -p $OPENGNSYS_DIR/www/{api,tmp} +chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/{api,tmp} chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/tftpboot/menu.lst chown -R :$OPENGNSYS_USER $OPENGNSYS_DIR/tftpboot/ogLive* find -L $OPENGNSYS_DIR/tftpboot -type d -exec chmod 755 {} \; -- cgit v1.2.3-18-g5258