From be18293a5bbd2f1e0fa5c7d92a1258f57a5fd21b Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 11 Apr 2023 18:37:45 +0200 Subject: [PATCH] small enhancements --- .VERSION | 2 +- .../workflows/build-debian-image-latest.yml | 7 ++----- CHANGELOG.md | 5 +++++ debian/scripts/iobroker_startup.sh | 18 ++++++++++++++---- debian/scripts/maintenance.sh | 9 +++++++++ debian/scripts/setup_iob_db.sh | 16 ++++++++++++++-- 6 files changed, 45 insertions(+), 12 deletions(-) diff --git a/.VERSION b/.VERSION index e4842dc..6743486 100644 --- a/.VERSION +++ b/.VERSION @@ -1 +1 @@ -v8.0.0 \ No newline at end of file +v8.1.0-beta.1 \ No newline at end of file diff --git a/.github/workflows/build-debian-image-latest.yml b/.github/workflows/build-debian-image-latest.yml index 22b291a..4b327b4 100644 --- a/.github/workflows/build-debian-image-latest.yml +++ b/.github/workflows/build-debian-image-latest.yml @@ -46,10 +46,7 @@ jobs: - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v2.5.0 #v2.4.1 -# with: -# version: v0.10.3 # pin buildx version because of issue with ghcr.io (https://github.com/docker/build-push-action/issues/851) - + uses: docker/setup-buildx-action@v2.5.0 - name: Login to DockerHub (buanet) uses: docker/login-action@v2.1.0 with: @@ -68,7 +65,7 @@ jobs: with: context: ./debian file: ./debian/node18/Dockerfile - provenance: false + #provenance: false push: true platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 tags: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 0667261..8d4e7a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Changelog +### v8.1.0-beta.1 (coming soon) +* enhance log output of maintenance script on restore ([#333](https://github.com/buanet/ioBroker.docker/issues/333)) +* allow iobroker admin to be disabled at startup ([#332](https://github.com/buanet/ioBroker.docker/issues/332)) +* allow deletion of objects and states db password with value "none" ([#306](https://github.com/buanet/ioBroker.docker/issues/306)) + ### v8.0.0 (20.03.2023) * update readme and docs * remove manifests diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index f3b139e..3977436 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -352,10 +352,20 @@ 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 of your iobroker." - echo "Make sure the ioBroker installation you use has an admin instance or try again 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 + set +e + admininstance=$(bash iobroker list instances | grep 'disabled' | grep -m 1 -o 'system.adapter.admin..') + set -e + if [[ "$admininstance" != "" ]]; then + if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin instance is disabled."; fi + 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 of your iobroker." + echo "Make sure the ioBroker installation you use has an admin instance or try again 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 + fi fi # check hostname if [[ "$adminhostname" != "" && "$adminhostname" != "$(hostname)" ]]; then diff --git a/debian/scripts/maintenance.sh b/debian/scripts/maintenance.sh index 95222ab..13f133d 100644 --- a/debian/scripts/maintenance.sh +++ b/debian/scripts/maintenance.sh @@ -242,7 +242,16 @@ restore_iobroker() { #chown -R $setuid:$setgid /opt/iobroker/backup echo -n "Restoring ioBroker... " + set +e bash iobroker restore 0 > /opt/iobroker/log/restore.log 2>&1 + return=$? + set -e + if [[ "$return" -ne 0 ]]; then + echo "Failed." + echo "For more details see \"/opt/iobroker/log/restore.log\"." + echo "Please check backup file location and permissions and try again." + return 1 + fi echo 'Done.' echo ' ' echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" diff --git a/debian/scripts/setup_iob_db.sh b/debian/scripts/setup_iob_db.sh index 665766e..44164b9 100644 --- a/debian/scripts/setup_iob_db.sh +++ b/debian/scripts/setup_iob_db.sh @@ -99,7 +99,13 @@ set_objectsdb_port() { fi } set_objectsdb_pass() { - if [[ "$objectsdbpass" != "$(jq -r '.objects.options.auth_pass' /opt/iobroker/iobroker-data/iobroker.json)" ]]; then + if [[ "$objectsdbpass" == "none" ]]; then + echo "IOB_OBJECTSDB_PASS is available but value is set to \"none\"." + echo -n "Removing password of objects db... " + jq '.objects.options.auth_pass = null' /opt/iobroker/iobroker-data/iobroker.json > /opt/iobroker/iobroker-data/iobroker.json.tmp + write_iobroker_json + echo 'Done.' + elif [[ "$objectsdbpass" != "$(jq -r '.objects.options.auth_pass' /opt/iobroker/iobroker-data/iobroker.json)" ]]; then echo "IOB_OBJECTSDB_PASS is available but value is different from detected ioBroker installation." echo -n "Setting password of objects db... " jq --arg value "$objectsdbpass" '.objects.options.auth_pass = $value' /opt/iobroker/iobroker-data/iobroker.json > /opt/iobroker/iobroker-data/iobroker.json.tmp @@ -188,7 +194,13 @@ set_statesdb_port() { fi } set_statesdb_pass() { - if [[ "$statesdbpass" != "$(jq -r '.states.options.auth_pass' /opt/iobroker/iobroker-data/iobroker.json)" ]]; then + if [[ "$statesdbpass" == "none" ]]; then + echo "IOB_STATESDB_PASS is available but value is set to \"none\"." + echo -n "Removing password of states db... " + jq '.states.options.auth_pass = null' /opt/iobroker/iobroker-data/iobroker.json > /opt/iobroker/iobroker-data/iobroker.json.tmp + write_iobroker_json + echo 'Done.' + elif [[ "$statesdbpass" != "$(jq -r '.states.options.auth_pass' /opt/iobroker/iobroker-data/iobroker.json)" ]]; then echo "IOB_STATESDB_PASS is available but value is different from detected ioBroker installation." echo -n "Setting password of states db... " jq --arg value "$statesdbpass" '.states.options.auth_pass = $value' /opt/iobroker/iobroker-data/iobroker.json > /opt/iobroker/iobroker-data/iobroker.json.tmp