summaryrefslogtreecommitdiffstats
path: root/installer/opengnsys_installer.sh
diff options
context:
space:
mode:
Diffstat (limited to 'installer/opengnsys_installer.sh')
-rwxr-xr-xinstaller/opengnsys_installer.sh47
1 files changed, 26 insertions, 21 deletions
diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh
index 3316e4ff..9502d704 100755
--- a/installer/opengnsys_installer.sh
+++ b/installer/opengnsys_installer.sh
@@ -95,17 +95,19 @@ done
echo -e "\\n=============================="
-# Comprobar si se ha descargado el paquete comprimido (USESVN=0) o sólo el instalador (USESVN=1).
+# Comprobar si se ha descargado el paquete comprimido (REMOTE=0) o sólo el instalador (REMOTE=1).
PROGRAMDIR=$(readlink -e "$(dirname "$0")")
PROGRAMNAME=$(basename "$0")
OPENGNSYS_SERVER="opengnsys.es"
DOWNLOADURL="https://$OPENGNSYS_SERVER/trac/downloads"
if [ -d "$PROGRAMDIR/../installer" ]; then
- USESVN=0
+ REMOTE=0
else
- USESVN=1
+ REMOTE=1
fi
-SVN_URL="https://$OPENGNSYS_SERVER/svn/trunk/"
+BRANCH="devel"
+CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH"
+API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH"
WORKDIR=/tmp/opengnsys_installer
mkdir -p $WORKDIR
@@ -788,11 +790,11 @@ EOF
#####################################################################
-####### Funciones para el manejo de Subversion
+####### Funciones para la descarga de código
#####################################################################
-# Obtiene el código fuente del proyecto desde el servidor SVN.
-function svnExportCode()
+# Obtiene el código fuente del proyecto desde el repositorio de GitHub.
+function downloadCode()
{
if [ $# -ne 1 ]; then
errorAndLog "${FUNCNAME}(): invalid number of parameters"
@@ -801,14 +803,15 @@ function svnExportCode()
local url="$1"
- echoAndLog "${FUNCNAME}(): downloading subversion code..."
+ echoAndLog "${FUNCNAME}(): downloading code..."
- svn export --force "$url" opengnsys
+ curl "${url}" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys
if [ $? -ne 0 ]; then
errorAndLog "${FUNCNAME}(): error getting OpenGnsys code from $url"
return 1
fi
- echoAndLog "${FUNCNAME}(): subversion code downloaded"
+ rm -f opengnsys.zip
+ echoAndLog "${FUNCNAME}(): code was downloaded"
return 0
}
@@ -1076,7 +1079,6 @@ function installWebFiles()
errorAndLog "${FUNCNAME}(): Error copying web files."
exit 1
fi
- find $INSTALL_TARGET/www -name .svn -type d -exec rm -fr {} \; 2>/dev/null
# Descomprimir librerías: XAJAX, Slim y Swagger-UI.
unzip -o $WORKDIR/opengnsys/admin/$XAJAXFILE -d $INSTALL_TARGET/www/xajax
@@ -1102,6 +1104,7 @@ function installWebFiles()
# Copiar ficheros en la zona de descargas de OpenGnsys Web Console.
function installDownloadableFiles()
{
+ INSTVERSION=1.1.0 ### Temporal.
local FILENAME=ogagentpkgs-$INSTVERSION.tar.gz
local TARGETFILE=$WORKDIR/$FILENAME
@@ -1205,7 +1208,7 @@ function createDirs()
echoAndLog "${FUNCNAME}(): creating directory paths in $path_opengnsys_base"
mkdir -p $path_opengnsys_base
mkdir -p $path_opengnsys_base/bin
- mkdir -p $path_opengnsys_base/client
+ mkdir -p $path_opengnsys_base/client/{cache,images,log}
mkdir -p $path_opengnsys_base/doc
mkdir -p $path_opengnsys_base/etc
mkdir -p $path_opengnsys_base/lib
@@ -1303,7 +1306,7 @@ function copyServerFiles ()
elif [ -d "${SOURCES[$i]}" ]; then
echoAndLog "Copying content of ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}"
cp -a "${SOURCES[$i]}"/* "${path_opengnsys_base}/${TARGETS[$i]}"
- else
+ else
warningAndLog "Unable to copy ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}"
fi
done
@@ -1396,7 +1399,6 @@ function copyClientFiles()
errorAndLog "${FUNCNAME}(): error while copying client estructure"
errstatus=1
fi
- find $INSTALL_TARGET/client -name .svn -type d -exec rm -fr {} \; 2>/dev/null
echoAndLog "${FUNCNAME}(): Copying OpenGnsys Cloning Engine files."
mkdir -p $INSTALL_TARGET/client/lib/engine/bin
@@ -1551,14 +1553,17 @@ EOT
function installationSummary()
{
+ local VERSIONFILE REVISION
+
# Crear fichero de versión y revisión, si no existe.
- local VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt"
+ VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt"
[ -f $VERSIONFILE ] || echo "OpenGnsys Server" >$VERSIONFILE
# Incluir datos de revisión, si se está instaladno desde el repositorio
# de código o si no está incluida en el fichero de versión.
- if [ $USESVN -eq 1 ] || [ -z "$(awk '$3~/r[0-9]*/ {print}' $VERSIONFILE)" ]; then
- local REVISION=$(LANG=C svn info $SVN_URL|awk '/Rev:/ {print "r"$4}')
- perl -pi -e "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE
+ if [ $REMOTE -eq 1 ] || [ -z "$(awk '$3~/r[0-9]*/ {print}' $VERSIONFILE)" ]; then
+ # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit).
+ REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])')
+ sed -ri "s/($| r[.0-9a-f]+)/ $REVISION/" $VERSIONFILE
fi
# Mostrar información.
@@ -1655,10 +1660,10 @@ if [ $? -ne 0 ]; then
fi
# Si es necesario, descarga el repositorio de código en directorio temporal
-if [ $USESVN -eq 1 ]; then
- svnExportCode $SVN_URL
+if [ $REMOTE -eq 1 ]; then
+ downloadCode $CODE_URL
if [ $? -ne 0 ]; then
- errorAndLog "Error while getting code from svn"
+ errorAndLog "Error while getting code from the repository"
exit 1
fi
else