summaryrefslogtreecommitdiffstats
path: root/installer
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-11-03 09:57:39 +0000
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-11-03 11:29:05 +0100
commite7ffae8cc5081f7780b82beac7e7034ae328990b (patch)
tree233e7bc5dde78e45a81eb63d9a557e428d64b4c4 /installer
parent1f0d1d5a0b60ee97b8f7ed39375f1123fbf0d222 (diff)
#988 Add ogserver.json creation when running opengnsys_update.sh
This patch enables the creation of a default json config for the ogserver when running opengnsys_update.sh, if no prior json config is detected. Eg. when updating from 1.1.1c to 1.2.0 Reviewed-by: Jose M. Guisado <jguisado@soleta.eu>
Diffstat (limited to 'installer')
-rwxr-xr-xinstaller/opengnsys_update.sh27
1 files changed, 24 insertions, 3 deletions
diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh
index 0f48d04b..d7ee7d37 100755
--- a/installer/opengnsys_update.sh
+++ b/installer/opengnsys_update.sh
@@ -1089,7 +1089,28 @@ function ogServerCompilation()
popd
# Renaming OpenGnsys Server configuration file, if needed
[ -e $INSTALL_TARGET/etc/ogAdmServer.cfg ] && \
- mv -v $INSTALL_TARGET/etc/ogAdmServer.cfg $INSTALL_TARGET/etc/ogserver.cfg
+ rm -f $INSTALL_TARGET/etc/ogAdmServer.cfg
+ [ -e $INSTALL_TARGET/etc/ogserver.cfg ] && \
+ rm -f $INSTALL_TARGET/etc/ogserver.cfg
+ if [ ! -e $INSTALL_TARGET/etc/ogserver.json ]; then
+ echo "{
+ \"rest\" : {
+ \"ip\" : \"$ServidorAdm\",
+ \"port\" : \"8888\",
+ \"api_token\": \"$APITOKEN\"
+ },
+ \"database\" : {
+ \"ip\": \"$datasource\",
+ \"port\": \"3306\",
+ \"name\" : \"$CATALOG\",
+ \"user\" : \"$USUARIO\",
+ \"pass\" : \"$PASSWORD\"
+ },
+ \"wol\" : {
+ \"interface\" : \"$INTERFACE\"
+ }
+ }" | jq '.' > "$INSTALL_TARGET"/etc/ogserver.json
+ fi
# Remove old OpenGnsys services
for serv in ogAdmAgent ogAdmRepo ogAdmServer; do
pgrep $serv > /dev/null && pkill -9 $serv && \
@@ -1100,8 +1121,8 @@ function ogServerCompilation()
fi
done
# Generating an ogServer API token, if it does not exist
- grep -q "APITOKEN=" $INSTALL_TARGET/etc/ogserver.cfg || \
- $INSTALL_TARGET/bin/settoken -f
+ [ -z "$APITOKEN" ] && \
+ $INSTALL_TARGET/bin/settoken -f
# Updating service file, if needed
if ! diff -q \
"$WORKDIR"/ogServer-"$BRANCH"/cfg/ogserver.service \