diff options
Diffstat (limited to 'installer')
-rw-r--r-- | installer/INSTALL.es.txt | 6 | ||||
-rwxr-xr-x | installer/ogGenerateDoc.sh | 8 | ||||
-rwxr-xr-x | installer/ogagent-devel-installer.sh | 10 | ||||
-rwxr-xr-x | installer/opengnsys_export.sh | 4 | ||||
-rwxr-xr-x | installer/opengnsys_import.sh | 11 | ||||
-rwxr-xr-x | installer/opengnsys_installer.sh | 55 | ||||
-rwxr-xr-x | installer/opengnsys_makecompress.sh | 25 | ||||
-rwxr-xr-x | installer/opengnsys_update.sh | 90 | ||||
-rw-r--r-- | installer/vagrant/README.es.txt | 4 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-boottools-vbox | 2 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-browser-vbox | 2 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-devel-vbox | 8 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-ogagent-vbox | 6 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-prod-vbox (renamed from installer/vagrant/Vagrantfile-trunk-vbox) | 6 |
14 files changed, 139 insertions, 98 deletions
diff --git a/installer/INSTALL.es.txt b/installer/INSTALL.es.txt index 33070d26..0fd5ba75 100644 --- a/installer/INSTALL.es.txt +++ b/installer/INSTALL.es.txt @@ -1,5 +1,5 @@ -Instalación y Actualización de OpenGnsys 1.1.0 -============================================== +Instalación y Actualización de OpenGnsys 1.1.1pre +================================================= Instalación inicial @@ -12,7 +12,7 @@ Descargar una versión completa y desccomprimir el fichero "opengnsys-version.ta cd opengnsys/installer O bien, descargar el instalador desde la última reversión del repositorio: - svn export https://opengnsys.es/svn/branches/version1.1/installer/opengnsys_installer.sh + wget https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh Opcionalmente, puede descargarse la imagen del cliente; si no se realiza este paso, el instalador la descargará automáticamente. wget https://opengnsys.es/downloads/ogLive-versioncliente.iso diff --git a/installer/ogGenerateDoc.sh b/installer/ogGenerateDoc.sh index 34a16ced..62839ef2 100755 --- a/installer/ogGenerateDoc.sh +++ b/installer/ogGenerateDoc.sh @@ -20,8 +20,10 @@ fi if [ $# = 2 ] then mkdir -p "$2" -VERSION=$(cat $(dirname "$0")/../doc/VERSION.txt) 2>/dev/null -VERSION=${VERSION:-"1.1"} +PROJECT=$(jq '.project' $(dirname "$0")/../doc/VERSION.json) 2>/dev/null +PROJECT=${PROJECT:-"OpenGnsys"} +VERSION=$(jq '.version+" "+.codename' $(dirname "$0")/../doc/VERSION.json) 2>/dev/null +VERSION=${VERSION:-"1.1.1"} cat > /tmp/doxyfile << EOF # Doxyfile 1.5.6 # Fichero para documentar codigo shellscripts linux. @@ -30,7 +32,7 @@ cat > /tmp/doxyfile << EOF # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "Proyecto OpenGnsys" +PROJECT_NAME = $PROJECT PROJECT_NUMBER = $VERSION OUTPUT_DIRECTORY = $2 PROJECT_LOGO = $(dirname "$0")/../doc/opengnsys-logo.png diff --git a/installer/ogagent-devel-installer.sh b/installer/ogagent-devel-installer.sh index 18574ed2..71f7c7c0 100755 --- a/installer/ogagent-devel-installer.sh +++ b/installer/ogagent-devel-installer.sh @@ -11,8 +11,9 @@ # Variables. -PROGDIR=$PWD/ogagent -SVNURL=https://opengnsys.es/svn/branches/version1.1/admin/Sources/Clients/ogagent +PROGDIR="$PWD/ogagent" +BRANCH="branches/devel" +SVNURL="https://github.com/opengnsys/OpenGnsys/$BRANCH/admin/Sources/Clients/ogagent" # Show prerequisites needed to build the environment. mkdir -p $PROGDIR || exit 1 @@ -22,20 +23,21 @@ OGAgent devoloping environment installation Prerequisites: - Install packages, if needed: + - Subversion - Wine for 32-bit (Winetricks may be required) - Python 2.7 with pyqt4-dev-tools - realpath - dpkg-dev - rpmbuild - xar -- Open a web browser and download Microsoft Visual C++ 2010 Redistributable Package (x86) from: http://www.microsoft.com/en-us/download/details.aspx?id=5555 -- Copy or move "vcredist_x86.exe" file to $PROGDIR directory. Press [Enter] key when ready to continue. EOT read # Importing OGAgent source code. svn export --force $SVNURL $PROGDIR || exit 1 +# Downloading Visual C++ Redistributable. +wget --unlink https://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe # Update PyQt components. pushd ogagent/src >/dev/null diff --git a/installer/opengnsys_export.sh b/installer/opengnsys_export.sh index 8e9c9ccd..747a795a 100755 --- a/installer/opengnsys_export.sh +++ b/installer/opengnsys_export.sh @@ -99,8 +99,8 @@ tar -cvzf $BACKUPFILE --transform="s!^!$BACKUPPREFIX/!" \ -C $TMPDIR IPSERVER.txt \ -C $DHCPDIR dhcpd.conf \ -C $OPENGNSYS/tftpboot menu.lst \ - -C $OPENGNSYS/doc VERSION.txt \ - -C $OPENGNSYS/client/etc engine.cfg \ + -C $OPENGNSYS/doc VERSION.json \ + -C $OPENGNSYS/client/etc engine.cfg engine.json \ -C $OPENGNSYS/www menus \ -C /etc default/opengnsys &>/dev/null diff --git a/installer/opengnsys_import.sh b/installer/opengnsys_import.sh index 6f15ed90..c3b343ee 100755 --- a/installer/opengnsys_import.sh +++ b/installer/opengnsys_import.sh @@ -33,7 +33,8 @@ MYSQLFILE="$TMPDIR/$CATALOG.sql" MYSQLBCK="$OPENGNSYS/doc/$CATALOG.sql-$DATE" LOG_FILE=$OPENGNSYS/log/${PROG%.sh}.log -OPENGNSYS_SERVER="opengnsys.es" +BRANCH="branches/devel" +SVN_URL="https://github.com/opengnsys/OpenGnsys/$BRANCH/admin/Database" DEFAULT_MYSQL_ROOT_PASSWORD="passwordroot" # Clave por defecto root de MySQL # Si se solicita, mostrar ayuda. @@ -219,19 +220,19 @@ if [ $? -ne 0 ]; then fi # Comprobamos si es la misma versión -OLDVERSION=$(awk '{print $2}' $TMPDIR/VERSION.txt) -NEWVERSION=$(awk '{print $2}' $OPENGNSYS/doc/VERSION.txt) +[ -f $TMPDIR/VERSION.txt ] && OLDVERSION=$(awk '{print $2}' $TMPDIR/VERSION.txt) +[ -f $TMPDIR/VERSION.json ] && OLDVERSION=$(jq -r '.version' $TMPDIR/VERSION.json) +NEWVERSION=$(jq -r '.version' $OPENGNSYS/doc/VERSION.json) # FALTA: Comprobar que la versión OLD es menor que la NEW if [ $OLDVERSION != $NEWVERSION ] ; then echo "La versión del servidor no coincide con la del backup." - cat $OPENGNSYS/doc/VERSION.txt $TMPDIR/VERSION.txt + jq -r '[.project, .version, .codename] | join(" ")' $OPENGNSYS/doc/VERSION.json $TMPDIR/VERSION.json read -p "¿Quiere continuar? (y/n): " ANSWER if [ "${ANSWER^^}" != "Y" ]; then echo "Operación cancelada." exit 0 fi # Nos bajamos los archivos de actualización de la base de datos - SVN_URL="https://$OPENGNSYS_SERVER/svn/branches/version${NEWVERSION%.*}/admin/Database" svn checkout "$SVN_URL" $TMPDIR/Database [ $? -ne 0 ] && errorAndLog "$PROG: Error getting code from $SVN_URL" && exit 6 diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 8998a442..e8cd38c2 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -95,17 +95,19 @@ done echo -e "\\n==============================" -# Comprobar si se ha descargado el paquete comprimido (USESVN=0) o sólo el instalador (USESVN=1). +# Comprobar si se ha descargado el paquete comprimido (REMOTE=0) o sólo el instalador (REMOTE=1). PROGRAMDIR=$(readlink -e "$(dirname "$0")") PROGRAMNAME=$(basename "$0") OPENGNSYS_SERVER="opengnsys.es" DOWNLOADURL="https://$OPENGNSYS_SERVER/trac/downloads" if [ -d "$PROGRAMDIR/../installer" ]; then - USESVN=0 + REMOTE=0 else - USESVN=1 + REMOTE=1 fi -SVN_URL="https://$OPENGNSYS_SERVER/svn/branches/version1.1/" +BRANCH="devel" +CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" +API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" WORKDIR=/tmp/opengnsys_installer mkdir -p $WORKDIR @@ -788,11 +790,11 @@ EOF ##################################################################### -####### Funciones para el manejo de Subversion +####### Funciones para la descarga de código ##################################################################### -# Obtiene el código fuente del proyecto desde el servidor SVN. -function svnExportCode() +# Obtiene el código fuente del proyecto desde el repositorio de GitHub. +function downloadCode() { if [ $# -ne 1 ]; then errorAndLog "${FUNCNAME}(): invalid number of parameters" @@ -801,14 +803,15 @@ function svnExportCode() local url="$1" - echoAndLog "${FUNCNAME}(): downloading subversion code..." + echoAndLog "${FUNCNAME}(): downloading code..." - svn export --force "$url" opengnsys + curl "${url}" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error getting OpenGnsys code from $url" return 1 fi - echoAndLog "${FUNCNAME}(): subversion code downloaded" + rm -f opengnsys.zip + echoAndLog "${FUNCNAME}(): code was downloaded" return 0 } @@ -1075,7 +1078,6 @@ function installWebFiles() errorAndLog "${FUNCNAME}(): Error copying web files." exit 1 fi - find $INSTALL_TARGET/www -name .svn -type d -exec rm -fr {} \; 2>/dev/null # Descomprimir librerías: Slim y Swagger-UI. unzip -o $WORKDIR/opengnsys/admin/$SLIMFILE -d $INSTALL_TARGET/www/rest @@ -1204,7 +1206,7 @@ function createDirs() echoAndLog "${FUNCNAME}(): creating directory paths in $path_opengnsys_base" mkdir -p $path_opengnsys_base mkdir -p $path_opengnsys_base/bin - mkdir -p $path_opengnsys_base/client + mkdir -p $path_opengnsys_base/client/{cache,images,log} mkdir -p $path_opengnsys_base/doc mkdir -p $path_opengnsys_base/etc mkdir -p $path_opengnsys_base/lib @@ -1399,7 +1401,6 @@ function copyClientFiles() errorAndLog "${FUNCNAME}(): error while copying client estructure" errstatus=1 fi - find $INSTALL_TARGET/client -name .svn -type d -exec rm -fr {} \; 2>/dev/null echoAndLog "${FUNCNAME}(): Copying OpenGnsys Cloning Engine files." mkdir -p $INSTALL_TARGET/client/lib/engine/bin @@ -1554,21 +1555,25 @@ EOT function installationSummary() { + local VERSIONFILE REVISION + # Crear fichero de versión y revisión, si no existe. - local VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" - [ -f $VERSIONFILE ] || echo "OpenGnsys Server" >$VERSIONFILE - # Incluir datos de revisión, si se está instaladno desde el repositorio + VERSIONFILE="$INSTALL_TARGET/doc/VERSION.json" + [ -f $VERSIONFILE ] || echo '{ "project": "OpenGnsys" }' >$VERSIONFILE + # Incluir datos de revisión, si se está instalando desde el repositorio # de código o si no está incluida en el fichero de versión. - if [ $USESVN -eq 1 ] || [ -z "$(awk '$3~/r[0-9]*/ {print}' $VERSIONFILE)" ]; then - local REVISION=$(LANG=C svn info $SVN_URL|awk '/Rev:/ {print "r"$4}') - sed -ri "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE + if [ $REMOTE -eq 1 ] || [ -z "$(jq -r '.release' $VERSIONFILE)" ]; then + # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit). + REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') + jq ".release=$REVISION" $VERSIONFILE | sponge $VERSIONFILE fi + VERSION="$(jq -r '[.project, .version, .codename, .release] | join(" ")' $VERSIONFILE 2>/dev/null)" # Mostrar información. echo echoAndLog "OpenGnsys Installation Summary" echo "==============================" - echoAndLog "Project version: $(cat $VERSIONFILE 2>/dev/null)" + echoAndLog "Project version: $VERSION" echoAndLog "Installation directory: $INSTALL_TARGET" echoAndLog "Installation log file: $LOG_FILE" echoAndLog "Repository directory: $INSTALL_TARGET/images" @@ -1658,10 +1663,10 @@ if [ $? -ne 0 ]; then fi # Si es necesario, descarga el repositorio de código en directorio temporal -if [ $USESVN -eq 1 ]; then - svnExportCode $SVN_URL +if [ $REMOTE -eq 1 ]; then + downloadCode $CODE_URL if [ $? -ne 0 ]; then - errorAndLog "Error while getting code from svn" + errorAndLog "Error while getting code from the repository" exit 1 fi else @@ -1708,7 +1713,7 @@ if [ $? -ne 0 ]; then errorAndLog "Error while copying the server files!" exit 1 fi -INSTVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt) +INSTVERSION=$(jq -r '.version' $INSTALL_TARGET/doc/VERSION.json) # Instalar base de datos de OpenGnsys Admin. isInArray notinstalled "mysql-server" || isInArray notinstalled "mariadb-server" @@ -1768,7 +1773,7 @@ if [ $? -eq 0 ]; then fi else # Si existe fichero ogBDAdmin-VersLocal-VersRepo.sql; aplicar cambios. - REPOVERSION=$(awk '{print $2}' $WORKDIR/opengnsys/doc/VERSION.txt) + REPOVERSION=$(jq -r '.version' $WORKDIR/opengnsys/doc/VERSION.json) OPENGNSYS_DB_UPDATE_FILE="opengnsys/admin/Database/$OPENGNSYS_DATABASE-$INSTVERSION-$REPOVERSION.sql" if [ -f $WORKDIR/$OPENGNSYS_DB_UPDATE_FILE ]; then echoAndLog "Updating tables from version $INSTVERSION to $REPOVERSION" diff --git a/installer/opengnsys_makecompress.sh b/installer/opengnsys_makecompress.sh index ab05b5ce..ff267b1e 100755 --- a/installer/opengnsys_makecompress.sh +++ b/installer/opengnsys_makecompress.sh @@ -7,28 +7,41 @@ # Versión: 1.0 - Incluido en OpenGnSys 1.0.1 # Autor: Ramón Gómez, Universidad de Sevilla # Fecha: 10/05/2011 +# Versión: 1.1.1 - Descarga desde repositorio de GitHub +# Autor: Ramón Gómez, Universidad de Sevilla +# Fecha: 27/05/2018 + +# Comprobaciones. +for PROG in jq unzip; do + if ! which $PROG &>/dev/null; then + echo "Please, install \"$PROG\" package." + exit 1 + fi +done # Variables -SVNURL="https://opengnsys.es/svn/branches/version1.1/" -SVNREV=$(LANG=C svn info $SVNURL | awk '/Last Changed Rev:/ {print "r"$4}') +BRANCH="devel" +CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" +API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" +REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') # Descargar repositorio SVN cd /tmp rm -fr opengnsys -svn export $SVNURL opengnsys || exit 1 +curl "$CODE_URL" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys # Asisgnar propietario de los ficheros descargados. chown -R root.root opengnsys WARNING=$? # Parchear datos de revisión del código. -perl -pi -e "s/$/ $SVNREV/" opengnsys/doc/VERSION.txt +jq ".release=$REVISION" opengnsys/doc/VERSION.json | sponge opengnsys/doc/VERSION.json # Generar fichero comprimido. -VERSION=$(awk '{print $2"-"$3}' opengnsys/doc/VERSION.txt) +VERSION=$(jq -r '.version+"-"+.release' opengnsys/doc/VERSION.json) tar cvzf opengnsys-$VERSION.tar.gz opengnsys -rm -fr opengnsys +rm -fr opengnsys opengnsys.zip # Revisar salida. [ $WARNING != 0 ] && echo "*** WARNING: cannot change owner of files to \"root\" user before compressing." diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index 99eac4a9..0a6631f7 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -64,16 +64,19 @@ if [ -z "$OPENGNSYS_DATABASE" -o -z "$OPENGNSYS_DBUSER" -o -z "$OPENGNSYS_DBPASS exit 1 fi -# Comprobar si se ha descargado el paquete comprimido (USESVN=0) o sólo el instalador (USESVN=1). +# Comprobar si se ha descargado el paquete comprimido (REMOTE=0) o sólo el instalador (REMOTE=1). PROGRAMDIR=$(readlink -e $(dirname "$0")) PROGRAMNAME=$(basename "$0") OPENGNSYS_SERVER="opengnsys.es" if [ -d "$PROGRAMDIR/../installer" ]; then - USESVN=0 + REMOTE=0 else - USESVN=1 + REMOTE=1 fi -SVN_URL="https://$OPENGNSYS_SERVER/svn/branches/version1.1/" +BRANCH="devel" +CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" +API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" +RAW_URL="https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH" WORKDIR=/tmp/opengnsys_update mkdir -p $WORKDIR @@ -113,7 +116,7 @@ function autoConfigure() # Configuración según la distribución de Linux. if [ -f /etc/debian_version ]; then - # Distribución basada en paquetes Deb. + # Distribución basada en paquetes Deb. DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast python-pip ) UPDATEPKGLIST="add-apt-repository -y ppa:ondrej/php; apt-get update" INSTALLPKGS="apt-get -y install" @@ -133,7 +136,7 @@ function autoConfigure() APACHEGROUP="www-data" INETDCFGDIR=/etc/xinetd.d elif [ -f /etc/redhat-release ]; then - # Distribución basada en paquetes rpm. + # Distribución basada en paquetes rpm. DEPENDENCIES=( curl rsync btrfs-progs procps-ng arp-scan gettext moreutils jq net-tools python-pip ) # En CentOS 7 instalar arp-scan de CentOS 6. [ "$OSDISTRIB$OSVERSION" == "centos7" ] && DEPENDENCIES=( ${DEPENDENCIES[*]/arp-scan/http://dag.wieers.com/redhat/el6/en/$(arch)/dag/RPMS/arp-scan-1.9-1.el6.rf.$(arch).rpm} ) @@ -174,8 +177,9 @@ function checkAutoUpdate() local update=0 # Actaulizar el script si ha cambiado o no existe el original. - if [ $USESVN -eq 1 ]; then - svn export $SVN_URL/installer/$PROGRAMNAME + if [ $REMOTE -eq 1 ]; then + curl -s $RAW_URL/installer/$PROGRAMNAME -o $PROGRAMNAME + chmod +x $PROGRAMNAME if ! diff -q $PROGRAMNAME $INSTALL_TARGET/lib/$PROGRAMNAME 2>/dev/null || ! test -f $INSTALL_TARGET/lib/$PROGRAMNAME; then mv $PROGRAMNAME $INSTALL_TARGET/lib update=1 @@ -201,7 +205,7 @@ function getDateTime() # Escribe a fichero y muestra por pantalla function echoAndLog() { - echo $1 + echo "$1" DATETIME=`getDateTime` echo "$DATETIME;$SSH_CLIENT;$1" >> $LOG_FILE } @@ -396,10 +400,10 @@ function installDependencies() ##################################################################### -####### Funciones para el manejo de Subversion +####### Funciones para descargar código ##################################################################### -function svnExportCode() +function downloadCode() { if [ $# -ne 1 ]; then errorAndLog "${FUNCNAME}(): invalid number of parameters" @@ -408,14 +412,15 @@ function svnExportCode() local url="$1" - echoAndLog "${FUNCNAME}(): downloading subversion code..." + echoAndLog "${FUNCNAME}(): downloading code..." - svn checkout "${url}" opengnsys + curl "${url}" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error getting code from ${url}, verify your user and password" return 1 fi - echoAndLog "${FUNCNAME}(): subversion code downloaded" + rm -f opengnsys.zip + echoAndLog "${FUNCNAME}(): code was downloaded" return 0 } @@ -428,7 +433,14 @@ function svnExportCode() function checkNetworkConnection() { OPENGNSYS_SERVER=${OPENGNSYS_SERVER:-"opengnsys.es"} - wget --spider -q $OPENGNSYS_SERVER + if which curl &>/dev/null; then + curl --connect-timeout 10 -s $OPENGNSYS_SERVER -o /dev/null + elif which wget &>/dev/null; then + wget --spider -q $OPENGNSYS_SERVER + else + echoAndLog "${FUNCNAME}(): Cannot execute \"wget\" nor \"curl\"." + return 1 + fi } # Comprobar si la versión es anterior a la actual. @@ -437,11 +449,12 @@ function checkVersion() local PRE # Obtener versión actual y versión a actualizar. - OLDVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt 2>/dev/null) - if [ $USESVN -eq 1 ]; then - NEWVERSION=$(curl -s $SVN_URL/doc/VERSION.txt 2>/dev/null | awk '{print $2}') + [ -f $INSTALL_TARGET/doc/VERSION.txt ] && OLDVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt 2>/dev/null) + [ -f $INSTALL_TARGET/doc/VERSION.json ] && OLDVERSION=$(jq -r '.version' $INSTALL_TARGET/doc/VERSION.json 2>/dev/null) + if [ $REMOTE -eq 1 ]; then + NEWVERSION=$(curl -s $RAW_URL/doc/VERSION.json 2>/dev/null | jq -r '.version') else - NEWVERSION=$(awk '{print $2}' $PROGRAMDIR/doc/VERSION.txt 2>/dev/null) + NEWVERSION=$(jq -r '.version' $PROGRAMDIR/doc/VERSION.json 2>/dev/null) fi [[ "$NEWVERSION" =~ pre ]] && PRE=1 @@ -482,16 +495,15 @@ function updateClientFiles() # Actualizar ficheros del cliente. backupFile $ENGINECFG echoAndLog "${FUNCNAME}(): Updating OpenGnsys Client files" - rsync --exclude .svn -irplt $WORKDIR/opengnsys/client/shared/* $INSTALL_TARGET/client + rsync -irplt $WORKDIR/opengnsys/client/shared/* $INSTALL_TARGET/client if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error while updating client structure" exit 1 fi - find $INSTALL_TARGET/client -name .svn -type d -exec rm -fr {} \; 2>/dev/null # Actualizar librerías del motor de clonación. echoAndLog "${FUNCNAME}(): Updating OpenGnsys Cloning Engine files" - rsync --exclude .svn -irplt $WORKDIR/opengnsys/client/engine/*.lib* $INSTALL_TARGET/client/lib/engine/bin + rsync -irplt $WORKDIR/opengnsys/client/engine/*.lib* $INSTALL_TARGET/client/lib/engine/bin if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error while updating engine files" exit 1 @@ -606,7 +618,7 @@ function updateWebFiles() # Copiar los ficheros nuevos conservando el archivo de configuración de acceso. backupFile $INSTALL_TARGET/www/controlacceso.php mv $INSTALL_TARGET/www $INSTALL_TARGET/WebConsole - rsync --exclude .svn -irplt $WORKDIR/opengnsys/admin/WebConsole $INSTALL_TARGET + rsync -irplt $WORKDIR/opengnsys/admin/WebConsole $INSTALL_TARGET ERRCODE=$? mv $INSTALL_TARGET/WebConsole $INSTALL_TARGET/www rm -fr $INSTALL_TARGET/www/xajax @@ -651,7 +663,7 @@ function updateDownloadableFiles() mv $PROGRAMDIR/$FILENAME $TARGETFILE else echoAndLog "${FUNCNAME}(): Downloading $FILENAME" - wget $DOWNLOADURL/$FILENAME -O $TARGETFILE + curl $DOWNLOADURL/$FILENAME -o $TARGETFILE fi if [ ! -s $TARGETFILE ]; then errorAndLog "${FUNCNAME}(): Cannot download $FILENAME" @@ -662,7 +674,7 @@ function updateDownloadableFiles() tar xvzf $TARGETFILE -C $INSTALL_TARGET/www/descargas if [ $? != 0 ]; then errorAndLog "${FUNCNAME}(): Error uncompressing archive $FILENAME" - exit 1 + return 1 fi } @@ -674,7 +686,7 @@ function updateInterfaceAdm() # Crear carpeta y copiar Interface echoAndLog "${FUNCNAME}(): Copying Administration Interface Folder" mv $INSTALL_TARGET/client/interfaceAdm $INSTALL_TARGET/client/Interface - rsync --exclude .svn -irplt $WORKDIR/opengnsys/admin/Interface $INSTALL_TARGET/client + rsync -irplt $WORKDIR/opengnsys/admin/Interface $INSTALL_TARGET/client errcoce=$? mv $INSTALL_TARGET/client/Interface $INSTALL_TARGET/client/interfaceAdm if [ $errcode -ne 0 ]; then @@ -831,7 +843,7 @@ function updateServerFiles() local i for (( i = 0; i < ${#SOURCES[@]}; i++ )); do if [ -d "$INSTALL_TARGET/${TARGETS[i]}" ]; then - rsync --exclude .svn -irplt "${SOURCES[i]}" $(dirname $(readlink -e "$INSTALL_TARGET/${TARGETS[i]}")) + rsync -irplt "${SOURCES[i]}" $(dirname $(readlink -e "$INSTALL_TARGET/${TARGETS[i]}")) else rsync -irplt "${SOURCES[i]}" $(readlink -m "$INSTALL_TARGET/${TARGETS[i]}") fi @@ -964,7 +976,7 @@ function updateClient() oglivecli convert fi # Comprobar si debe actualizarse el cliente. - SOURCELENGTH=$(LANG=C wget --spider $SOURCEFILE 2>&1 | awk '/Length:/ {print $2}') + SOURCELENGTH=$(curl -sI $SOURCEFILE 2>&1 | awk '/Content-Length:/ {print $2}') TARGETLENGTH=$(stat -c "%s" $TARGETFILE 2>/dev/null) [ -z $TARGETLENGTH ] && TARGETLENGTH=0 if [ "$SOURCELENGTH" != "$TARGETLENGTH" ]; then @@ -1019,16 +1031,20 @@ function checkFiles() function updateSummary() { # Actualizar fichero de versión y revisión. - local VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" - local REVISION=$(LANG=C svn info $SVN_URL|awk '/Rev:/ {print "r"$4}') - - [ -f $VERSIONFILE ] || echo "OpenGnsys" >$VERSIONFILE - perl -pi -e "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE + local VERSIONFILE REVISION + VERSIONFILE="$INSTALL_TARGET/doc/VERSION.json" + # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit). + REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') + [ -f $VERSIONFILE ] || echo '{ "project": "OpenGnsys" }' > $VERSIONFILE + jq ".release=$REVISION" $VERSIONFILE | sponge $VERSIONFILE + VERSION="$(jq -r '[.project, .version, .codename, .release] | join(" ")' $VERSIONFILE 2>/dev/null)" + # Borrar antiguo fichero de versión. + rm -f "${VERSIONFILE/json/txt}" echo echoAndLog "OpenGnsys Update Summary" echo "========================" - echoAndLog "Project version: $(cat $VERSIONFILE)" + echoAndLog "Project version: $VERSION" echoAndLog "Update log file: $LOG_FILE" if [ -n "$NEWFILES" ]; then echoAndLog "Check new config files: $(echo $NEWFILES)" @@ -1114,10 +1130,10 @@ if [ $? -ne 0 ]; then fi # Si es necesario, descarga el repositorio de código en directorio temporal -if [ $USESVN -eq 1 ]; then - svnExportCode $SVN_URL +if [ $REMOTE -eq 1 ]; then + downloadCode $CODE_URL if [ $? -ne 0 ]; then - errorAndLog "Error while getting code from svn server" + errorAndLog "Error while getting code from repository" exit 1 fi else diff --git a/installer/vagrant/README.es.txt b/installer/vagrant/README.es.txt index ce40f709..6f300afe 100644 --- a/installer/vagrant/README.es.txt +++ b/installer/vagrant/README.es.txt @@ -5,7 +5,7 @@ Preparar entorno virtual de desarrollo para OpenGnsys Ficheros de configuración disponibles: - - Vagrantfile-trunk-vbox Vagrantfile para OpenGnsys estable con proveedor VirtualBox. + - Vagrantfile-prod-vbox Vagrantfile para OpenGnsys estable con proveedor VirtualBox. - Vagrantfile-devel-vbox Vagrantfile para OpenGnsys en desarrollo con proveedor VirtualBox. - Vagrantfile-boottools-vbox Vagrantfile para preparar el entorno de generación del cliente ogLive (recomendado solo para desarrolladores experimentados). - Vagrantfile-browser-vbox Vagrantfile para preparar el entorno de desarrollo del Browser del cliente (recomendado solo para miembros del grupo de desarrollo). @@ -25,7 +25,7 @@ El entorno de trabajo de OpenGnsys. - pc12 - ogclientN: MV clientes para restaurar con disco vacío. -Ejecutar el entorno virtual (Vagrantfile-trunk-vbox y Vagrantfile-devel-vbox). +Ejecutar el entorno virtual (Vagrantfile-prod-vbox y Vagrantfile-devel-vbox). - Crear un directorio de trabajo. - Copiar el fichero Vagrantfile-...-vbox correspondiente en dicho directorio como Vagrantfile. diff --git a/installer/vagrant/Vagrantfile-boottools-vbox b/installer/vagrant/Vagrantfile-boottools-vbox index 1a7c9e5a..83348f02 100644 --- a/installer/vagrant/Vagrantfile-boottools-vbox +++ b/installer/vagrant/Vagrantfile-boottools-vbox @@ -24,7 +24,7 @@ apt-get install -y subversion groupadd opengnsys mkdir -p /opt/opengnsys/client /tmp/opengnsys_installer/opengnsys ln -fs /var/lib/tftpboot /opt/opengnsys -svn export https://opengnsys.es/svn/branches/version1.1/client /tmp/opengnsys_installer/opengnsys/client +svn export https://github.com/opengnsys/OpenGnsys/branches/devel/client /tmp/opengnsys_installer/opengnsys/client echo "Connect to this VM, launch boot-tools generation script and follow instructions:" echo " sudo /tmp/opengnsys_installer/opengnsys/client/boot-tools/boottoolsgenerator.sh" echo "Warning: this process may take a long time." diff --git a/installer/vagrant/Vagrantfile-browser-vbox b/installer/vagrant/Vagrantfile-browser-vbox index 9cf3661c..bc8d55d4 100644 --- a/installer/vagrant/Vagrantfile-browser-vbox +++ b/installer/vagrant/Vagrantfile-browser-vbox @@ -29,7 +29,7 @@ echo "yes" | ./configure -opensource -embedded x86 -webkit -openssl -qt-gfx-vnc make make install # Compile Browser. -svn export https://opengnsys.es/svn/branches/version1.1/client/browser ../browser +svn export https://github.com/opengnsys/OpenGnsys/branches/devel/client/browser ../browser cd browser qmake browser.pro make diff --git a/installer/vagrant/Vagrantfile-devel-vbox b/installer/vagrant/Vagrantfile-devel-vbox index c8eb022f..00d7dab6 100644 --- a/installer/vagrant/Vagrantfile-devel-vbox +++ b/installer/vagrant/Vagrantfile-devel-vbox @@ -1,4 +1,4 @@ -# Vagrantfile to install OpenGnsys 1.1 virtual environment using VirtualBox provider. +# Vagrantfile to install OpenGnsys virtual environment (development version) using VirtualBox provider. VAGRANTFILE_API_VERSION = "2" # VM provider: Oracle VM VirtualBox. @@ -25,7 +25,7 @@ LOCALWEBPORT = 8443 # OpenGnsys Server provisioning script: prepare repo disk, install OpenGnsys, change default interface, configure DHCP server. OGSERVERSCRIPT = <<EOT # Exit if OpenGnsys is installed. -[ -f /opt/opengnsys/doc/VERSION.txt ] && echo "Cannot provision, OpenGnsys is already installed." && exit 1 +[ -f /opt/opengnsys/doc/VERSION.json ] && echo "Cannot provision, OpenGnsys is already installed." && exit 1 # Create repository disk using LVM, if necesary. if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then pvcreate /dev/sdb @@ -38,7 +38,7 @@ if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then mount -a fi # Install OpenGnsys and change server address. -wget -q https://opengnsys.es/svn/branches/version1.1/installer/opengnsys_installer.sh -O - | bash || exit $? +curl -s https://raw.githubusercontent.com/opengnsys/OpenGnsys/devel/installer/opengnsys_installer.sh | bash || exit $? mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log echo y | /opt/opengnsys/bin/setserveraddr enp0s8 # Insert DHCP data. @@ -94,7 +94,7 @@ OGAGENTPKG = "ogagent_1.1.0_all.deb" MODELSCRIPT = <<EOT # Comment out next lines to install and configure OGAgent for Ubuntu. #apt-get update -y -#wget -q --no-check-certificate https://#{SERVERIP}/opengnsys/descargas/#{OGAGENTPKG} +#curl -ks https://#{SERVERIP}/opengnsys/descargas/#{OGAGENTPKG} -o #{OGAGENTPKG} #if [ -f #{OGAGENTPKG} ]; then # dpkg -i #{OGAGENTPKG} # apt-get install -fy || exit $? diff --git a/installer/vagrant/Vagrantfile-ogagent-vbox b/installer/vagrant/Vagrantfile-ogagent-vbox index 22ddfe54..1bf48faa 100644 --- a/installer/vagrant/Vagrantfile-ogagent-vbox +++ b/installer/vagrant/Vagrantfile-ogagent-vbox @@ -33,7 +33,9 @@ wget -q https://atom.io/download/rpm -O /tmp/atom.rpm && dnf install -y /tmp/ato # Comment out next line if you prefer to install Eclipse IDE for Python (it needs more disk space). #dnf install -y eclipse-pydev eclipse-nls-${LANG%_*} # Download OGAgent environment installer. -svn export https://opengnsys.es/svn/branches/version1.1/installer/ogagent-devel-installer.sh /home/vagrant +BRANCH="devel" +wget -qc --unlink https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH/installer/ogagent-devel-installer.sh -O /home/vagrant/ogagent-devel-installer.sh +chmod +x /home/vagrant/ogagent-devel-installer.sh # Instructions. echo "Manual operations:" echo "- Reboot VM or launch desktop: startxfce4 &" @@ -60,7 +62,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vb.gui = true end # VM base and host name. - ag.vm.box = "fedora/25-cloud-base" + ag.vm.box = "fedora/27-cloud-base" ag.vm.hostname = "ogAgent" # Comment to disable synced folder. ag.vm.synced_folder ".", "/vagrant" diff --git a/installer/vagrant/Vagrantfile-trunk-vbox b/installer/vagrant/Vagrantfile-prod-vbox index 75dbcd11..813ee962 100644 --- a/installer/vagrant/Vagrantfile-trunk-vbox +++ b/installer/vagrant/Vagrantfile-prod-vbox @@ -1,4 +1,4 @@ -# Vagrantfile to install OpenGnsys Trunk (v1.1.0) virtual environment using VirtualBox provider. +# Vagrantfile to install OpenGnsys virtual environment (production version) using VirtualBox provider. VAGRANTFILE_API_VERSION = "2" # VM provider: Oracle VM VirtualBox. @@ -38,7 +38,7 @@ if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then mount -a fi # Install OpenGnsys and change server address. -wget -q https://opengnsys.es/svn/trunk/installer/opengnsys_installer.sh -O - | bash || exit $? +curl -s https://raw.githubusercontent.com/opengnsys/OpenGnsys/master/installer/opengnsys_installer.sh | bash || exit $? mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log echo y | /opt/opengnsys/bin/setserveraddr enp0s8 # Insert DHCP data. @@ -73,7 +73,7 @@ OGAGENTPKG = "ogagent_1.1.0_all.deb" MODELSCRIPT = <<EOT # Comment out next lines to install and configure OGAgent for Ubuntu. #apt-get update -y -#wget -q --no-check-certificate https://#{SERVERIP}/opengnsys/descargas/#{OGAGENTPKG} +#curl -ks https://#{SERVERIP}/opengnsys/descargas/#{OGAGENTPKG} -o #{OGAGENTPKG} #if [ -f #{OGAGENTPKG} ]; then # dpkg -i #{OGAGENTPKG} # apt-get install -fy || exit $? |