From 44de2a1ec5209060024e7b789c413930647229c1 Mon Sep 17 00:00:00 2001 From: Andre Date: Mon, 9 Dec 2019 14:48:00 +0100 Subject: [PATCH] testing --- amd64/scripts/iobroker_startup.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/amd64/scripts/iobroker_startup.sh b/amd64/scripts/iobroker_startup.sh index 936170f..dfa131c 100644 --- a/amd64/scripts/iobroker_startup.sh +++ b/amd64/scripts/iobroker_startup.sh @@ -150,7 +150,8 @@ then rm -f /opt/iobroker/.install_host echo 'Done.' echo ' ' -else if [ $(iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="host": ")[^"]*') != $(hostname) ] +elif [ $(iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="host": ")[^"]*') != $(hostname) ] +then echo "Hostname in ioBroker does not match the hostname of this container." echo "Updating hostname to " $(hostname)"..." sh /opt/iobroker/iobroker host $(iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="host": ")[^"]*') @@ -222,9 +223,13 @@ if [ "$redis" != "false" ] then echo "Connection to Redis is configured by ENV." echo "Installing prerequisites..." - apt-get update 2>&1> /dev/null && apt-get install -y jq 2>&1> /dev/null && rm -rf /var/lib/apt/lists/* - echo "Setting configuration for Redis in ioBroker..." - # missing + apt-get update 2>&1> /dev/null && apt-get install -y jq 2>&1> /dev/null && rm -rf /var/lib/apt/lists/* 2>&1> /dev/null + redisserver=$(echo $redis | sed -E 's/(.*):(.*)/\1/') + redisport=$(echo $redis | sed -E 's/(.*):(.*)/\2/') + echo "Setting configuration for Redis (Server: "$redisserver", Port: "$redisport") in ioBroker..." + cd /opt/iobroker/iobroker-data + jq '.states.type = "redis" | .states.host = "$redisserver" | .states.port = "$redisport"' iobroker.json > iobroker.json.tmp && mv iobroker.json.tmp iobroker.json + cd /opt/iobroker echo "Done." echo ' ' fi