From 51ce65ce86230d5a9320b83cd3be20da2dbb09ef Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Fri, 20 Mar 2020 14:28:07 +0100 Subject: #980 Add ogClient to the installer and update the setserveraddr script This also removes the legacy ogAdmClient for these scripts. --- installer/opengnsys_installer.sh | 34 +++++++++++++++++++++------------- server/bin/setserveraddr | 8 ++++++-- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 88f4b0d1..9954c53d 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1342,15 +1342,6 @@ function servicesCompilation () echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Agent" hayErrores=1 fi - popd - # Compilar OpenGnsys Client - echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Admin Client" - pushd $WORKDIR/opengnsys/admin/Sources/Clients/ogAdmClient - make && mv ogAdmClient ../../../../client/shared/bin - if [ $? -ne 0 ]; then - echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Client" - hayErrores=1 - fi popd return $hayErrores @@ -1406,6 +1397,21 @@ function copyClientFiles() errorAndLog "${FUNCNAME}(): client copy files with errors" fi + local ogclientUrl="https://codeload.github.com/alvneiayu/ogClient/zip/$BRANCH" + + echoAndLog "${FUNCNAME}(): downloading ogClient code..." + + if ! (curl "${ogclientUrl}" -o ogclient.zip && \ + unzip -qo ogclient.zip && \ + mv "ogClient-$BRANCH" $INSTALL_TARGET/client/ogClient) + then + errorAndLog "${FUNCNAME}(): "\ + "error getting ogClient code from ${ogclientUrl}" + return 1 + fi + rm -f ogclient.zip + echoAndLog "${FUNCNAME}(): ogClient code was downloaded" + return $errstatus } @@ -1505,11 +1511,9 @@ function openGnsysConfigure() -e "s/DATABASE/$OPENGNSYS_DATABASE/g" \ -e "s/OPENGNSYSURL/${CONSOLEURL//\//\\/}/g" \ $INSTALL_TARGET/www/controlacceso.php > $INSTALL_TARGET/www/controlacceso-$dev.php - sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ - -e "s/OPENGNSYSURL/${CONSOLEURL//\//\\/}/g" \ - $WORKDIR/opengnsys/admin/Sources/Clients/ogAdmClient/ogAdmClient.cfg > $INSTALL_TARGET/client/etc/ogAdmClient-$dev.cfg if [ "$dev" == "$DEFAULTDEV" ]; then OPENGNSYS_CONSOLEURL="$CONSOLEURL" + OPENGNSYS_SERVERIP="${SERVERIP[i]}" fi fi let i++ @@ -1517,7 +1521,6 @@ function openGnsysConfigure() ln -f $INSTALL_TARGET/etc/ogAdmServer-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmServer.cfg ln -f $INSTALL_TARGET/etc/ogAdmRepo-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmRepo.cfg 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 # Configuración del motor de clonación. @@ -1551,6 +1554,11 @@ EOT echoAndLog "${FUNCNAME}(): Starting OpenGnsys services." $STARTSERVICE fi + + echoAndLog "${FUNCNAME}(): Creating ogClient config files." + sed -i -e "s/127\.0\.0\.1/$OPENGNSYS_SERVERIP/g" \ + -e "s/1234/8889/g" \ + $INSTALL_TARGET/client/ogClient/cfg/ogclient.cfg } diff --git a/server/bin/setserveraddr b/server/bin/setserveraddr index 18ee8c6a..c3898724 100755 --- a/server/bin/setserveraddr +++ b/server/bin/setserveraddr @@ -33,7 +33,7 @@ source $OPENGNSYS/lib/ogfunctions.sh || exit 1 [ "$USER" != "root" ] && raiseError access "Need to be root" [ $# -ne 1 ] && raiseError usage [ -r $DEFAULTFILE ] || raiseError access "Cannot read default configuration file" -for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo,ogAdmAgent}.cfg,www/controlacceso.php,client/etc/ogAdmClient.cfg}; do +for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo,ogAdmAgent}.cfg,www/controlacceso.php,client/ogClient/cfg/ogclient.cfg}; do [ -w $f ] || raiseError access "Cannot write to file: $f" done @@ -88,7 +88,7 @@ if [ -n "$SERVERIP" ]; then OLDSERVERIP=$ServidorAdm # Checking if configuration files need to be modified. CHANGE=0 - for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo,ogAdmAgent}.cfg,www/controlacceso.php,client/etc/ogAdmClient.cfg}; do + for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo,ogAdmAgent}.cfg,www/controlacceso.php}; do # Updating configuration variables (if URL does not contain "localhost"). sed -e "s,\(ServidorAdm\|IPlocal\)=.*,\1=$SERVERIP," \ -e "s,^INTERFACE=.*,INTERFACE=$SERVERDEV," \ @@ -105,6 +105,10 @@ if [ -n "$SERVERIP" ]; then # Processing when something has changed. if [ $CHANGE == 1 ]; then + # Config ogClient. + sed -i -e "s/^ip=.*/ip=$SERVERIP/g" \ + -e "s/^url=https:\/\/[0-9\.]*\//url=https:\/\/$SERVERIP\//g" \ + $OPENGNSYS/client/ogClient/cfg/ogclient.cfg # Restart OpenGnsys services. echo "Restarting services..." restart opengnsys >/dev/null -- cgit v1.2.3-18-g5258