diff --git a/.VERSION b/.VERSION index 4cf2aaf..8f80905 100644 --- a/.VERSION +++ b/.VERSION @@ -1 +1 @@ -v9.0.0 \ No newline at end of file +v9.0.1 \ No newline at end of file diff --git a/.github/workflows/build-debian12-dev.yml b/.github/workflows/build-debian12-dev.yml index f912733..145f2bd 100644 --- a/.github/workflows/build-debian12-dev.yml +++ b/.github/workflows/build-debian12-dev.yml @@ -134,7 +134,7 @@ jobs: with: context: ./debian12 file: ./debian12/Dockerfile - push: false + push: true platforms: | linux/amd64 linux/arm64 diff --git a/CHANGELOG.md b/CHANGELOG.md index 10a42f5..9a15126 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## Changelog +### v9.0.1 (10.10.2023) +* fix issue with avahi setup ([#384](https://github.com/buanet/ioBroker.docker/issues/384); [#385 by @z1r0](https://github.com/buanet/ioBroker.docker/pull/385)) +* add silent cleanup to setup_avahi.sh +* add error handling for package updates/ install +* fix calling iob in iobroker_startup.sh ([#388](https://github.com/buanet/ioBroker.docker/issues/388)) + ### v9.0.0 (09.10.2023) * update official docs * v9.0.0-beta.2 (28.09.2023) diff --git a/debian12/scripts/iobroker_startup.sh b/debian12/scripts/iobroker_startup.sh index efe0957..52da59f 100644 --- a/debian12/scripts/iobroker_startup.sh +++ b/debian12/scripts/iobroker_startup.sh @@ -133,7 +133,11 @@ if [[ -f /opt/.docker_config/.first_run ]]; then if [[ "$offlinemode" = "true" ]]; then echo "OFFLINE_MODE is \"true\". Skipping Linux package updates on first run." else - bash /opt/scripts/setup_packages.sh -update + if bash /opt/scripts/setup_packages.sh -update; then + echo " " + else + echo "Error: Updating failed." + fi fi echo " " # Installing packages from ENV @@ -141,7 +145,11 @@ if [[ -f /opt/.docker_config/.first_run ]]; then echo "PACKAGES is set, but OFFLINE_MODE is \"true\". Skipping Linux package installation." elif [[ "$packages" != "" ]]; then echo "PACKAGES is set. Installing the following additional Linux packages: ""$packages" - bash /opt/scripts/setup_packages.sh -install + if bash /opt/scripts/setup_packages.sh -install; then + echo " " + else + echo "Error: Installation failed." + fi fi echo " " # Register maintenance script @@ -308,7 +316,7 @@ if [[ -f /opt/iobroker/.fresh_install && "$multihost" != "slave" ]]; then echo -n "Initializing a fresh installation of ioBroker... " if [[ ! -d "/opt/iobroker/log" ]]; then gosu iobroker mkdir "/opt/iobroker/log"; fi set +e - bash iob setup first > /opt/iobroker/log/iob_setup_first.log 2>&1 + gosu iobroker iob setup first > /opt/iobroker/log/iob_setup_first.log 2>&1 return=$? set -e rm -f /opt/iobroker/.fresh_install @@ -323,11 +331,11 @@ if [[ -f /opt/iobroker/.fresh_install && "$multihost" != "slave" ]]; then else echo -n "Checking Database connection... " set +e - if iob uuid &> /dev/null; then + if gosu iobroker iob uuid &> /dev/null; then echo "Done." echo " " else - errormsg=$(iob uuid 2>&1 | sed 's/^/[DEBUG] /') + errormsg=$(gosu iobroker iob uuid 2>&1 | sed 's/^/[DEBUG] /') echo "Failed." if [[ "$debug" == "true" ]]; then echo "[DEBUG] Error message: " @@ -347,20 +355,20 @@ if [[ "$multihost" == "slave" ]]; then else # get admin instance and hostname set +e - admininstance=$(bash iobroker list instances | grep 'enabled' | grep -m 1 -o 'system.adapter.admin..') + admininstance=$(gosu iobroker iob 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 - adminhostname=$(bash iobroker object get "$admininstance" --pretty | grep -oP '(?<="host": ")[^"]*') + adminhostname=$(gosu iobroker iob object get "$admininstance" --pretty | grep -oP '(?<="host": ")[^"]*') if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin hostname is:" "$adminhostname"; fi else set +e - admininstance=$(bash iobroker list instances | grep 'disabled' | grep -m 1 -o 'system.adapter.admin..') + admininstance=$(gosu iobroker iob 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": ")[^"]*') + adminhostname=$(gosu iobroker iob 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." @@ -373,7 +381,7 @@ else 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" + gosu iobroker iob host "$adminhostname" echo "Done." echo " " elif [[ "$adminhostname" = "$(hostname)" ]]; then @@ -431,13 +439,13 @@ echo " " # Checking ENV for Adminport if [[ "$adminport" != "" && "$multihost" != "slave" ]]; then - adminportold=$(bash iobroker object get "$admininstance" --pretty | grep -oP '(?<="port": )[^,]*') + adminportold=$(gosu iobroker iob 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 "Setting Adminport to \"""$adminport""\"... " - bash iobroker set "$admininstanceshort" --port "$adminport" + gosu iobroker iob set "$admininstanceshort" --port "$adminport" echo "Done." echo " " fi diff --git a/debian12/scripts/setup_avahi.sh b/debian12/scripts/setup_avahi.sh index 46d5873..26c7cd5 100644 --- a/debian12/scripts/setup_avahi.sh +++ b/debian12/scripts/setup_avahi.sh @@ -5,9 +5,11 @@ then echo "[setup_avahi.sh] Avahi is already installed. Nothing to do here." else echo -n "[setup_avahi.sh] Avahi-daemon is NOT installed. Going to install it now... " - apt-get update > /opt/scripts/avahi_startup.log 2>&1 - apt-get install -y --no-install-recommends libavahi-compat-libdnssd-dev avahi-daemon >> /opt/scripts/avahi_startup.log 2>&1 - rm -rf /var/lib/apt/lists/* >> /opt/scripts/avahi_startup.log 2>&1 + apt-get -q update > /opt/scripts/avahi_startup.log 2>&1 + apt-get -q -y --no-install-recommends install libavahi-compat-libdnssd-dev avahi-daemon >> /opt/scripts/avahi_startup.log 2>&1 + # Silent Cleanup + apt-get -qq autoclean -y && apt-get -qq autoremove && apt-get -qq clean + rm -rf /tmp/* /var/tmp/* /root/.cache/* /var/lib/apt/lists/* || true echo "Done." echo -n "[setup_avahi.sh] Configuring avahi-daemon... " sed -i '/^rlimit-nproc/s/^\(.*\)/#\1/g' /etc/avahi/avahi-daemon.conf @@ -32,7 +34,7 @@ echo -n "[setup_avahi.sh] Starting dbus... " echo "Done." echo -n "[setup_avahi.sh] Starting avahi-daemon... " - /etc/init.d/avahi-daemon start >> /opt/scripts/avahi_startup.log 2>&1 + avahi-daemon >> /opt/scripts/avahi_startup.log 2>&1 & echo "Done." exit 0