From c070d3d734648dae98f719e1f27962b489b23e7a Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Wed, 17 Jun 2020 13:43:32 +0200 Subject: #985 Install and update scripts now use ogServer repo OpenGnsys is separating the different parts of the project in different git repositories. Now ogServer, formerly ogAdmServer, has is own repo, so is necessary to adapt install and update script to use this new repo. --- installer/opengnsys_installer.sh | 32 ++++++++++++++++++++++---------- installer/opengnsys_update.sh | 28 ++++++++++++++++++++-------- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 684ecc6c..b95e6ad7 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1326,21 +1326,33 @@ function copyServerFiles () #################################################################### # Compilar los servicios de OpenGnsys -function servicesCompilation () +function ogServerCompilation () { - local hayErrores=0 + local ogserverUrl="https://codeload.github.com/opengnsys/ogServer/zip/$BRANCH" + local error=0 + + echoAndLog "${FUNCNAME}(): downloading ogServer code..." - # Compilar OpenGnsys Server - echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Admin Server" - pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer + if ! (curl "${ogserverUrl}" -o ogserver.zip && \ + unzip -qo "ogserver.zip") + then + errorAndLog "${FUNCNAME}(): "\ + "error getting ogServer code from ${ogserverUrl}" + return 1 + fi + rm -f ogserver.zip + echoAndLog "${FUNCNAME}(): ogServer code was downloaded" + + echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Server" + pushd "$WORKDIR/ogServer-$BRANCH" autoreconf -fi && ./configure && make && mv ogAdmServer $INSTALL_TARGET/sbin if [ $? -ne 0 ]; then - echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Server" - hayErrores=1 + echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Server" + error=1 fi popd - return $hayErrores + return $error } #################################################################### @@ -1494,7 +1506,7 @@ function openGnsysConfigure() -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \ -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" \ -e "s/DATABASE/$OPENGNSYS_DATABASE/g" \ - $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer/ogAdmServer.cfg > $INSTALL_TARGET/etc/ogAdmServer-$dev.cfg + "$WORKDIR"/ogServer-"$BRANCH"/ogAdmServer.cfg > "$INSTALL_TARGET"/etc/ogAdmServer-"$dev".cfg sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ $WORKDIR/opengnsys/repoman/etc/ogAdmRepo.cfg.tmpl > $INSTALL_TARGET/etc/ogAdmRepo-$dev.cfg CONSOLEURL="https://${SERVERIP[i]}/opengnsys" @@ -1698,7 +1710,7 @@ else fi # Compilar código fuente de los servicios de OpenGnsys. -servicesCompilation +ogServerCompilation if [ $? -ne 0 ]; then errorAndLog "Error while compiling OpenGnsys services" exit 1 diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index b562c9cf..29cdb910 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -1056,17 +1056,29 @@ function moveNewService() # Recompilar y actualiza los serivicios y clientes. -function compileServices() +function ogServerCompilation() { - local hayErrores=0 + local ogserverUrl="https://codeload.github.com/opengnsys/ogServer/zip/$BRANCH" + local error=0 + + echoAndLog "${FUNCNAME}(): downloading ogServer code..." + + if ! (curl "${ogserverUrl}" -o ogserver.zip && \ + unzip -qo "ogserver.zip") + then + errorAndLog "${FUNCNAME}(): "\ + "error getting ogServer code from ${ogserverUrl}" + return 1 + fi + rm -f ogserver.zip + echoAndLog "${FUNCNAME}(): ogServer code was downloaded" - # Compilar OpenGnsys Server echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Admin Server" - pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer + pushd "$WORKDIR/ogServer-$BRANCH" autoreconf -fi && ./configure && make && moveNewService ogAdmServer $INSTALL_TARGET/sbin if [ $? -ne 0 ]; then - echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Server" - hayErrores=1 + echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Server" + error=1 fi popd # Parar antiguo servicio de repositorio. @@ -1080,7 +1092,7 @@ function compileServices() grep -q "APITOKEN=" $INSTALL_TARGET/etc/ogAdmServer.cfg || \ $INSTALL_TARGET/bin/settoken -f - return $hayErrores + return $error } @@ -1339,7 +1351,7 @@ updateDownloadableFiles makeDoxygenFiles # Recompilar y actualizar los servicios del sistema -if compileServices; then +if ogServerCompilation; then # Restart services, if necessary. if [ "$NEWSERVICES" ]; then echoAndLog "Restarting OpenGnsys services" -- cgit v1.2.3-18-g5258