summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rwxr-xr-xserver/bin/setserveraddr16
1 files changed, 13 insertions, 3 deletions
diff --git a/server/bin/setserveraddr b/server/bin/setserveraddr
index b9249af7..6694e3c4 100755
--- a/server/bin/setserveraddr
+++ b/server/bin/setserveraddr
@@ -88,13 +88,11 @@ if [ -n "$SERVERIP" ]; then
OLDSERVERIP=$ServidorAdm
# Checking if configuration files need to be modified.
CHANGE=0
- for f in $OPENGNSYS/{etc/ogserver.json,etc/ogAdmRepo.cfg,www/controlacceso.php}; do
+ for f in $OPENGNSYS/{etc/ogAdmRepo.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," \
-e "s,UrlMenu=https?://\([^/]*\)/\(.*\),UrlMenu=https://$SERVERIP/\2," \
- -e "s/\"ip\": \".*\"/\"ip\": \"$SERVERIP\"/" $SERVERCFG \
- -e "s/\"interface\": \".*\"/\"interface\": \"$SERVERDEV\"/" $SERVERCFG \
-e '/localhost/!s,https\?://[^/]*/\(.*\),https://'$SERVERIP'/\1,' $f >$tmpfile
file="${f/./-$SERVERDEV.}"
# Copying updated file, if needed.
@@ -105,6 +103,18 @@ if [ -n "$SERVERIP" ]; then
fi
done
+ f="$OPENGNSYS"/etc/ogserver.json
+ file="${f/./-$SERVERDEV.}"
+ step_one=$(mktemp)
+ jq --arg ip "$SERVERIP" '.rest.ip = $ip' "$file" > "$step_one"
+ step_two=$(mktemp)
+ jq --arg iface "$SERVERDEV" '.wol.interface = $iface' "$step_one" > "$step_two"
+ if [ ! "$f" -ef "$file" ] || ! diff -q "$step_two" "$file" &>/dev/null; then
+ cp "$step_two" "$file"
+ ln -f "$file" "$f"
+ CHANGE=1
+ fi
+
# Processing when something has changed.
if [ $CHANGE == 1 ]; then
# Config ogClient.