diff options
Diffstat (limited to 'installer')
l---------[-rw-r--r--] | installer/INSTALL.en.txt | 96 | ||||
l---------[-rw-r--r--] | installer/INSTALL.es.txt | 101 | ||||
-rwxr-xr-x | installer/opengnsys_export.sh | 9 | ||||
-rwxr-xr-x | installer/opengnsys_import.sh | 51 | ||||
-rwxr-xr-x | installer/opengnsys_installer.sh | 354 | ||||
-rwxr-xr-x | installer/opengnsys_makecompress.sh | 6 | ||||
-rwxr-xr-x | installer/opengnsys_update.sh | 100 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-1.0.6b-vbox | 2 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-browser-vbox | 23 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-devel-vbox | 34 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-prod-vbox | 2 |
11 files changed, 344 insertions, 434 deletions
diff --git a/installer/INSTALL.en.txt b/installer/INSTALL.en.txt index 23698972..ee919932 100644..120000 --- a/installer/INSTALL.en.txt +++ b/installer/INSTALL.en.txt @@ -1,95 +1 @@ -Installing OpenGnsys Server 1.1.1 (Espeto) -========================================== - -Before installation -------------------- - -OpenGnsys Server 1.1.1 (codename "Espeto") is meant to be installed under Ubuntu Server 16.04 LTS or newer, though it has also been tested under operating systems based on CentOS 7 (read COMPATIBILITY.en.txt for more details). - -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) -- 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) - - - -Installing ----------- - -To install OpenGnsys, run opengnsys_installer.sh script after unpacking the release file (opengnsys-release.tar.gz) or after downloading it directly from https://raw.githubusercontent.com/opengnsys/OpenGnsys/master/installer/opengnsys_installer.sh - -Unpacking example: - tar xvzf opengnsys-Version.tar.gz - cd opengnsys/installer - -Downloading examples: - - * Download with wget. - wget https://raw.githubusercontent.com/opengnsys/OpenGnsys/master/installer/opengnsys_installer.sh - - * Download with curl. - 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: - sudo bash opengnsys_installer.sh - - -The following information will be requested in order to configure the access to the service (a default value will be introduced if no parameter is indicated): - * MySQL root password - * 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 installed packages. - * Downloading and installing dependencies. - * Creating OpenGnsys basic folder sctructure. - * 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 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 process is finished, you can start working with the system: - * Configuring DHCP. - * Adding information in the administration console. - * Customizing administration scripts. - * Creating start menus for the clients. - - - -Updating / upgrading --------------------- - -There is a system self-upgrading script with the following features: - * Network connection is needed to obtain the latest updates / upgrades. - * If the script updates itself, then it must be run once again. - * Services depending on the operating system will not be updated. - * Configuration files will not be modified. - -You must be root to run this script: - sudo /opt/opengnsys/lib/opengnsys_update.sh - - - -Uninstalling ------------- - -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: - sudo /opt/opengnsys/lib/opengnsys_uninstall.sh - +../doc/INSTALL.en.txt
\ No newline at end of file diff --git a/installer/INSTALL.es.txt b/installer/INSTALL.es.txt index b99b1e20..e93a71d2 100644..120000 --- a/installer/INSTALL.es.txt +++ b/installer/INSTALL.es.txt @@ -1,100 +1 @@ -Instalación de OpenGnsys Server 1.1.1 (Espeto) -============================================== - -Notas iniciales ---------------- - -Se presupone que el servidor de OpenGnsys 1.1.1 (Espeto) debe ser instalado en una distribución del sistema operativo Ubuntu Server a partir de la versión 16.04 LTS, aunque también se está probado en sistemas basados en CentOS 7 (leer el fichero COMPATIBILITY.en.txt para obtener más detalles de compatibilidad). - -El serividor debe tener acceso a Internet para descargar los paquetes necesarios, el código del proyecto y el cliente preconfigurado. - -Requisitos mínimos de almacenamiento: -- 100 MB en el directorio /tmp (solo durante la instalación) -- 600 MB en el directorio /var/lib/tftpboot (o /srv en sistemas Debian) por cada cliente ogLive que se desee instalar. -- 250 MB en el directorio de instalación /opt/opengnsys más 600 MB por cada imagen ISO descargada de clientes ogLive. -- Estimar la capacidad necesaria para el repositorio de imágenes en /opt/opengnsys/images (es recomendable que este directorio se monte sobre un sistema de archivos independiente). - - -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://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh - -Ejemplos de descompresión del programa: - - tar xvzf opengnsys-Version.tar.gz - cd opengnsys/installer - -Ejemplos de descarga con varias herramientas: - - * Descargar con wget. - wget https://raw.githubusercontent.com/opengnsys/OpenGnsys/master/installer/opengnsys_installer.sh - - * Descargar con curl. - 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: - 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. - * Usuario de acceso a la consola web y super-administrador de OpenGnsys. - * Clave del usuario de acceso a la consola web. - * Clave de acceso del cliente a servicios remotos. - * Seleccionar cliente(s) ogLive para instalar. - -Se realizan los siguientes procesos: - * Obtener los parámetros básicos de la red. - * Comprobar los paquetes instalados. - * Descargar e instalar las dependencias que faltan. - * Crear la estructura básica de directorios de OpenGnsys. - * Descargar el repositorio de código en un directorio temporal (/tmp/opengnsys_installer). Nota: en versiones futuras este proceso no será necesario. - * Compilar e instalar los servicios de OpenGnsys. - * Configuración básica de los serviciios de red DHCP, PXE y NFS/Samba a partir de las plantillas de configuración - * Copiar ficheros complementarios de gestión del servidor. - * Crear la base de datos y configurar el servidor web de OpenGnsys Web Admin Console. - * Copiar los ficheros de las páginas de Web Admin Console. - * Copiar la estructura de directorios de OpenGnsys Client. - * Descargar la o las imágenes iniciales de OpenGnsys Client. - * Configuración básica de los serviciios de OpenGnsys a partir de los parámetros de red. - -Una vez finalizada la ejecución del instalador, puede empezarse a trabajar con el sistema: - * Configurar DHCP. - * Añadir datos en la consola de administración. - * Personalizar scripts de administración. - * Definir menús de inicio para los clientes. - - - -Actualización -------------- - -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. - * Si el script se actualiza a sí mismo, debe ser ejecutado de nuevo. - * No se actualizan los servicios asociados al sistema operativo. - * No se modifican los ficheros de configuración. - - -El script debe ser ejecutado como usuario root: - sudo /opt/opengnsys/lib/opengnsys_update.sh - - - -Desinstalación --------------- - -También existe un script de desinstalación de los componentes de OpenGnsys, con las siguientes características: - * Solicita confirmación para ejecutar sus operaciones. - * Se eliminan los ficheros de OpenGnsys y su base de datos. - * No se eliminan ni paquetes del sistema operativo ni sus ficheros de configuración. - * No se elimina el directorio de las imágenes ni su contenido. - * No se eliminan los clientes ogLive ni las plantillas PXE. - - -El script debe ser ejecutado como usuario root: - sudo /opt/opengnsys/lib/opengnsys_uninstall.sh - - +../doc/INSTALL.es.txt
\ No newline at end of file diff --git a/installer/opengnsys_export.sh b/installer/opengnsys_export.sh index 747a795a..09f2b763 100755 --- a/installer/opengnsys_export.sh +++ b/installer/opengnsys_export.sh @@ -15,6 +15,8 @@ #@version 1.1.0 - Cambia cómo se exporta la base de datos para permitir importar en versiones posteriores. #@note Incompatible con versiones de opengnsys_import.sh anteriores a esta fecha. #@date 2018-02-14 +#@version 1.1.1 - Incluye scripts personalizados (*Custom) +#@date 2019-07-25 #*/ ## # Variables globales. @@ -82,6 +84,7 @@ password=$PASSWORD EOT mysqldump --defaults-extra-file=$MYCNF --opt $CATALOG > $MYSQLFILE +chmod 400 $MYSQLFILE # Borrar fichero temporal rm -f $MYCNF @@ -94,13 +97,15 @@ echo $ServidorAdm > $TMPDIR/IPSERVER.txt # Empaquetamos los ficheros echo "Creamos un archivo comprimido con los datos: $BACKUPFILE." +CUSTOMFILES=$(find $OPENGNSYS/client/scripts -name "*Custom" -exec basename {} \;) tar -cvzf $BACKUPFILE --transform="s!^!$BACKUPPREFIX/!" \ -C $(dirname $MYSQLFILE) $(basename $MYSQLFILE) \ -C $TMPDIR IPSERVER.txt \ -C $DHCPDIR dhcpd.conf \ - -C $OPENGNSYS/tftpboot menu.lst \ - -C $OPENGNSYS/doc VERSION.json \ -C $OPENGNSYS/client/etc engine.cfg engine.json \ + -C $OPENGNSYS/client/scripts $CUSTOMFILES \ + -C $OPENGNSYS/doc VERSION.txt VERSION.json \ + -C $OPENGNSYS/tftpboot menu.lst grub \ -C $OPENGNSYS/www menus \ -C /etc default/opengnsys &>/dev/null diff --git a/installer/opengnsys_import.sh b/installer/opengnsys_import.sh index c3b343ee..528b8c3e 100755 --- a/installer/opengnsys_import.sh +++ b/installer/opengnsys_import.sh @@ -17,6 +17,8 @@ #@version 1.1.0 - Permite importar de versiones de OpenGnsys anteriores. Cambia la importación de la base de datos. #@note Incompatible con versiones de opengnsys_export.sh anteriores a esta fecha. #@date 2018-02-14 +#@version 1.1.1 - Importamos scripts Custom, PXE para UEFI y /etc/default/opengnsys. +#@date 2019-07-18 #*/ ## # Variables globales. @@ -157,7 +159,7 @@ function updateSqlFile() done # Aplicar posible actualización propia para la versión final. file=$CATALOG-$NEWVERSION.sql - if [ -n "$FILES" -o "$OLDVERSION" = "$NEWVERSION" -a -r $file ]; then + if [ -n "$FILES" -o "$OLDVERSION" = "$NEWVERSION" ] && [ -r $file ]; then FILES="$FILES $file" fi @@ -226,7 +228,8 @@ 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." - jq -r '[.project, .version, .codename] | join(" ")' $OPENGNSYS/doc/VERSION.json $TMPDIR/VERSION.json + jq -r '[.project, .version, .codename] | join(" ")' $OPENGNSYS/doc/VERSION.json $TMPDIR/VERSION.json 2>/dev/null \ + || cat $TMPDIR/VERSION.txt read -p "¿Quiere continuar? (y/n): " ANSWER if [ "${ANSWER^^}" != "Y" ]; then echo "Operación cancelada." @@ -259,7 +262,7 @@ fi mysql --defaults-extra-file=$MYCNF -e "SHOW TRIGGERS FROM $CATALOG;" |grep "Trigger" &>/dev/null if [ $? -eq 0 ]; then # Existe el trigger: eliminamos líneas del trigger en $CATALOG.sql - read INI END <<< $(grep -n -e TRIGGER -e "END.*;;" $MYSQLFILE |cut -d: -f1) + read -d\n INI END <<< $(grep -n -e TRIGGER -e "END.*;;" $MYSQLFILE |cut -d: -f1) [ -n "$INI" ] && sed -i "$INI,${END}d" $MYSQLFILE else # No existe: necesitamos privilegios de root @@ -271,7 +274,6 @@ fi # Eliminamos las tablas que no importamos: repositorios, entorno # y añadimos los usuarios, sólo si no existen. -cp $MYSQLFILE $MYSQLFILE.prueba sed -i -e '/Table structure.* `repositorios`/,/Table structure/d' \ -e '/Table structure.* `entornos`/,/Table structure/d' \ -e '/Table structure.*`usuarios`/,/CHARSET/d' \ @@ -280,11 +282,17 @@ sed -i -e '/Table structure.* `repositorios`/,/Table structure/d' \ # Copia de seguridad del estado de la base de datos mysqldump --defaults-extra-file=$MYCNF --opt $CATALOG > $MYSQLBCK +chmod 400 $MYSQLBCK # Importamos los datos nuevos mysql --defaults-extra-file=$MYCNF -D "$CATALOG" < $MYSQLFILE &>/dev/null [ $? -ne 0 ] && echo "ERROR: Error al importar la información de la base de datos." # Copiamos los archivos a su sitio correcto +# default/opengnsys +echo " * Guardamos la configuración de /etc/default." +mv /etc/default/opengnsys /etc/default/opengnsys-$DATE +cp $TMPDIR/default/opengnsys /etc/default/opengnsys + # DHCP echo " * Componemos la configuración del dhcp." for DHCPCFGDIR in /etc/dhcp /etc/dhcp3; do @@ -305,9 +313,27 @@ done # TFTP echo " * Guardamos los ficheros PXE de los clientes." -mv $OPENGNSYS/tftpboot/menu.lst $OPENGNSYS/tftpboot/menu.lst-$DATE -cp -r $TMPDIR/menu.lst $OPENGNSYS/tftpboot -chown -R www-data:www-data $OPENGNSYS/tftpboot/menu.lst +for BOOTLOADER in menu.lst grub; do + if [ -d $TMPDIR/$BOOTLOADER ]; then + mkdir $OPENGNSYS/tftpboot/$BOOTLOADER-$DATE + mv $OPENGNSYS/tftpboot/$BOOTLOADER/{01-*,templates,examples} $OPENGNSYS/tftpboot/$BOOTLOADER-$DATE 2>/dev/null + cp -r $TMPDIR/$BOOTLOADER/{01-*,templates,examples} $OPENGNSYS/tftpboot/$BOOTLOADER 2>/dev/null + chown -R www-data:www-data $OPENGNSYS/tftpboot/$BOOTLOADER + fi +done + +if [ -f $OPENGNSYS/tftpboot/menu.lst/templates/01 ]; then + echo " * Cambio del nombre de las plantillas PXE para compatibilidad con UEFI." + BIOSPXEDIR="$OPENGNSYS/tftpboot/menu.lst/templates" + mv $BIOSPXEDIR/01 $BIOSPXEDIR/10 + sed -i "s/\bMBR\b/1hd/" $BIOSPXEDIR/10 + sed -i "s/\b1hd-1partition\b/1hd-1os/" $BIOSPXEDIR/11 + sed -i "s/\b1hd-2partition\b/1hd-2os/" $BIOSPXEDIR/12 + + # Cambiamos el valor en la base de datos. Si no lo hacemos desaparecen de las columnas del NetBootAvanzado. + mysql --defaults-extra-file=$MYCNF -D "$CATALOG" -e "update ordenadores set arranque='10' where arranque='01';" &>/dev/null + [ $? -ne 0 ] && echo "ERROR: Error al modificar nombre de las plantilla '10' en la base de datos." +fi # Configuración de los clientes echo " * Guardamos la configuración de los clientes." @@ -319,10 +345,21 @@ echo " * Guardamos las páginas de inicio." mv $OPENGNSYS/www/menus $OPENGNSYS/www/menus-$DATE cp -r $TMPDIR/menus $OPENGNSYS/www +# Script personalizados +echo " * Guardamos los scripts personalizados." +if ls $OPENGNSYS/client/scripts/*Custom &>/dev/null; then + mkdir $OPENGNSYS/client/scripts/Custom-$DATE + mv $OPENGNSYS/client/scripts/*Custom $OPENGNSYS/client/scripts/Custom-$DATE +fi +cp -r $TMPDIR/*Custom $OPENGNSYS/client/scripts + echo -e "Se ha terminado de importar los datos del backup. \n\nSe han realizado copias de seguridad de los archivos antiguos:" +echo " - /etc/default/opengnsys-$DATE" echo " - $DHCPCFGDIR/dhcpd.conf-$DATE" echo " - $OPENGNSYS/tftpboot/menu.lst-$DATE" +echo " - $OPENGNSYS/tftpboot/grub-$DATE" echo " - $OPENGNSYS/client/etc/engine.cfg-$DATE" +echo " - $OPENGNSYS/client/scripts/Custom-$DATE" echo " - $OPENGNSYS/www/menus-$DATE" echo -e " - $MYSQLBCK \n" diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 93f26622..72d02115 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -6,131 +6,151 @@ ##################################################################### -#### AVISO: Puede editar configuración de acceso por defecto. -#### WARNING: Edit default access configuration if you wish. -DEFAULT_MYSQL_ROOT_PASSWORD="passwordroot" # Clave por defecto root de MySQL -DEFAULT_OPENGNSYS_DB_USER="usuog" # Usuario por defecto de acceso a la base de datos -DEFAULT_OPENGNSYS_DB_PASSWD="passusuog" # Clave por defecto de acceso a la base de datos -DEFAULT_OPENGNSYS_CLIENT_PASSWD="og" # Clave por defecto de acceso del cliente - -# Sólo ejecutable por usuario root -if [ "$(whoami)" != 'root' ]; then - echo "ERROR: this program must run under root privileges!!" - exit 1 -fi - -echo -e "\\nOpenGnsys Installation" -echo "==============================" +##################################################################### +####### Funciones de configuración +##################################################################### -# Clave root de MySQL -while : ; do - echo -n -e "\\nEnter root password for MySQL (${DEFAULT_MYSQL_ROOT_PASSWORD}): "; - read -r MYSQL_ROOT_PASSWORD - if [ -n "${MYSQL_ROOT_PASSWORD//[a-zA-Z0-9]/}" ]; then # Comprobamos que sea un valor alfanumerico - echo -e "\\aERROR: Must be alphanumeric, try again..." - else - # Si esta vacio ponemos el valor por defecto - MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD:-$DEFAULT_MYSQL_ROOT_PASSWORD}" - break - fi -done +# Devuelve en la variable PASSWORD la clave introducida por el usuario (o la indicada por defecto) +function enterPassword () +{ + local PASSWORD2 + local DEFAULT_PASSWORD="$1" + + while : ; do + stty -echo + read -r PASSWORD + stty echo + if [ -z "$PASSWORD" ]; then + # Si esta vacio ponemos el valor por defecto + PASSWORD="${PASSWORD:-$DEFAULT_PASSWORD}" + break + else + if [ -n "${PASSWORD//[a-zA-Z0-9]/}" ]; then # Comprobamos que sea un valor alfanumerico + echo -e "\\aERROR: Password must be alphanumeric, try again..." + else + echo -n -e "\\nConfirm password: " + stty -echo + read -r PASSWORD2 + stty echo + if [ "$PASSWORD" == "$PASSWORD2" ]; then + break + else + echo -e "\\aERROR: Passwords don't match, try again." + fi + fi + fi + echo -n -e "Please, enter a new password (${DEFAULT_PASSWORD}): " + done +} -# Usuario de acceso a la base de datos -while : ; do - echo -n -e "\\nEnter username for OpenGnsys console (${DEFAULT_OPENGNSYS_DB_USER}): " - read -r OPENGNSYS_DB_USER - if [ -n "${OPENGNSYS_DB_USER//[a-zA-Z0-9]/}" ]; then # Comprobamos que sea un valor alfanumerico - echo -e "\\aERROR: Must be alphanumeric, try again..." - else - # Si esta vacio ponemos el valor por defecto - OPENGNSYS_DB_USER="${OPENGNSYS_DB_USER:-$DEFAULT_OPENGNSYS_DB_USER}" - break - fi -done +# Recoge los datos de configuración introducidos por el usuario. +function userData () +{ + #### AVISO: Puede editar configuración de acceso por defecto. + #### WARNING: Edit default access configuration if you wish. + DEFAULT_MYSQL_ROOT_PASSWORD="passwordroot" # Clave por defecto root de MySQL + DEFAULT_OPENGNSYS_DB_USER="usuog" # Usuario por defecto de acceso a la base de datos + DEFAULT_OPENGNSYS_DB_PASSWD="passusuog" # Clave por defecto de acceso a la base de datos + DEFAULT_OPENGNSYS_CLIENT_PASSWD="og" # Clave por defecto de acceso del cliente + DEFAULT_OGLIVE="ogLive-bionic-5.0.0-27-generic-amd64-r20190830.7208cc9.iso" # Cliente ogLive + + echo -e "\\nOpenGnsys Installation" + echo "==============================" + + if [[ $- =~ s ]]; then + echo -e "\\nNot interactive mode: setting default configuration values.\\n" + MYSQL_ROOT_PASSWORD="$DEFAULT_MYSQL_ROOT_PASSWORD" + OPENGNSYS_DB_USER="$DEFAULT_OPENGNSYS_DB_USER" + OPENGNSYS_DB_PASSWD="$DEFAULT_OPENGNSYS_DB_PASSWD" + OPENGNSYS_CLIENT_PASSWD="$DEFAULT_OPENGNSYS_CLIENT_PASSWD" + OGLIVE="$DEFAULT_OGLIVE" + return + fi + + # Clave root de MySQL + echo -n -e "\\nEnter root password for MySQL (${DEFAULT_MYSQL_ROOT_PASSWORD}): " + enterPassword "$DEFAULT_MYSQL_ROOT_PASSWORD" + MYSQL_ROOT_PASSWORD="$PASSWORD" + + # Usuario de acceso a la base de datos + while : ; do + echo -n -e "\\n\\nEnter username for OpenGnsys console (${DEFAULT_OPENGNSYS_DB_USER}): " + read -r OPENGNSYS_DB_USER + if [ -n "${OPENGNSYS_DB_USER//[a-zA-Z0-9]/}" ]; then # Comprobamos que sea un valor alfanumerico + echo -e "\\aERROR: Must be alphanumeric, try again..." + else + # Si esta vacio ponemos el valor por defecto + OPENGNSYS_DB_USER="${OPENGNSYS_DB_USER:-$DEFAULT_OPENGNSYS_DB_USER}" + break + fi + done -# Clave de acceso a la base de datos -while : ; do + # Clave de acceso a la base de datos echo -n -e "\\nEnter password for OpenGnsys console (${DEFAULT_OPENGNSYS_DB_PASSWD}): " - read -r OPENGNSYS_DB_PASSWD - if [ -n "${OPENGNSYS_DB_PASSWD//[a-zA-Z0-9]/}" ]; then # Comprobamos que sea un valor alfanumerico - echo -e "\\aERROR: Must be alphanumeric, try again..." - else - # Si esta vacio ponemos el valor por defecto - OPENGNSYS_DB_PASSWD="${OPENGNSYS_DB_PASSWD:-$DEFAULT_OPENGNSYS_DB_PASSWD}" - break - fi -done - -# Clave de acceso del cliente -while : ; do - echo -n -e "\\nEnter root password for OpenGnsys client (${DEFAULT_OPENGNSYS_CLIENT_PASSWD}): " - read -r OPENGNSYS_CLIENT_PASSWD - if [ -n "${OPENGNSYS_CLIENT_PASSWD//[a-zA-Z0-9]/}" ]; then # Comprobamos que sea un valor alfanumerico - echo -e "\\aERROR: Must be alphanumeric, try again..." - else - # Si esta vacio ponemos el valor por defecto - OPENGNSYS_CLIENT_PASSWD="${OPENGNSYS_CLIENT_PASSWD:-$DEFAULT_OPENGNSYS_CLIENT_PASSWD}" - break - fi -done - -# Selección de clientes ogLive para descargar. -while : ; do - echo -e "\\nChoose ogLive client to install." - echo -e "1) Kernel 4.13, 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="ogLive-xenial-4.13.0-17-generic-amd64-r5520.iso" - break ;; - 2) OGLIVE="ogLive-precise-3.2.0-23-generic-r5159.iso" - break ;; - 3) OGLIVE="ogLive-xenial-4.13.0-17-generic-amd64-r5520.iso ogLive-precise-3.2.0-23-generic-r5159.iso"; - break ;; - *) echo -e "\\aERROR: unknown option, try again." - esac -done - -echo -e "\\n==============================" - -# 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 - REMOTE=0 -else - REMOTE=1 -fi -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 - -# Directorio destino de OpenGnsys. -INSTALL_TARGET=/opt/opengnsys -PATH=$PATH:$INSTALL_TARGET/bin - -# Registro de incidencias. -OGLOGFILE=$INSTALL_TARGET/log/${PROGRAMNAME%.sh}.log -LOG_FILE=/tmp/$(basename $OGLOGFILE) - -# Usuario del cliente para acceso remoto. -OPENGNSYS_CLIENT_USER="opengnsys" - -# Nombre de la base datos y fichero SQL para su creación. -OPENGNSYS_DATABASE="ogAdmBD" -OPENGNSYS_DB_CREATION_FILE=opengnsys/admin/Database/${OPENGNSYS_DATABASE}.sql + enterPassword "$DEFAULT_OPENGNSYS_DB_PASSWD" + OPENGNSYS_DB_PASSWD="$PASSWORD" + + # Clave de acceso del cliente + echo -n -e "\\n\\nEnter root password for OpenGnsys client (${DEFAULT_OPENGNSYS_CLIENT_PASSWD}): " + enterPassword "$DEFAULT_OPENGNSYS_CLIENT_PASSWD" + OPENGNSYS_CLIENT_PASSWD="$PASSWORD" + unset PASSWORD + + # Selección de clientes ogLive para descargar. + while : ; do + echo -e "\\n\\nChoose ogLive client to install." + echo -e "1) Kernel 5.0, 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 + echo -e "\\n==============================" +} -##################################################################### -####### Funciones de configuración -##################################################################### +# Asigna valores globales de configuración para el script. +function globalSetup () +{ + PROGRAMDIR=$(readlink -e "$(dirname "$0")") + PROGRAMNAME=$(basename "$0") + + # Comprobar si se ha descargado el paquete comprimido (REMOTE=0) o sólo el instalador (REMOTE=1). + OPENGNSYS_SERVER="opengnsys.es" + DOWNLOADURL="https://$OPENGNSYS_SERVER/trac/downloads" + if [ -d "$PROGRAMDIR/../installer" ]; then + REMOTE=0 + else + REMOTE=1 + fi + BRANCH="devel" + CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" + API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" + + # Directorios de instalación y destino de OpenGnsys. + WORKDIR=/tmp/opengnsys_installer + INSTALL_TARGET=/opt/opengnsys + PATH=$PATH:$INSTALL_TARGET/bin + + # Registro de incidencias. + OGLOGFILE=$INSTALL_TARGET/log/${PROGRAMNAME%.sh}.log + LOG_FILE=/tmp/$(basename $OGLOGFILE) + + # Usuario del cliente para acceso remoto. + OPENGNSYS_CLIENT_USER="opengnsys" + # Nombre de la base datos y fichero SQL para su creación. + OPENGNSYS_DATABASE="ogAdmBD" + OPENGNSYS_DB_CREATION_FILE=opengnsys/admin/Database/${OPENGNSYS_DATABASE}.sql +} # Generar variables de configuración del instalador # Variables globales: @@ -145,7 +165,6 @@ OPENGNSYS_DB_CREATION_FILE=opengnsys/admin/Database/${OPENGNSYS_DATABASE}.sql # - APACHEENABLEOG, APACHEOGSITE, - habilitar sitio web de OpenGnsys # - PHPFPMSERV - servicio PHP FastCGI Process Manager para Apache # - INETDSERV - servicio Inetd -# - FIREWALLSERV - servicio de cortabuegos IPTables/FirewallD # - DHCPSERV, DHCPCFGDIR - servicio y configuración de DHCP # - MYSQLSERV, TMPMYCNF - servicio MySQL y fichero temporal con credenciales de acceso # - MARIADBSERV - servicio MariaDB (sustituto de MySQL en algunas distribuciones) @@ -170,7 +189,7 @@ OSVERSION="${OSVERSION%%.*}" # Configuración según la distribución GNU/Linux (usar minúsculas). case "$OSDISTRIB" in ubuntu|debian|linuxmint) - DEPENDENCIES=( subversion apache2 php php-ldap php-fpm mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget curl doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast shim-signed grub-efi-amd64-signed python-pip ) + DEPENDENCIES=( subversion apache2 php php-ldap php-fpm mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget curl doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast libev-dev libjansson-dev shim-signed grub-efi-amd64-signed python-pip ) UPDATEPKGLIST="apt-get update" INSTALLPKG="apt-get -y install --force-yes" CHECKPKG="dpkg -s \$package 2>/dev/null | grep Status | grep -qw install" @@ -207,7 +226,7 @@ case "$OSDISTRIB" in TFTPCFGDIR=/var/lib/tftpboot ;; fedora|centos) - DEPENDENCIES=( subversion httpd mod_ssl php-ldap php-fpm mysql-server mysql-devel mysql-devel.i686 php-mysql dhcp tftp-server tftp xinetd binutils gcc gcc-c++ glibc-devel glibc-devel.i686 glibc-static glibc-static.i686 libstdc++-devel.i686 make wget curl doxygen graphviz ctorrent samba samba-client rsync unzip debootstrap schroot squashfs-tools python-crypto arp-scan procps-ng gettext moreutils jq net-tools udpcast shim-x64 grub2-efi-x64 grub2-efi-x64-modules python-pip http://ftp.altlinux.org/pub/distributions/ALTLinux/5.1/branch/$(arch)/RPMS.classic/netpipes-4.2-alt1.$(arch).rpm ) + DEPENDENCIES=( subversion httpd mod_ssl php-ldap php-fpm mysql-server mysql-devel mysql-devel.i686 php-mysql dhcp tftp-server tftp xinetd binutils gcc gcc-c++ glibc-devel glibc-devel.i686 glibc-static glibc-static.i686 libstdc++-devel.i686 make wget curl doxygen graphviz ctorrent samba samba-client rsync unzip debootstrap schroot squashfs-tools python-crypto arp-scan procps-ng gettext moreutils jq net-tools udpcast libev-devel shim-x64 grub2-efi-x64 grub2-efi-x64-modules http://ftp.altlinux.org/pub/distributions/ALTLinux/5.1/branch/$(arch)/RPMS.classic/netpipes-4.2-alt1.$(arch).rpm python-pip ) [ "$OSDISTRIB" == "centos" ] && UPDATEPKGLIST="yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$OSVERSION.noarch.rpm http://rpms.remirepo.net/enterprise/remi-release-$OSVERSION.rpm" INSTALLEXTRADEPS=( 'pushd /tmp; wget -t3 http://ftp.acc.umu.se/mirror/bittornado/BitTornado-0.3.18.tar.gz && tar xvzf BitTornado-0.3.18.tar.gz && cd BitTornado-CVS && python setup.py install && ln -fs btlaunchmany.py /usr/bin/btlaunchmany && ln -fs bttrack.py /usr/bin/bttrack; popd' ) INSTALLPKG="yum install -y libstdc++ libstdc++.i686" @@ -232,11 +251,6 @@ case "$OSDISTRIB" in APACHEREWRITEMOD="sed -i '/rewrite/s/^#//' $APACHECFGDIR/../*.conf" DHCPSERV=dhcpd DHCPCFGDIR=/etc/dhcp - if firewall-cmd --state &>/dev/null; then - FIREWALLSERV=firewalld - else - FIREWALLSERV=iptables - fi INETDSERV=xinetd INETDCFGDIR=/etc/xinetd.d MYSQLSERV=mysqld @@ -263,18 +277,17 @@ TMPMYCNF=/tmp/.my.cnf.$$ # Modificar variables de configuración tras instalar paquetes del sistema. function autoConfigurePost() { -local f +local f MKNETDIR # Configuraciones específicas para Samba y TFTP en Debian 6. [ -z "$SYSTEMD" -a ! -e /etc/init.d/$SAMBASERV ] && SAMBASERV=samba [ ! -e $TFTPCFGDIR ] && TFTPCFGDIR=/srv/tftp -# Configuraciones específicas para SELinux permisivo en distintas versiones. -[ -f /selinux/enforce ] && echo 0 > /selinux/enforce -for f in /etc/sysconfig/selinux /etc/selinux/config; do - [ -f $f ] && perl -pi -e 's/SELINUX=enforcing/SELINUX=permissive/g' $f +# Preparar arranque en red con Grub. +for f in grub-mknetdir grub2-mknetdir; do + if which $f &>/dev/null; then MKNETDIR=$f; fi done -selinuxenabled 2>/dev/null && setenforce 0 2>/dev/null +$MKNETDIR --net-directory=$TFTPCFGDIR --subdir=grub } @@ -825,13 +838,7 @@ function downloadCode() # Comprobar si existe conexión. function checkNetworkConnection() { - echoAndLog "${FUNCNAME}(): Disabling Firewall: $FIREWALLSERV." - if [ -n "$FIREWALLSERV" ]; then - service=$FIREWALLSERV - $STOPSERVICE; $DISABLESERVICE - fi - - echoAndLog "${FUNCNAME}(): Checking OpenGnsys server conectivity." + echoAndLog "${FUNCNAME}(): Checking OpenGnsys server connectivity." OPENGNSYS_SERVER=${OPENGNSYS_SERVER:-"opengnsys.es"} if which wget &>/dev/null; then wget --spider -q $OPENGNSYS_SERVER @@ -876,17 +883,18 @@ function getNetworkSettings() exit 1 fi for dev in ${DEVICE[*]}; do - SERVERIP[i]=$(ip -o addr show dev "$dev" | awk '$3~/inet$/ {sub (/\/.*/, ""); print ($4)}') + SERVERIP[i]=$(ip -o addr show dev "$dev" | awk '$3~/inet$/ {sub (/\/.*/, ""); print ($4); exit;}') if [ -n "${SERVERIP[i]}" ]; then - NETMASK[i]=$( cidr2mask $(ip -o addr show dev "$dev" | awk '$3~/inet$/ {sub (/.*\//, "", $4); print ($4)}') ) - NETBROAD[i]=$(ip -o addr show dev "$dev" | awk '$3~/inet$/ {print ($6)}') - NETIP[i]=$(ip route list proto kernel | awk -v d="$dev" '$3==d && /src/ {sub (/\/.*/,""); print $1}') - ROUTERIP[i]=$(ip route list default | awk -v d="$dev" '$5==d {print $3}') + NETMASK[i]=$( cidr2mask $(ip -o addr show dev "$dev" | awk '$3~/inet$/ {sub (/.*\//, "", $4); print ($4); exit;}') ) + NETBROAD[i]=$(ip -o addr show dev "$dev" | awk '$3~/inet$/ {print ($6); exit;}') + NETIP[i]=$(ip route list proto kernel | awk -v d="$dev" '$3==d && /src/ {sub (/\/.*/,""); print $1; exit;}') + ROUTERIP[i]=$(ip route list default | awk -v d="$dev" '$5==d {print $3; exit;}') DEFAULTDEV=${DEFAULTDEV:-"$dev"} fi let i++ done - DNSIP=$(awk '/nameserver/ {print $2}' /etc/resolv.conf | head -n1) + DNSIP=$(systemd-resolve --status 2>/dev/null | awk '/DNS Servers:/ {print $3; exit;}') + [ -z "$DNSIP" ] && DNSIP=$(awk '/nameserver/ {print $2; exit;}' /etc/resolv.conf) if [ -z "${NETIP[*]}" -o -z "${NETMASK[*]}" ]; then errorAndLog "${FUNCNAME}(): Network not detected." exit 1 @@ -986,12 +994,6 @@ function rsyncConfigure() # Configurar acceso a Rsync. sed -e "s/CLIENTUSER/$OPENGNSYS_CLIENT_USER/g" \ $WORKDIR/opengnsys/repoman/etc/rsyncd.conf.tmpl > $RSYNCCFGDIR/rsyncd.conf - sed -e "s/CLIENTUSER/$OPENGNSYS_CLIENT_USER/g" \ - -e "s/CLIENTPASSWORD/$OPENGNSYS_CLIENT_PASSWD/g" \ - $WORKDIR/opengnsys/repoman/etc/rsyncd.secrets.tmpl > $RSYNCCFGDIR/rsyncd.secrets - chown root.root $RSYNCCFGDIR/rsyncd.secrets - chmod 600 $RSYNCCFGDIR/rsyncd.secrets - # Habilitar Rsync y reiniciar Inetd. if [ -n "$RSYNCSERV" ]; then if [ -f /etc/default/rsync ]; then @@ -1102,7 +1104,6 @@ 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 @@ -1153,7 +1154,7 @@ function installWebConsoleApacheConf() echoAndLog "${FUNCNAME}(): configuring PHP-FPM" service=$PHPFPMSERV $ENABLESERVICE; $STARTSERVICE - sockfile=$(find /run/php -name "php*.sock" -type s -print 2>/dev/null) + sockfile=$(find /run/php -name "php*.sock" -type s -print 2>/dev/null | tail -1) # Activar módulos de Apache. $APACHEENABLEMODS @@ -1374,12 +1375,11 @@ function copyInterfaceAdm () echoAndLog "${FUNCNAME}(): error while copying Administration Interface Folder" hayErrores=1 fi - chown $OPENGNSYS_CLIENT_USER:$OPENGNSYS_CLIENT_USER $INSTALL_TARGET/client/interfaceAdm/CambiarAcceso - chmod 700 $INSTALL_TARGET/client/interfaceAdm/CambiarAcceso return $hayErrores } + #################################################################### ### Funciones instalacion cliente opengnsys #################################################################### @@ -1413,6 +1413,18 @@ function copyClientFiles() } +# Crear certificados para la firma de cargadores de arranque. +function createCerts () +{ + local SSLCFGDIR=$INSTALL_TARGET/client/etc/ssl + echoAndLog "${FUNCNAME}(): creating certificate files" + mkdir -p $SSLCFGDIR/{certs,private} + openssl req -new -x509 -newkey rsa:2048 -keyout $SSLCFGDIR/private/opengnsys.key -out $SSLCFGDIR/certs/opengnsys.crt -nodes -days 3650 -subj "/CN=OpenGnsys/" + openssl x509 -in $SSLCFGDIR/certs/opengnsys.crt -out $SSLCFGDIR/certs/opengnsys.cer -outform DER + echoAndLog "${FUNCNAME}(): certificate successfully created" +} + + # Crear cliente OpenGnsys. function clientCreate() { @@ -1441,8 +1453,6 @@ function clientCreate() echoAndLog "${FUNCNAME}(): Installing ogLive Client" echo -ne "$OPENGNSYS_CLIENT_PASSWD\n$OPENGNSYS_CLIENT_PASSWD\n" | \ oglivecli install $FILENAME - # Adaptar permisos. - chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP $INSTALL_TARGET/tftpboot/menu.lst echoAndLog "${FUNCNAME}(): Client generation success" } @@ -1484,6 +1494,7 @@ function openGnsysConfigure() -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \ -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" \ -e "s/DATABASE/$OPENGNSYS_DATABASE/g" \ + -e "s/REPOKEY/$OPENGNSYS_REPOKEY/g" \ $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer/ogAdmServer.cfg > $INSTALL_TARGET/etc/ogAdmServer-$dev.cfg sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ -e "s/REPOKEY/$OPENGNSYS_REPOKEY/g" \ @@ -1514,10 +1525,6 @@ function openGnsysConfigure() ln -f $INSTALL_TARGET/etc/ogAdmAgent-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmAgent.cfg ln -f $INSTALL_TARGET/client/etc/ogAdmClient-$DEFAULTDEV.cfg $INSTALL_TARGET/client/etc/ogAdmClient.cfg ln -f $INSTALL_TARGET/www/controlacceso-$DEFAULTDEV.php $INSTALL_TARGET/www/controlacceso.php - chown root:root $INSTALL_TARGET/etc/{ogAdmServer,ogAdmAgent}*.cfg - chmod 600 $INSTALL_TARGET/etc/{ogAdmServer,ogAdmAgent}*.cfg - chown $APACHE_RUN_USER:$APACHE_RUN_GROUP $INSTALL_TARGET/www/controlacceso*.php - chmod 600 $INSTALL_TARGET/www/controlacceso*.php # Configuración del motor de clonación. # - Zona horaria del servidor. @@ -1560,7 +1567,7 @@ function installationSummary() # de código o si no está incluida en el fichero de versión. 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])') + REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | split("-") | join("")[:8]) + "." + (.commit.sha[:7])') jq ".release=$REVISION" $VERSIONFILE | sponge $VERSIONFILE fi VERSION="$(jq -r '[.project, .version, .codename, .release] | join(" ")' $VERSIONFILE 2>/dev/null)" @@ -1578,16 +1585,15 @@ function installationSummary() echoAndLog "Installed ogLive client(s): $(oglivecli list | awk '{print $2}')" echoAndLog "Samba configuration directory: $SAMBACFGDIR" echoAndLog "Web Console URL: $OPENGNSYS_CONSOLEURL" - echoAndLog "Web Console access data: specified in installer script" + echoAndLog "Web Console access data: entered by the user" if grep -q "^RUN_BTTRACK.*no" /etc/default/opengnsys; then echoAndLog "BitTorrent service is disabled." fi echo echoAndLog "Post-Installation Instructions:" echo "===============================" - echoAndLog "Firewall service has been disabled and SELinux mode set to" - echoAndLog " permissive during OpenGnsys installation. Please check" - echoAndLog " ${FIREWALLSERV:-firewall} and SELinux configuration, if needed." + echoAndLog "You can improve server security by configuring firewall and SELinux," + echoAndLog " running \"$INSTALL_TARGET/lib/security-config\" script as root." echoAndLog "It's strongly recommended to synchronize this server with an NTP server." echoAndLog "Review or edit all configuration files." echoAndLog "Insert DHCP configuration data and restart service." @@ -1604,7 +1610,18 @@ echo ####### Proceso de instalación de OpenGnsys ##################################################################### +# Sólo ejecutable por usuario root +if [ "$(whoami)" != 'root' ]; then + echo "ERROR: this program must run under root privileges!!" + exit 1 +fi + +globalSetup echoAndLog "OpenGnsys installation begins at $(date)" +# Introducir datos de configuración y establecer variables globales. +userData + +mkdir -p $WORKDIR pushd $WORKDIR # Detectar datos iniciales de auto-configuración del instalador. @@ -1803,6 +1820,9 @@ if [ $? -ne 0 ]; then errorAndLog "Error creating client structure" fi +# Crear certificado para firmar cargadores +createCerts + # Crear la estructura del cliente de OpenGnsys. for i in $OGLIVE; do if ! clientCreate "$i"; then diff --git a/installer/opengnsys_makecompress.sh b/installer/opengnsys_makecompress.sh index ff267b1e..6b09deb5 100755 --- a/installer/opengnsys_makecompress.sh +++ b/installer/opengnsys_makecompress.sh @@ -20,13 +20,13 @@ for PROG in jq unzip; do fi done -# Variables +# Variables. 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])') +REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | split("-") | join("")[:8]) + "." + (.commit.sha[:7])') -# Descargar repositorio SVN +# Descargar del repositorio de código. cd /tmp rm -fr opengnsys curl "$CODE_URL" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index 1182b6eb..68978b3d 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -118,7 +118,9 @@ 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 shim-signed grub-efi-amd64-signed php-fpm python-pip ) + DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast libev-dev libjansson-dev shim-signed grub-efi-amd64-signed php-fpm python-pip ) + # Paquete correcto para realpath. + [ -z "$(apt-cache pkgnames realpath)" ] && DEPENDENCIES=( ${DEPENDENCIES[@]//realpath/coreutils} ) UPDATEPKGLIST="add-apt-repository -y ppa:ondrej/php; apt-get update" INSTALLPKGS="apt-get -y install" DELETEPKGS="apt-get -y purge" @@ -141,7 +143,7 @@ function autoConfigure() INETDCFGDIR=/etc/xinetd.d elif [ -f /etc/redhat-release ]; then # Distribución basada en paquetes rpm. - DEPENDENCIES=( curl rsync btrfs-progs procps-ng arp-scan gettext moreutils jq net-tools udpcast shim-x64 grub2-efi-x64 grub2-efi-x64-modules python-pip ) + DEPENDENCIES=( curl rsync btrfs-progs procps-ng arp-scan gettext moreutils jq net-tools udpcast libev-devel shim-x64 grub2-efi-x64 grub2-efi-x64-modules python-pip ) # Repositorios para PHP 7 en CentOS. [ "$OSDISTRIB" == "centos" ] && UPDATEPKGLIST="yum update -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$OSVERSION.noarch.rpm http://rpms.remirepo.net/enterprise/remi-release-$OSVERSION.rpm" INSTALLPKGS="yum install -y" @@ -167,7 +169,7 @@ function autoConfigure() : fi for service in apache2 httpd; do - [ -d /etc/$service ] && APACHECFGDIR="/etc/$service" + [ -d "/etc/$service" ] && APACHECFGDIR="/etc/$service" if $SERVICESTATUS &>/dev/null; then APACHESERV="$service"; fi done for service in dhcpd dhcpd3-server isc-dhcp-server; do @@ -300,7 +302,6 @@ function importSqlFile() local mycnf=/tmp/.my.cnf.$$ local status local APIKEY=$(php -r 'echo md5(uniqid(rand(), true));') - REPOKEY=$(php -r 'echo md5(uniqid(rand(), true));') if [ ! -r $sqlfile ]; then errorAndLog "${FUNCNAME}(): Unable to read $sqlfile!!" @@ -430,7 +431,10 @@ function downloadCode() echoAndLog "${FUNCNAME}(): downloading code..." - curl "${url}" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys + curl "$url" -o opengnsys.zip && \ + unzip -qo opengnsys.zip && \ + rm -fr opengnsys && \ + mv "OpenGnsys-$BRANCH" opengnsys if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error getting code from ${url}, verify your user and password" return 1 @@ -470,7 +474,7 @@ function checkVersion() if [ $REMOTE -eq 1 ]; then NEWVERSION=$(curl -s $RAW_URL/doc/VERSION.json 2>/dev/null | jq -r '.version') else - NEWVERSION=$(jq -r '.version' $PROGRAMDIR/doc/VERSION.json 2>/dev/null) + NEWVERSION=$(jq -r '.version' $PROGRAMDIR/../doc/VERSION.json 2>/dev/null) fi [[ "$NEWVERSION" =~ pre ]] && PRE=1 @@ -494,7 +498,7 @@ function getNetworkSettings() SERVERIP="$ServidorAdm" DEVICES="$(ip -o link show up | awk '!/loopback/ {sub(/:.*/,"",$2); print $2}')" for dev in $DEVICES; do - [ -z "$SERVERIP" ] && SERVERIP=$(ip -o addr show dev $dev | awk '$3~/inet$/ {sub (/\/.*/, ""); print ($4)}') + [ -z "$SERVERIP" ] && SERVERIP=$(ip -o addr show dev $dev | awk '$3~/inet$/ {sub (/\/.*/, ""); print ($4); exit;}') done } @@ -544,6 +548,19 @@ EOT echoAndLog "${FUNCNAME}(): client files successfully updated" } +# Crear certificado para la firma de cargadores de arranque, si es necesario. +function createCerts () +{ + local SSLCFGDIR=$INSTALL_TARGET/client/etc/ssl + mkdir -p $SSLCFGDIR/{certs,private} + if [ ! -f $SSLCFGDIR/private/opengnsys.key ]; then + echoAndLog "${FUNCNAME}(): creating certificate files" + openssl req -new -x509 -newkey rsa:2048 -keyout $SSLCFGDIR/private/opengnsys.key -out $SSLCFGDIR/certs/opengnsys.crt -nodes -days 3650 -subj "/CN=OpenGnsys/" + openssl x509 -in $SSLCFGDIR/certs/opengnsys.crt -out $SSLCFGDIR/certs/opengnsys.cer -outform DER + echoAndLog "${FUNCNAME}(): certificate successfully created" + fi +} + # Configurar HTTPS y exportar usuario y grupo del servicio Apache. function apacheConfiguration () { @@ -571,7 +588,7 @@ function apacheConfiguration () else template=$WORKDIR/opengnsys/server/etc/apache.conf.tmpl fi - sockfile=$(find /run/php -name "php*.sock" -type s -print 2>/dev/null) + sockfile=$(find /run/php -name "php*.sock" -type s -print 2>/dev/null | tail -1) # Actualizar configuración de Apache a partir de fichero de plantilla. for config in $APACHECFGDIR/{,sites-available/}opengnsys.conf; do if [ -e $config ]; then @@ -745,7 +762,7 @@ function createDirs() { # Crear estructura de directorios. echoAndLog "${FUNCNAME}(): creating directory paths in ${INSTALL_TARGET}" - local dir + local dir MKNETDIR mkdir -p ${INSTALL_TARGET}/{bin,doc,etc,lib,sbin,www} mkdir -p ${INSTALL_TARGET}/{client,images/groups} @@ -757,12 +774,19 @@ function createDirs() [ -d $dir ] && ln -fs $dir ${INSTALL_TARGET}/tftpboot done fi - mkdir -p $INSTALL_TARGET/tftpboot/menu.lst/examples + mkdir -p $INSTALL_TARGET/tftpboot/{menu.lst,grub}/examples if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?" return 1 fi ! [ -f $INSTALL_TARGET/tftpboot/menu.lst/templates/00unknown ] && mv $INSTALL_TARGET/tftpboot/menu.lst/templates/* $INSTALL_TARGET/tftpboot/menu.lst/examples + ! [ -f $INSTALL_TARGET/tftpboot/grub/templates/10 ] && mv $INSTALL_TARGET/tftpboot/grub/templates/* $INSTALL_TARGET/tftpboot/grub/examples + + # Preparar arranque en red con Grub. + for f in grub-mknetdir grub2-mknetdir; do + if which $f &>/dev/null; then MKNETDIR=$f; fi + done + $MKNETDIR --net-directory=$TFTPCFGDIR --subdir=grub # Crear usuario ficticio. if id -u $OPENGNSYS_CLIENTUSER &>/dev/null; then @@ -825,6 +849,7 @@ function updateDatabase() fi popd >/dev/null + REPOKEY=$(php -r 'echo md5(uniqid(rand(), true));') if [ -n "$FILES" ]; then for file in $FILES; do importSqlFile $OPENGNSYS_DBUSER $OPENGNSYS_DBPASSWORD $OPENGNSYS_DATABASE $DBDIR/$file @@ -889,6 +914,18 @@ function updateServerFiles() cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys NEWFILES="$NEWFILES /etc/init.d/opengnsys" fi + if ! diff -q $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default /etc/default/opengnsys >/dev/null; then + echoAndLog "${FUNCNAME}(): updating new default file" + backupFile /etc/default/opengnsys + # Buscar si hay nuevos parámetros. + local var valor + while IFS="=" read -e var valor; do + [[ $var =~ ^# ]] || \ + grep -q "^$var=" /etc/default/opengnsys || \ + echo "$var=$valor" >> /etc/default/opengnsys + done < $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default + NEWFILES="$NEWFILES /etc/default/opengnsys" + fi if egrep -q "(UrlMsg=.*msgbrowser.php)|(UrlMenu=http://)" $INSTALL_TARGET/client/etc/ogAdmClient.cfg 2>/dev/null; then echoAndLog "${FUNCNAME}(): updating new client config file" backupFile $INSTALL_TARGET/client/etc/ogAdmClient.cfg @@ -903,6 +940,15 @@ function updateServerFiles() [ ! -f /etc/cron.d/imagedelete ] && echo "* * * * * root [ -x $INSTALL_TARGET/bin/deletepreimage ] && $INSTALL_TARGET/bin/deletepreimage" > /etc/cron.d/imagedelete [ ! -f /etc/cron.d/ogagentqueue ] && echo "* * * * * root [ -x $INSTALL_TARGET/bin/ogagentqueue.cron ] && $INSTALL_TARGET/bin/ogagentqueue.cron" > /etc/cron.d/ogagentqueue echoAndLog "${FUNCNAME}(): server files successfully updated" + + # Se modifican los nombres de las plantilla PXE por compatibilidad con los equipos UEFI. + if [ -f $INSTALL_TARGET/tftpboot/menu.lst/templates/01 ]; then + BIOSPXEDIR="$INSTALL_TARGET/tftpboot/menu.lst/templates" + mv $BIOSPXEDIR/01 $BIOSPXEDIR/10 + sed -i "s/\bMBR\b/1hd/" $BIOSPXEDIR/10 + sed -i "s/\b1hd-1partition\b/1hd-1os/" $BIOSPXEDIR/11 + sed -i "s/\b1hd-2partition\b/1hd-2os/" $BIOSPXEDIR/12 + fi } #################################################################### @@ -946,9 +992,8 @@ function compileServices() popd # Parar antiguo servicio de repositorio y añadir clave de acceso REST en su fichero de configuración. pgrep ogAdmRepo > /dev/null && service="ogAdmRepo" $STOPSERVICE - grep -q '^ApiToken=' $INSTALL_TARGET/etc/ogAdmRepo.cfg && \ - sed -i "s/^ApiToken=.*$/ApiToken=$REPOKEY/" $INSTALL_TARGET/etc/ogAdmRepo.cfg || \ - sed -i "$ a\ApiToken=$REPOKEY/" $INSTALL_TARGET/etc/ogAdmRepo.cfg + sed -i -n -e "/^ApiToken=/!p" -e "$ a\ApiToken=$REPOKEY" $INSTALL_TARGET/etc/ogAdmRepo.cfg + sed -i -n -e "/^APITOKEN=/!p" -e "$ a\APITOKEN=$REPOKEY" $INSTALL_TARGET/etc/ogAdmServer.cfg # Compilar OpenGnsys Agent echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Server Agent" pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent @@ -980,8 +1025,8 @@ function compileServices() # Actualizar cliente OpenGnsys function updateClient() { - #local FILENAME=ogLive-precise-3.2.0-23-generic-r5159.iso # 1.1.0-rc6 (old) - local FILENAME=ogLive-xenial-4.13.0-17-generic-amd64-r5520.iso # 1.1.0-rc6 + #local FILENAME=ogLive-precise-3.2.0-23-generic-r5159.iso # 1.1.0-rc6 (32-bit) + local FILENAME=ogLive-bionic-5.0.0-27-generic-amd64-r20190830.7208cc9.iso # 1.1.1-rc5 local SOURCEFILE=$DOWNLOADURL/$FILENAME local TARGETFILE=$(oglivecli config download-dir)/$FILENAME local SOURCELENGTH @@ -995,7 +1040,7 @@ function updateClient() oglivecli convert fi # Comprobar si debe actualizarse el cliente. - SOURCELENGTH=$(curl -sI $SOURCEFILE 2>&1 | awk '/Content-Length:/ {print $2}') + SOURCELENGTH=$(curl -sI $SOURCEFILE 2>&1 | awk '/Content-Length:/ {gsub("\r", ""); print $2}') TARGETLENGTH=$(stat -c "%s" $TARGETFILE 2>/dev/null) [ -z $TARGETLENGTH ] && TARGETLENGTH=0 if [ "$SOURCELENGTH" != "$TARGETLENGTH" ]; then @@ -1009,7 +1054,7 @@ function updateClient() echoAndLog "${FUNCNAME}(): Updatting ogLive client" oglivecli install $FILENAME - CLIENTUPDATED=${FILENAME%.*} + INSTALLEDOGLIVE=${FILENAME%.*} echoAndLog "${FUNCNAME}(): ogLive successfully updated" else @@ -1067,8 +1112,14 @@ function updateSummary() # Actualizar fichero de versión y revisión. 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])') + # Obtener revisión. + if [ $REMOTE -eq 1 ]; 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 | split("-") | join("")[:8]) + "." + (.commit.sha[:7])') + else + # Parámetro "release" del fichero JSON. + REVISION=$(jq -r '.release' $PROGRAMDIR/../doc/VERSION.json 2>/dev/null) + fi [ -f $VERSIONFILE ] || echo '{ "project": "OpenGnsys" }' > $VERSIONFILE jq ".release=$REVISION" $VERSIONFILE | sponge $VERSIONFILE VERSION="$(jq -r '[.project, .version, .codename, .release] | join(" ")' $VERSIONFILE 2>/dev/null)" @@ -1096,8 +1147,8 @@ function updateSummary() echoAndLog "Warnings:" echoAndLog " - You must to clear web browser cache before loading OpenGnsys page" echoAndLog " - Generated new key to access Repository REST API (file ogAdmRepo.cfg)" - if [ -n "$CLIENTUPDATED" ]; then - echoAndLog " - ogLive Client is updated to: $CLIENTUPDATED" + if [ -n "$INSTALLEDOGLIVE" ]; then + echoAndLog " - Installed new ogLive Client: $INSTALLEDOGLIVE" fi if [ -n "$MYSQLCONFIG" ]; then echoAndLog " - MySQL must be reconfigured, run next code as DB root user and restart service:" @@ -1190,11 +1241,12 @@ fi # Configurar Rsync. rsyncConfigure -# Actualizar ficheros del cliente +# Actualizar ficheros del cliente. updateClientFiles +createCerts updateInterfaceAdm -# Actualizar páqinas web +# Actualizar páqinas web. apacheConfiguration updateWebFiles if [ $? -ne 0 ]; then @@ -1222,7 +1274,7 @@ checkFiles # Mostrar resumen de actualización. updateSummary -#rm -rf $WORKDIR +rm -rf $WORKDIR echoAndLog "OpenGnsys update finished at $(date)" popd diff --git a/installer/vagrant/Vagrantfile-1.0.6b-vbox b/installer/vagrant/Vagrantfile-1.0.6b-vbox index 2db25e1c..4317c654 100644 --- a/installer/vagrant/Vagrantfile-1.0.6b-vbox +++ b/installer/vagrant/Vagrantfile-1.0.6b-vbox @@ -42,7 +42,7 @@ fi # Install OpenGnsys and change server address. wget -q https://opengnsys.es/svn/tags/opengnsys-1.0.6b/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 eth1 +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 diff --git a/installer/vagrant/Vagrantfile-browser-vbox b/installer/vagrant/Vagrantfile-browser-vbox index 60db8297..8e3abebf 100644 --- a/installer/vagrant/Vagrantfile-browser-vbox +++ b/installer/vagrant/Vagrantfile-browser-vbox @@ -21,27 +21,37 @@ dpkg-reconfigure -fnoninteractive console-setup # Install main dependencies. apt-get update apt-get install -y build-essential gettext libssl-dev libucommon-dev libxtst-dev subversion -# Compile Qt-Embedded 4.8 (aceptar la licencia Open Source). -wget http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz +# Compile Qt-Embedded 4.8 (accept Open Source license). +wget http://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz tar xvzf qt-everywhere-opensource-src-4.8.7.tar.gz cd qt-everywhere-opensource-src-4.8.7 echo "yes" | ./configure -opensource -embedded x86 -webkit -openssl -qt-gfx-vnc -qvfb -prefix /usr/local/ -nomake demos -nomake examples make make install -# Compile Browser. -svn export https://github.com/opengnsys/OpenGnsys/branches/devel/client/browser ../browser -cd browser +# Compile the Browser. +BRANCH="devel" +svn export "https://github.com/opengnsys/OpenGnsys/branches/$BRANCH/client/browser" ../browser +cd ../browser qmake browser.pro make strip browser +# Update locale string files. +xgettext -C --qt --from-code=UTF-8 -o browser.pot src/*.cpp +msgmerge -U po/en.po browser.pot +msgmerge -U po/ca.po browser.pot +rm -f browser.pot # Instructions. echo "Browser's code is in /home/vagrant/browser directory." echo "To compile a new Browser, run as root user:" echo " cd /home/vagrant/browser && qmake browser.pro && make" -echo "Do not forget to copy all Browser's files to OpenGnsys Server:" +echo "To compile new locale files (note that \"xx\" is a locale code, like \"en\" or \"ca\"):" +echo " - Translate strings by editing each po/xx.po file." +echo " - Compile each locale file by running as root: msgfmt -o xx.mo po/xx.po" +echo "Do not forget to copy all Browser's files to the OpenGnsys Server:" echo " - Browser binary to /opt/opengnsys/client/bin directory on server." echo " - Qt linked libraries to /opt/opengnsys/client/lib/qtlibs directory." echo " - 64-bit-based ogLive only: libssl and libcrypto to /opt/opengnsys/client/lib/qtlibs directory." +echo " - Compiled Locale files, if needed: xx.mo as /opt/opengnsys/client/lib/locale/xx/LC_MESSAGES/browser.mo (\"xx\" is a locale code)." EOT Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| @@ -54,7 +64,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vb.name = "ogBrowser" vb.memory = VMMEM vb.cpus = VMCPUS - vb.gui = true end # VM base and host name. br.vm.box = "ubuntu/trusty32" diff --git a/installer/vagrant/Vagrantfile-devel-vbox b/installer/vagrant/Vagrantfile-devel-vbox index 7aac2c56..c558227a 100644 --- a/installer/vagrant/Vagrantfile-devel-vbox +++ b/installer/vagrant/Vagrantfile-devel-vbox @@ -43,9 +43,10 @@ if which curl &>/dev/null; then elif which wget &>/dev/null; then DOWNLOAD="wget -q -O -" fi -$DOWNLOAD -s https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh | bash || exit $? +BRANCH="devel" +$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 enp0s8 +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 @@ -68,34 +69,13 @@ dpkg-reconfigure -fnoninteractive console-setup #for ((i=12; i<=#{NCLIENTS+10}; i++)); do # /opt/opengnsys/bin/setclientmode ogLive pc$i PERM #done -# Comment out next lines to install new Angular-based web application (on early development). -#apt-get install -y git nodejs npm -#ln -fs nodejs /usr/bin/node -#npm install bower -g -#svn export https://opengnsys.es/svn/branches/version1.1-tickets/ogWebAdmin-ticket761/admin/WebConsole/angular /opt/opengnsys/www/angular -#cd /opt/opengnsys/www/angular -#chown -R vagrant.vagrant . -#su vagrant -c "bower install -F" -#sed -i 's!BASE_URL = .*$!BASE_URL = "https://localhost:#{LOCALWEBPORT}/opengnsys";!' ogWebAdmin/assets/js/config.constants.js -#### TEMPORAL PATCHES -#su vagrant -c "bower install angular-sanitize -F" -#su vagrant -c "bower install angular-translate-loader-static-files -F" -#su vagrant -c "bower install angular-ui-select -F" -#su vagrant -c "bower install bootstrap -F" -#su vagrant -c "bower install isteven-angular-multiselect -F" -#ln -s globunet-util.min.css ogWebAdmin/lib/globunet/dist/css/globunet-util.css -#cp -a ogWebAdmin/assets/i18n/es.json ogWebAdmin/assets/i18n/en.json -#sed -i 's/jm.bardallo/usuog/' ogWebAdmin/assets/js/controllers/login.controller.js -#sed -i "s/DirectoryIndex index.php/DirectoryIndex index.php index.html/" /etc/apache2/sites-enabled/opengnsys.conf -#service apache2 reload echo "Notes:" echo "- OpenGnsys Server URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" -[ -d /opt/opengnsys/www/angular ] && echo "- Angular-based web URL: https://localhost:#{LOCALWEBPORT}/opengnsys/angular/ogWebAdmin/" exit 0 EOT # Client 1 OS provisioning script. -OGAGENTPKG = "ogagent_1.1.0_all.deb" +OGAGENTPKG = "ogagent_1.1.1_all.deb" MODELSCRIPT = <<EOT # Comment out next lines to install and configure OGAgent for Ubuntu. #apt-get update -y @@ -109,7 +89,7 @@ MODELSCRIPT = <<EOT # echo "Warning: cannot install OGAgent package #{OGAGENTPKG}" #fi # Remove network configuration added by Vagrant. -sed -i "/enp0s3/ d" /etc/network/interfaces +sed -i "/eth1/ d" /etc/network/interfaces echo "Notes:" echo "- After now, use VirtualBox GUI to disable network interface 1 and restart this VM." # Leave VM halted. @@ -143,7 +123,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', second_disk] end # VM base and host name. - og.vm.box = "bento/ubuntu-16.04" + og.vm.box = "bento/ubuntu-18.04" 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" @@ -156,7 +136,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Client 1 VM definition. config.vm.define "pc11", autostart: false do |v1| - v1.vm.box = "bento/ubuntu-16.04" + v1.vm.box = "bento/ubuntu-18.04" v1.vm.hostname = "pc11" v1.vm.network "private_network", mac: "#{MACPREFIX}11".tr(":",""), type: "dhcp", virtualbox__intnet: true v1.vm.provider "virtualbox" do |vb| diff --git a/installer/vagrant/Vagrantfile-prod-vbox b/installer/vagrant/Vagrantfile-prod-vbox index adeccce7..5cfc94d5 100644 --- a/installer/vagrant/Vagrantfile-prod-vbox +++ b/installer/vagrant/Vagrantfile-prod-vbox @@ -45,7 +45,7 @@ elif which wget &>/dev/null; then fi $DOWNLOAD -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 +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 |