From 6674d1b0980238d332159995f64df40da7c8ae77 Mon Sep 17 00:00:00 2001 From: buanet Date: Fri, 4 Nov 2022 09:12:07 +0100 Subject: [PATCH 01/17] add issue templates --- ISSUE_TEMPLATE/config.yml | 11 ++++++++++ ISSUE_TEMPLATE/feature_request.yaml | 18 +++++++++++++++ ISSUE_TEMPLATE/problem_report.yaml | 34 +++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 ISSUE_TEMPLATE/config.yml create mode 100644 ISSUE_TEMPLATE/feature_request.yaml create mode 100644 ISSUE_TEMPLATE/problem_report.yaml diff --git a/ISSUE_TEMPLATE/config.yml b/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..810a7f6 --- /dev/null +++ b/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: true +contact_links: + - name: ioBroker Docker image discussions + url: https://github.com/buanet/ioBroker.docker/discussions +# about: You can ask your questions here. + - name: ioBroker Community Forum + url: https://forum.iobroker.net/ + - name: ioBroker Discord channel + url: https://discord.gg/Ne3y6fUac3 + - name: ioBroker Facebook group + url: https://www.facebook.com/groups/440499112958264/ \ No newline at end of file diff --git a/ISSUE_TEMPLATE/feature_request.yaml b/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 0000000..ed09197 --- /dev/null +++ b/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,18 @@ +name: Feature Request +description: I want to request a new feature. +title: "[Feature Request]: " +labels: "enhancement" +assignees: +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to give us your feedback! + - type: textarea + id: description + attributes: + label: Description + description: Please describe your request. + placeholder: Waht are your ideas? + validations: + required: true diff --git a/ISSUE_TEMPLATE/problem_report.yaml b/ISSUE_TEMPLATE/problem_report.yaml new file mode 100644 index 0000000..d4679d3 --- /dev/null +++ b/ISSUE_TEMPLATE/problem_report.yaml @@ -0,0 +1,34 @@ +name: Problem Report +description: I want to report a problem. +title: "[Problem]: " +labels: +assignees: +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: description + attributes: + label: Description + description: Please describe your problem. + placeholder: What happened? What did you expect? + validations: + required: true + - type: input + id: version + attributes: + label: Image version + description: Which image version do you use? + placeholder: v1.2.3 + validations: + required: true + - type: textarea + id: logs + attributes: + label: Docker logs + description: Please provide the full Docker log output from your Docker container startup. + render: shell + validations: + required: true \ No newline at end of file From a2558e3a7b39e1ac32ebe2ef1fdd4fa575b47fc5 Mon Sep 17 00:00:00 2001 From: buanet Date: Fri, 4 Nov 2022 09:14:22 +0100 Subject: [PATCH 02/17] move templates --- {ISSUE_TEMPLATE => .github/ISSUE_TEMPLATE}/config.yml | 0 {ISSUE_TEMPLATE => .github/ISSUE_TEMPLATE}/feature_request.yaml | 0 {ISSUE_TEMPLATE => .github/ISSUE_TEMPLATE}/problem_report.yaml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {ISSUE_TEMPLATE => .github/ISSUE_TEMPLATE}/config.yml (100%) rename {ISSUE_TEMPLATE => .github/ISSUE_TEMPLATE}/feature_request.yaml (100%) rename {ISSUE_TEMPLATE => .github/ISSUE_TEMPLATE}/problem_report.yaml (100%) diff --git a/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml similarity index 100% rename from ISSUE_TEMPLATE/config.yml rename to .github/ISSUE_TEMPLATE/config.yml diff --git a/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml similarity index 100% rename from ISSUE_TEMPLATE/feature_request.yaml rename to .github/ISSUE_TEMPLATE/feature_request.yaml diff --git a/ISSUE_TEMPLATE/problem_report.yaml b/.github/ISSUE_TEMPLATE/problem_report.yaml similarity index 100% rename from ISSUE_TEMPLATE/problem_report.yaml rename to .github/ISSUE_TEMPLATE/problem_report.yaml From 8babae506aa57f2f0662bb9962d2facbcd959f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Germann?= Date: Fri, 4 Nov 2022 23:26:42 +0100 Subject: [PATCH 03/17] Update feature_request.yaml --- .github/ISSUE_TEMPLATE/feature_request.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index ed09197..b64a8eb 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -2,7 +2,7 @@ name: Feature Request description: I want to request a new feature. title: "[Feature Request]: " labels: "enhancement" -assignees: +assignees: "" body: - type: markdown attributes: From 6942c69ed2036785eef8ee33ffd9b75bbf2324af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Germann?= Date: Fri, 4 Nov 2022 23:27:03 +0100 Subject: [PATCH 04/17] Update feature_request.yaml --- .github/ISSUE_TEMPLATE/feature_request.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index b64a8eb..6b009a5 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -2,7 +2,7 @@ name: Feature Request description: I want to request a new feature. title: "[Feature Request]: " labels: "enhancement" -assignees: "" +assignees: " " body: - type: markdown attributes: From 019d1c2ace42badc31681b553a3ca834dd3d95c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Germann?= Date: Fri, 4 Nov 2022 23:27:51 +0100 Subject: [PATCH 05/17] Update feature_request.yaml --- .github/ISSUE_TEMPLATE/feature_request.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 6b009a5..b2c9b4d 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -2,7 +2,6 @@ name: Feature Request description: I want to request a new feature. title: "[Feature Request]: " labels: "enhancement" -assignees: " " body: - type: markdown attributes: From 6b35addabe8b1d7e9e9fcb24d1f0532648dac040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Germann?= Date: Fri, 4 Nov 2022 23:28:18 +0100 Subject: [PATCH 06/17] Update problem_report.yaml --- .github/ISSUE_TEMPLATE/problem_report.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/problem_report.yaml b/.github/ISSUE_TEMPLATE/problem_report.yaml index d4679d3..06cd4e1 100644 --- a/.github/ISSUE_TEMPLATE/problem_report.yaml +++ b/.github/ISSUE_TEMPLATE/problem_report.yaml @@ -1,8 +1,6 @@ name: Problem Report description: I want to report a problem. title: "[Problem]: " -labels: -assignees: body: - type: markdown attributes: @@ -31,4 +29,4 @@ body: description: Please provide the full Docker log output from your Docker container startup. render: shell validations: - required: true \ No newline at end of file + required: true From d924e8436670290d6b5585d7e4a76b469fba8e53 Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 8 Nov 2022 15:03:24 +0100 Subject: [PATCH 07/17] fix hostname check --- .VERSION | 2 +- CHANGELOG.md | 3 ++ debian/scripts/iobroker_startup.sh | 48 +++++++++++++++--------------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/.VERSION b/.VERSION index a6f5e94..2722298 100644 --- a/.VERSION +++ b/.VERSION @@ -1 +1 @@ -v7.1.1 \ No newline at end of file +v7.1.2 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2664606..d65f727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Changelog +### v7.1.2 (08.11.2022) +* fix hostname check ([#293](https://github.com/buanet/ioBroker.docker/issues/293)) + ### v7.1.1 (01.11.2022) * fix setting gid of iobroker group ([#289](https://github.com/buanet/ioBroker.docker/issues/289)) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index c79419c..02def93 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -160,9 +160,7 @@ elif [[ "$(ls *_backupiobroker.tar.gz 2> /dev/null | wc -l)" != "0" && "$(tar -z exit 1 else echo "IoBroker backup file detected in /opt/iobroker." - if [[ "$debug" == "true" ]]; then - echo "[DEBUG] Backup file name: " $(ls *_backupiobroker.tar.gz) - fi + if [[ "$debug" == "true" ]]; then echo "[DEBUG] Backup file name: " $(ls *_backupiobroker.tar.gz); fi echo -n "Preparing restore... " mv /opt/iobroker/*.tar.gz /opt/ tar -xf /opt/initial_iobroker.tar -C / @@ -218,34 +216,37 @@ echo -n "Fixing \"sudo-bug\" by replacing sudo with gosu... " echo 'Done.' echo ' ' -# checking hostname in ioBroker to match container hostname -if [[ "$(bash iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="host": ")[^"]*')" != "$(hostname)" && "$multihost" != "slave" ]]; then +# hostname check +# get admin instance and hostname +set +e +admininstance=$(iob list instances | grep -m 1 'admin' | awk '{print $2}') +set -e +if [[ "$admininstance" != "" ]]; then + if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin instance is:" $admininstance; fi + adminhostname=$(bash iobroker object get $admininstance --pretty | grep -oP '(?<="host": ")[^"]*') + if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin hostname is:" $adminhostname; fi +else + echo "There was a problem detecting the admin instance and/or hostname of your iobroker." + echo "Make sure the ioBroker installation you use has an admin instance or start over with a fresh installation and restore your configuration." + echo "For more details see https://docs.buanet.de/iobroker-docker-image/docs/#restore" + exit 1 +fi +# check hostname +if [[ "$adminhostname" != "" && "$adminhostname" != "$(hostname)" && "$multihost" != "slave" ]]; then echo "Hostname in ioBroker does not match the hostname of this container." - if [[ "$debug" == "true" ]]; then - echo "[DEBUG] Detected hostname in ioBroker: " $(bash iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="host": ")[^"]*') - echo "[DEBUG] Detected hostname in container: " $(hostname) - fi echo -n "Updating hostname to "$(hostname)"... " - bash iobroker host $(bash iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="host": ")[^"]*') + bash iobroker host $adminhostname echo 'Done.' echo ' ' elif [[ "$multihost" == "slave" ]]; then echo "IOB_MULTIHOST ist set to \"slave\". Hostname check will be skipped." echo ' ' -elif [[ "$(bash iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="host": ")[^"]*')" = "$(hostname)" && "$multihost" != "slave" ]]; then +elif [[ "$adminhostname" = "$(hostname)" && "$multihost" != "slave" ]]; then echo "Hostname in ioBroker matches the hostname of this container." - if [[ "$debug" == "true" ]]; then - echo "[DEBUG] Detected hostname in ioBroker: " $(bash iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="host": ")[^"]*') - echo "[DEBUG] Detected hostname in container: " $(hostname) - fi echo "No action required." echo ' ' else - if [[ "$debug" == "true" ]]; then - echo "[DEBUG] There was a problem checking the hostname." - echo "[DEBUG] Detected hostname in ioBroker: " $(bash iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="host": ")[^"]*') - echo "[DEBUG] Detected hostname in container: " $(hostname) - fi + echo "There was a problem checking the hostname." fi ##### @@ -262,11 +263,10 @@ echo ' ' # Checking ENV for Adminport if [[ "$adminport" != "" ]]; then - if [[ "$adminport" != "$(bash iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="port": )[^,]*')" ]]; then + adminportold=$(bash iobroker object get $admininstance --pretty | grep -oP '(?<="port": )[^,]*') + if [[ "$adminport" != "$adminportold" ]]; then echo "IOB_ADMINPORT is set and does not match port configured in ioBroker." - if [[ "$debug" == "true" ]]; then - echo "[DEBUG] Detected Admin Port in ioBroker: " $(bash iobroker object get system.adapter.admin.0 --pretty | grep -oP '(?<="port": )[^,]*') - fi + if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected Admin Port in ioBroker: " $adminportold; fi echo -n "Setting Adminport to \""$adminport"\"... " bash iobroker set admin.0 --port $adminport echo 'Done.' From 2f9a19b2a965ba87f7be84df97597958b33c557c Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 8 Nov 2022 17:00:49 +0100 Subject: [PATCH 08/17] fix hostname check --- debian/scripts/iobroker_startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 02def93..a1859e2 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -219,7 +219,7 @@ echo ' ' # hostname check # get admin instance and hostname set +e -admininstance=$(iob list instances | grep -m 1 'admin' | awk '{print $2}') +admininstance=$(bash iobroker list instances | grep -m 1 'admin' | awk '{print $2}') set -e if [[ "$admininstance" != "" ]]; then if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin instance is:" $admininstance; fi From cf175a820f44e2564ec699634a1554982716f35a Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 8 Nov 2022 19:44:59 +0100 Subject: [PATCH 09/17] fix hostname check --- debian/scripts/iobroker_startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index a1859e2..cf83de6 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -219,7 +219,7 @@ echo ' ' # hostname check # get admin instance and hostname set +e -admininstance=$(bash iobroker list instances | grep -m 1 'admin' | awk '{print $2}') +admininstance=$(bash iobroker list instances | grep -m 1 'admin' | awk '{print $1}') set -e if [[ "$admininstance" != "" ]]; then if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin instance is:" $admininstance; fi From 2bda056f360f800df15d34ef9d15610ede795e6d Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 8 Nov 2022 21:19:58 +0100 Subject: [PATCH 10/17] fix admin detection --- debian/scripts/iobroker_startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index cf83de6..6747b77 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -219,7 +219,7 @@ echo ' ' # hostname check # get admin instance and hostname set +e -admininstance=$(bash iobroker list instances | grep -m 1 'admin' | awk '{print $1}') +admininstance=$(bash iobroker list instances | grep -m 1 -o 'system.adapter.admin..') set -e if [[ "$admininstance" != "" ]]; then if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin instance is:" $admininstance; fi From 5f406755011b2eaedd2d46297dfadfb8d2574b46 Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 8 Nov 2022 21:33:54 +0100 Subject: [PATCH 11/17] fix set adminport --- debian/scripts/iobroker_startup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 6747b77..910d456 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -264,11 +264,12 @@ echo ' ' # Checking ENV for Adminport if [[ "$adminport" != "" ]]; then adminportold=$(bash iobroker object get $admininstance --pretty | grep -oP '(?<="port": )[^,]*') + admininstanceshort=$(echo $admininstance | grep -m 1 -o 'admin..') if [[ "$adminport" != "$adminportold" ]]; then echo "IOB_ADMINPORT is set and does not match port configured in ioBroker." if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected Admin Port in ioBroker: " $adminportold; fi echo -n "Setting Adminport to \""$adminport"\"... " - bash iobroker set admin.0 --port $adminport + bash iobroker set $admininstanceshort --port $adminport echo 'Done.' echo ' ' fi From 6223cdad53f71a79e468896cf795a5a44a9d072a Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 8 Nov 2022 22:25:01 +0100 Subject: [PATCH 12/17] skip hostname check when multihost is slave --- debian/scripts/iobroker_startup.sh | 58 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 910d456..fa23354 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -217,36 +217,38 @@ echo 'Done.' echo ' ' # hostname check -# get admin instance and hostname -set +e -admininstance=$(bash iobroker list instances | grep -m 1 -o 'system.adapter.admin..') -set -e -if [[ "$admininstance" != "" ]]; then - if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin instance is:" $admininstance; fi - adminhostname=$(bash iobroker object get $admininstance --pretty | grep -oP '(?<="host": ")[^"]*') - if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin hostname is:" $adminhostname; fi -else - echo "There was a problem detecting the admin instance and/or hostname of your iobroker." - echo "Make sure the ioBroker installation you use has an admin instance or start over with a fresh installation and restore your configuration." - echo "For more details see https://docs.buanet.de/iobroker-docker-image/docs/#restore" - exit 1 -fi -# check hostname -if [[ "$adminhostname" != "" && "$adminhostname" != "$(hostname)" && "$multihost" != "slave" ]]; then - echo "Hostname in ioBroker does not match the hostname of this container." - echo -n "Updating hostname to "$(hostname)"... " - bash iobroker host $adminhostname - echo 'Done.' - echo ' ' -elif [[ "$multihost" == "slave" ]]; then +if [[ "$multihost" == "slave" ]]; then echo "IOB_MULTIHOST ist set to \"slave\". Hostname check will be skipped." echo ' ' -elif [[ "$adminhostname" = "$(hostname)" && "$multihost" != "slave" ]]; then - echo "Hostname in ioBroker matches the hostname of this container." - echo "No action required." - echo ' ' else - echo "There was a problem checking the hostname." + # get admin instance and hostname + set +e + admininstance=$(bash iobroker list instances | grep -m 1 -o 'system.adapter.admin..') + set -e + if [[ "$admininstance" != "" ]]; then + if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin instance is:" $admininstance; fi + adminhostname=$(bash iobroker object get $admininstance --pretty | grep -oP '(?<="host": ")[^"]*') + if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin hostname is:" $adminhostname; fi + else + echo "There was a problem detecting the admin instance and/or hostname of your iobroker." + echo "Make sure the ioBroker installation you use has an admin instance or start over with a fresh installation and restore your configuration." + echo "For more details see https://docs.buanet.de/iobroker-docker-image/docs/#restore" + exit 1 + fi + # check hostname + if [[ "$adminhostname" != "" && "$adminhostname" != "$(hostname)" ]]; then + echo "Hostname in ioBroker does not match the hostname of this container." + echo -n "Updating hostname to "$(hostname)"... " + bash iobroker host $adminhostname + echo 'Done.' + echo ' ' + elif [[ "$adminhostname" = "$(hostname)" ]]; then + echo "Hostname in ioBroker matches the hostname of this container." + echo "No action required." + echo ' ' + else + echo "There was a problem checking the hostname." + fi fi ##### @@ -262,7 +264,7 @@ echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.d echo ' ' # Checking ENV for Adminport -if [[ "$adminport" != "" ]]; then +if [[ "$adminport" != "" && "$multihost" != "slave" ]]; then adminportold=$(bash iobroker object get $admininstance --pretty | grep -oP '(?<="port": )[^,]*') admininstanceshort=$(echo $admininstance | grep -m 1 -o 'admin..') if [[ "$adminport" != "$adminportold" ]]; then From b4eb36223b08dc26174c9c2173d9f8ed32274f89 Mon Sep 17 00:00:00 2001 From: buanet Date: Wed, 9 Nov 2022 09:00:37 +0100 Subject: [PATCH 13/17] change error handling --- debian/scripts/iobroker_startup.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index fa23354..3c02064 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -28,6 +28,20 @@ set -u pkill_timeout=10 # timeout for iobroker shutdown in seconds +# Stop on error function +stop_on_error() { + if [[ "$debug" == "true" ]]; then + echo '' + echo "[DEBUG] Debug mode prevents the container from exiting on errors." + echo "[DEBUG] This enables you to investigate or fix your issue on the command line." + echo "[DEBUG] If you want to stop or restart your container you have to do it manually." + echo "[DEBUG] IoBroker is not running!" + tail -f /dev/null + else + exit 1 + fi +} + # Getting date and time for logging dati=`date '+%Y-%m-%d %H:%M:%S'` @@ -230,10 +244,10 @@ else adminhostname=$(bash iobroker object get $admininstance --pretty | grep -oP '(?<="host": ")[^"]*') if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin hostname is:" $adminhostname; fi else - echo "There was a problem detecting the admin instance and/or hostname of your iobroker." + echo "There was a problem detecting the admin instance of your iobroker." echo "Make sure the ioBroker installation you use has an admin instance or start over with a fresh installation and restore your configuration." echo "For more details see https://docs.buanet.de/iobroker-docker-image/docs/#restore" - exit 1 + stop_on_error() fi # check hostname if [[ "$adminhostname" != "" && "$adminhostname" != "$(hostname)" ]]; then @@ -248,6 +262,7 @@ else echo ' ' else echo "There was a problem checking the hostname." + stop_on_error() fi fi @@ -270,7 +285,7 @@ if [[ "$adminport" != "" && "$multihost" != "slave" ]]; then if [[ "$adminport" != "$adminportold" ]]; then echo "IOB_ADMINPORT is set and does not match port configured in ioBroker." if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected Admin Port in ioBroker: " $adminportold; fi - echo -n "Setting Adminport to \""$adminport"\"... " + echo "Setting Adminport to \""$adminport"\"... " bash iobroker set $admininstanceshort --port $adminport echo 'Done.' echo ' ' From c8e5a424fea01ea94d437e81138d9af8995b7c10 Mon Sep 17 00:00:00 2001 From: buanet Date: Wed, 9 Nov 2022 10:27:57 +0100 Subject: [PATCH 14/17] fix typo --- debian/scripts/iobroker_startup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 3c02064..ec3eb0a 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -247,7 +247,7 @@ else echo "There was a problem detecting the admin instance of your iobroker." echo "Make sure the ioBroker installation you use has an admin instance or start over with a fresh installation and restore your configuration." echo "For more details see https://docs.buanet.de/iobroker-docker-image/docs/#restore" - stop_on_error() + stop_on_error fi # check hostname if [[ "$adminhostname" != "" && "$adminhostname" != "$(hostname)" ]]; then @@ -262,7 +262,7 @@ else echo ' ' else echo "There was a problem checking the hostname." - stop_on_error() + stop_on_error fi fi From 210b99c6432f93f12729e48f9de921fb4c1af10c Mon Sep 17 00:00:00 2001 From: buanet Date: Wed, 9 Nov 2022 12:30:20 +0100 Subject: [PATCH 15/17] fix typo --- debian/scripts/iobroker_startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index ec3eb0a..8c26c66 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -31,7 +31,7 @@ pkill_timeout=10 # timeout for iobroker shutdown in seconds # Stop on error function stop_on_error() { if [[ "$debug" == "true" ]]; then - echo '' + echo ' ' echo "[DEBUG] Debug mode prevents the container from exiting on errors." echo "[DEBUG] This enables you to investigate or fix your issue on the command line." echo "[DEBUG] If you want to stop or restart your container you have to do it manually." From 6fc6b71ac686cf7fc01c10efa2822cc9ff845b52 Mon Sep 17 00:00:00 2001 From: buanet Date: Wed, 9 Nov 2022 13:19:23 +0100 Subject: [PATCH 16/17] add enabled filter for iob list instances --- debian/scripts/iobroker_startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 8c26c66..7b57fec 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -237,7 +237,7 @@ if [[ "$multihost" == "slave" ]]; then else # get admin instance and hostname set +e - admininstance=$(bash iobroker list instances | grep -m 1 -o 'system.adapter.admin..') + admininstance=$(bash iobroker list instances | grep 'enabled' | grep -m 1 -o 'system.adapter.admin..') set -e if [[ "$admininstance" != "" ]]; then if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin instance is:" $admininstance; fi From d164d9f497f0043852ded056ef1cd53ecec9bd91 Mon Sep 17 00:00:00 2001 From: buanet Date: Wed, 9 Nov 2022 17:28:14 +0100 Subject: [PATCH 17/17] fix packages check --- debian/scripts/iobroker_startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 7b57fec..1b466aa 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -118,7 +118,7 @@ if [[ -f /opt/.firstrun ]]; then if [[ "$packages" != "" && "$offlinemode" = "true" ]]; then echo 'PACKAGES is set, but OFFLINE_MODE is \"true\". Skipping Linux package installation.' echo ' ' - else + elif [[ "$packages" != "" ]]; then echo 'PACKAGES is set. Installing additional Linux packages.' echo "Checking the following packages:" $packages"..." echo $packages > /opt/scripts/.docker_config/.packages