summaryrefslogtreecommitdiffstats
path: root/installer/opengnsys_update.sh
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-06-05 13:14:17 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-06-08 11:49:47 +0200
commitaffce1633174aeb017439b0f263027f0f4094e1c (patch)
tree215c4e5364153d6d525f74187334e97b2fc83447 /installer/opengnsys_update.sh
parent53c927c7a35f99329f8a77a2b671536637211de7 (diff)
#971 Add ogClient update to the update script
New versions of OpenGnsys use ogClient as daemon for clients. Now update script downloads new version of ogClient from GitHub to update the code, maintaining the configuration file ogclient.json.
Diffstat (limited to 'installer/opengnsys_update.sh')
-rwxr-xr-xinstaller/opengnsys_update.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh
index 853a47b9..36b3b18c 100755
--- a/installer/opengnsys_update.sh
+++ b/installer/opengnsys_update.sh
@@ -1151,6 +1151,30 @@ function updateClient()
fi
}
+# Update ogClient
+function updateOgClient()
+{
+ local ogclientUrl="https://codeload.github.com/opengnsys/ogClient/zip/$BRANCH"
+
+ echoAndLog "${FUNCNAME}(): downloading ogClient code..."
+
+ if ! (curl "${ogclientUrl}" -o ogclient.zip && \
+ unzip -qo ogclient.zip)
+ then
+ errorAndLog "${FUNCNAME}(): "\
+ "error getting ogClient code from ${ogclientUrl}"
+ return 1
+ fi
+ if [ -e $INSTALL_TARGET/client/ogClient/cfg/ogclient.json ]; then
+ rm -f ogClient-"$BRANCH"/cfg/ogclient.json
+ fi
+ mv -f "ogClient-$BRANCH" $INSTALL_TARGET/client/ogClient
+ rm -f ogclient.zip
+ echoAndLog "${FUNCNAME}(): ogClient code was downloaded and updated"
+
+ return 0
+}
+
# Comprobar permisos y ficheros.
function checkFiles()
{
@@ -1343,6 +1367,12 @@ if [ $? -ne 0 ]; then
exit 1
fi
+# Update ogClient
+if ! updateOgClient; then
+ errorAndLog "Error updating ogClient files"
+ exit 1
+fi
+
# Comprobar permisos y ficheros.
checkFiles