From c08b0b45f1c04cb315405e72b3dab848aba12301 Mon Sep 17 00:00:00 2001 From: buanet Date: Wed, 2 Nov 2022 21:55:47 +0100 Subject: [PATCH 01/15] add env and reorder dockerfile --- .VERSION | 2 +- CHANGELOG.md | 4 ++++ debian/node16/Dockerfile | 7 ++++--- debian/node18/Dockerfile | 7 ++++--- debian/scripts/iobroker_startup.sh | 12 +++++++++++- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.VERSION b/.VERSION index a6f5e94..3b52e3a 100644 --- a/.VERSION +++ b/.VERSION @@ -1 +1 @@ -v7.1.1 \ No newline at end of file +v7.2.0-beta.1 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2664606..9a91f51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Changelog +### v7.2.0-beta.1 (coming soon) +* add env IOB_BACKITUP_EXTDB to unlock external db backups in backitup adapter +* reorder dockerfile steps to fulfill ioBroker Docker check + ### 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/node16/Dockerfile b/debian/node16/Dockerfile index 94505e1..32323ae 100644 --- a/debian/node16/Dockerfile +++ b/debian/node16/Dockerfile @@ -48,12 +48,13 @@ RUN chmod 777 /opt/scripts/ \ && chmod +x /opt/scripts/*.sh \ && chmod +x /opt/userscripts/*.sh -# Install ioBroker -RUN curl -sL https://iobroker.net/install.sh | bash - \ - && mkdir -p /opt/scripts/.docker_config/ \ +# Prepare and install ioBroker +RUN mkdir -p /opt/scripts/.docker_config/ \ && echo "starting" > /opt/scripts/.docker_config/.healthcheck \ && echo "${VERSION}" > /opt/scripts/.docker_config/.thisisdocker \ && echo $(hostname) > /opt/.firstrun \ + # Run installer + && curl -sL https://iobroker.net/install.sh | bash - \ # Deleting UUID from build && iobroker unsetup -y \ # Backup initial ioBroker and userscript folder diff --git a/debian/node18/Dockerfile b/debian/node18/Dockerfile index ef9001e..61130a7 100644 --- a/debian/node18/Dockerfile +++ b/debian/node18/Dockerfile @@ -48,12 +48,13 @@ RUN chmod 777 /opt/scripts/ \ && chmod +x /opt/scripts/*.sh \ && chmod +x /opt/userscripts/*.sh -# Install ioBroker -RUN curl -sL https://iobroker.net/install.sh | bash - \ - && mkdir -p /opt/scripts/.docker_config/ \ +# Prepare and install ioBroker +RUN mkdir -p /opt/scripts/.docker_config/ \ && echo "starting" > /opt/scripts/.docker_config/.healthcheck \ && echo "${VERSION}" > /opt/scripts/.docker_config/.thisisdocker \ && echo $(hostname) > /opt/.firstrun \ + # Run installer + && curl -sL https://iobroker.net/install.sh | bash - \ # Deleting UUID from build && iobroker unsetup -y \ # Backup initial ioBroker and userscript folder diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index c79419c..798904c 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -10,6 +10,7 @@ echo 'starting' > /opt/scripts/.docker_config/.healthcheck set +u adminport=$IOB_ADMINPORT avahi=$AVAHI +backitup=$IOB_BACKITUP_EXTDB debug=$DEBUG multihost=$IOB_MULTIHOST offlinemode=$OFFLINE_MODE @@ -64,6 +65,7 @@ echo "----- Environment Variables if [[ "$adminport" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" IOB_ADMINPORT: $adminport)" && echo " -----"; fi if [[ "$avahi" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" AVAHI: $avahi)" && echo " -----"; fi if [[ "$debug" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" DEBUG: $debug)" && echo " -----"; fi +if [[ "$backitup" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" IOB_BACKITUP_EXTDB: $backitup)" && echo " -----"; fi if [[ "$multihost" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" IOB_MULTIHOST: $multihost)" && echo " -----"; fi if [[ "$objectsdbhost" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" IOB_OBJECTSDB_HOST: $objectsdbhost)" && echo " -----"; fi if [[ "$objectsdbport" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" IOB_OBJECTSDB_PORT: $objectsdbport)" && echo " -----"; fi @@ -249,7 +251,7 @@ else fi ##### -# STEP 4 - Setting up prerequisites for some ioBroker-adapters +# STEP 4 - Setting up special sessting for ioBroker-adapters ##### echo "$(printf -- '-%.0s' {1..80})" echo "----- Step 4 of 5: Applying special settings -----" @@ -274,6 +276,14 @@ if [[ "$adminport" != "" ]]; then fi fi +# Checking ENV for Backitup (external database backups) +if [[ "$backitup" == "true" ]]; then + echo -n 'IOB_BACKITUP_EXTDB is \"true\". Unlocking features...' + echo 'true' > /opt/scripts/.docker_config/.backitup + echo 'Done.' + echo ' ' +fi + # Checking ENV for AVAHI if [[ "$avahi" = "true" && "$offlinemode" = "true" ]]; then echo 'AVAHI is \"true\", but OFFLINE_MODE is also \"true\". Skipping Avahi daemon setup.' From 183403a8b3fc6002d43b1f5362cff76b8eb525b7 Mon Sep 17 00:00:00 2001 From: buanet Date: Mon, 7 Nov 2022 18:10:10 +0100 Subject: [PATCH 02/15] extend debug logging --- CHANGELOG.md | 1 + debian/scripts/iobroker_startup.sh | 64 ++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a91f51..b4f2dcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changelog ### v7.2.0-beta.1 (coming soon) +* add some more DEBUG messages to log * add env IOB_BACKITUP_EXTDB to unlock external db backups in backitup adapter * reorder dockerfile steps to fulfill ioBroker Docker check diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 798904c..f4db7a0 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -82,6 +82,19 @@ if [[ "$zwave" != "" ]]; then echo -n "----- " && echo -n "$( echo "$(printf -- '-%.0s' {1..80})" echo ' ' +# Debug loggin notice +if [[ "$debug" == "true" ]]; then + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "!!!! DEBUG LOG ACTIVE !!!!" + echo "!!!! Environment variable DEBUG is set to true. !!!!" + echo "!!!! This will extend the logging output and may slow down container start. !!!!" + echo "!!!! Please make sure to deactivate if no longer needed. !!!!" + echo "!!!! For more information see ioBroker Docker image documentation: !!!!" + echo "!!!! https://docs.buanet.de/iobroker-docker-image/docs/ !!!!" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo ' ' +fi + ##### # STEP 1 - Preparing container ##### @@ -177,14 +190,14 @@ elif [[ "$(ls *_backupiobroker.tar.gz 2> /dev/null | wc -l)" != "0" && "$(tar -z bash iobroker restore 0 > /opt/iobroker/log/restore.log 2>&1 echo 'Done.' echo ' ' - echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - echo "!!!!! IMPORTANT NOTE !!!!!" - echo "!!!!! The startup script restored iobroker from a backup file. !!!!!" - echo "!!!!! Check /opt/iobroker/log/restore.log to see if restore was successful. !!!!!" - echo "!!!!! When ioBroker now starts it will reinstall all Adapters automatically. !!!!!" - echo "!!!!! This might be take a looooong time! Please be patient! !!!!!" - echo "!!!!! You can view installation process by taking a look at ioBroker log. !!!!!" - echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "!!!! IMPORTANT NOTE !!!!" + echo "!!!! The startup script restored iobroker from a backup file. !!!!" + echo "!!!! Check /opt/iobroker/log/restore.log to see if restore was successful. !!!!" + echo "!!!! When ioBroker now starts it will reinstall all Adapters automatically. !!!!" + echo "!!!! This might be take a looooong time! Please be patient! !!!!" + echo "!!!! You can view installation process by taking a look at ioBroker log. !!!!" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" fi else echo "There is data detected in /opt/iobroker but it looks like it is no instance of ioBroker or a valid backup file!" @@ -247,9 +260,41 @@ else 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) + echo ' ' fi fi +# extended debug output +if [[ "$debug" == "true" ]]; then + echo "[DEBUG] Some more ioBroker debug information" + echo ' ' + # get information and send to array + IFS=$'\n' + instances_array=($(iob list instances)) + repos_array=($(iob repo list)) + updates_array=($(iob update)) + # list iob instances + echo "[DEBUG] ##### iobroker list instances #####" + for i in ${instances_array[@]} + do + echo "[DEBUG]" $i + done + echo ' ' + echo "[DEBUG] ##### iobroker repo list #####" + for i in ${repos_array[@]} + do + echo "[DEBUG]" $i + done + echo ' ' + echo "[DEBUG] ##### iobroker update #####" + for i in ${updates_array[@]} + do + echo "[DEBUG]" $i + done + echo ' ' + unset IFS +fi + ##### # STEP 4 - Setting up special sessting for ioBroker-adapters ##### @@ -316,6 +361,9 @@ if [[ "$usbdevices" != "" && "$usbdevices" != "none" ]]; then chown root:dialout $i chmod g+rw $i echo 'Done.' + if [[ "$debug" == "true" ]]; then + echo "[DEBUG] Permissions set to: " $(ls -al $i) + fi done echo ' ' fi From 2ead534cfa7279c3322b471cdf99f5b19f554da3 Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 8 Nov 2022 20:21:25 +0100 Subject: [PATCH 03/15] add env to disable permission check --- CHANGELOG.md | 1 + debian/scripts/iobroker_startup.sh | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4f2dcb..3a3f281 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changelog ### v7.2.0-beta.1 (coming soon) +* add env PERMISSION_CHECK ([#251](https://github.com/buanet/ioBroker.docker/issues/251)) * add some more DEBUG messages to log * add env IOB_BACKITUP_EXTDB to unlock external db backups in backitup adapter * reorder dockerfile steps to fulfill ioBroker Docker check diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index f4db7a0..9410d9e 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -18,6 +18,7 @@ objectsdbhost=$IOB_OBJECTSDB_HOST objectsdbport=$IOB_OBJECTSDB_PORT objectsdbtype=$IOB_OBJECTSDB_TYPE packages=$PACKAGES +permissioncheck=$PERMISSION_CHECK setgid=$SETGID setuid=$SETUID statesdbhost=$IOB_STATESDB_HOST @@ -219,11 +220,16 @@ echo "$(printf -- '-%.0s' {1..80})" echo ' ' # (Re)Setting permissions to "/opt/iobroker" and "/opt/scripts" -echo -n "(Re)setting permissions (This might take a while! Please be patient!)... " - chown -R $setuid:$setgid /opt/iobroker - chown -R $setuid:$setgid /opt/scripts -echo 'Done.' -echo ' ' +if [[ "$permissioncheck" == "false" ]]; then + echo "PERMISSION_CHECK is set to false. Use this at your own risk!" + echo ' ' +else + echo -n "(Re)setting permissions (This might take a while! Please be patient!)... " + chown -R $setuid:$setgid /opt/iobroker + chown -R $setuid:$setgid /opt/scripts + echo 'Done.' + echo ' ' +fi # Backing up original iobroker-file and changing sudo to gosu echo -n "Fixing \"sudo-bug\" by replacing sudo with gosu... " From 9e742707051bda4afee1f157fc3fa3ff4bc27781 Mon Sep 17 00:00:00 2001 From: buanet Date: Thu, 10 Nov 2022 11:51:23 +0100 Subject: [PATCH 04/15] fix logging --- debian/scripts/iobroker_startup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index e819a5b..89090e4 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -90,6 +90,7 @@ if [[ "$statesdbport" != "" ]]; then echo -n "----- " && echo if [[ "$statesdbtype" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" IOB_STATESDB_TYPE: $statesdbtype)" && echo " -----"; fi if [[ "$offlinemode" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" OFFLINE_MODE: $offlinemode)" && echo " -----"; fi if [[ "$packages" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" PACKAGES: "$packages")" && echo " -----"; fi +if [[ "$permissioncheck" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" PERMISSION_CHECK: $permissioncheck)" && echo " -----"; fi if [[ "$setgid" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" SETGID: $setgid)" && echo " -----"; fi if [[ "$setuid" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" SETUID: $setuid)" && echo " -----"; fi if [[ "$usbdevices" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" USBDEVICES: $usbdevices)" && echo " -----"; fi From eba7e6c5f9c276ff7773f793238357323d99c34a Mon Sep 17 00:00:00 2001 From: buanet Date: Sat, 12 Nov 2022 21:48:26 +0100 Subject: [PATCH 05/15] switch from apt-get to apt --- CHANGELOG.md | 1 + debian/node16/Dockerfile | 10 +++++----- debian/node18/Dockerfile | 10 +++++----- debian/scripts/setup_packages.sh | 10 +++++----- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eda1e4..6a663cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changelog ### v7.2.0-beta.1 (coming soon) +* switch from apt-get to apt * add env PERMISSION_CHECK ([#251](https://github.com/buanet/ioBroker.docker/issues/251)) * add some more DEBUG messages to log * add env IOB_BACKITUP_EXTDB to unlock external db backups in backitup adapter diff --git a/debian/node16/Dockerfile b/debian/node16/Dockerfile index 32323ae..40cb8a8 100644 --- a/debian/node16/Dockerfile +++ b/debian/node16/Dockerfile @@ -13,7 +13,7 @@ LABEL org.opencontainers.image.title="Official ioBroker Docker Image" \ ENV DEBIAN_FRONTEND noninteractive # Install prerequisites (including node) and generating locales -RUN apt-get update && apt-get install -y \ +RUN apt update && apt install -y \ apt-utils \ cifs-utils \ curl \ @@ -32,7 +32,7 @@ RUN apt-get update && apt-get install -y \ wget \ # Install node && curl -sL https://deb.nodesource.com/setup_16.x | bash \ - && apt-get update && apt-get install -y nodejs \ + && apt update && apt install -y nodejs \ # Install node-gyp && npm install -g node-gyp \ # Generating locales @@ -68,9 +68,9 @@ RUN mkdir -p /opt/scripts/.docker_config/ \ && chown root:iobroker /usr/sbin/gosu \ && chmod +s /usr/sbin/gosu \ # Clean up installation cache - && apt-get autoclean -y \ - && apt-get autoremove \ - && apt-get clean \ + && apt autoclean -y \ + && apt autoremove \ + && apt clean \ && rm -rf /tmp/* /var/tmp/* \ && rm -rf /root/.cache/* /root/.npm/* \ && rm -rf /var/lib/apt/lists/* diff --git a/debian/node18/Dockerfile b/debian/node18/Dockerfile index 61130a7..8907c78 100644 --- a/debian/node18/Dockerfile +++ b/debian/node18/Dockerfile @@ -13,7 +13,7 @@ LABEL org.opencontainers.image.title="Official ioBroker Docker Image" \ ENV DEBIAN_FRONTEND noninteractive # Install prerequisites (including node) and generating locales -RUN apt-get update && apt-get install -y \ +RUN apt update && apt install -y \ apt-utils \ cifs-utils \ curl \ @@ -32,7 +32,7 @@ RUN apt-get update && apt-get install -y \ wget \ # Install node && curl -sL https://deb.nodesource.com/setup_18.x | bash \ - && apt-get update && apt-get install -y nodejs \ + && apt update && apt install -y nodejs \ # Install node-gyp && npm install -g node-gyp \ # Generating locales @@ -68,9 +68,9 @@ RUN mkdir -p /opt/scripts/.docker_config/ \ && chown root:iobroker /usr/sbin/gosu \ && chmod +s /usr/sbin/gosu \ # Clean up installation cache - && apt-get autoclean -y \ - && apt-get autoremove \ - && apt-get clean \ + && apt autoclean -y \ + && apt autoremove \ + && apt clean \ && rm -rf /tmp/* /var/tmp/* \ && rm -rf /root/.cache/* /root/.npm/* \ && rm -rf /var/lib/apt/lists/* diff --git a/debian/scripts/setup_packages.sh b/debian/scripts/setup_packages.sh index da1ca2f..2b42ab8 100644 --- a/debian/scripts/setup_packages.sh +++ b/debian/scripts/setup_packages.sh @@ -2,13 +2,13 @@ if [ $1 == "-install" ] then - apt-get -qq update + apt -qq update packages=$(cat /opt/scripts/.docker_config/.packages) for i in $packages; do if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then echo "$i is not installed. Installing..." - sudo apt-get -qq -y install $i + sudo apt -qq -y install $i echo "Done." else echo "$i is already installed." @@ -16,15 +16,15 @@ then done elif [ $1 == "-update" ] then - apt-get -qq update - apt-get -qq -y upgrade + apt -qq update + apt -qq -y upgrade else echo "No paramerter found!" exit 1 fi # Silent Cleanup -apt-get -qq autoclean -y && apt-get -qq autoremove && apt-get -qq clean +apt -qq autoclean -y && apt -qq autoremove && apt -qq clean rm -rf /tmp/* /var/tmp/* && rm -rf /root/.cache/* && rm -rf /var/lib/apt/lists/* && rm -f /opt/scripts/.docker_config/.packages exit 0 From b18d22ddf8ff6ffad96187dfa4a0cf71775f09b9 Mon Sep 17 00:00:00 2001 From: buanet Date: Sun, 13 Nov 2022 20:51:11 +0100 Subject: [PATCH 06/15] Revert "switch from apt-get to apt" This reverts commit eba7e6c5f9c276ff7773f793238357323d99c34a. --- CHANGELOG.md | 1 - debian/node16/Dockerfile | 10 +++++----- debian/node18/Dockerfile | 10 +++++----- debian/scripts/setup_packages.sh | 10 +++++----- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a663cc..1eda1e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,6 @@ ## Changelog ### v7.2.0-beta.1 (coming soon) -* switch from apt-get to apt * add env PERMISSION_CHECK ([#251](https://github.com/buanet/ioBroker.docker/issues/251)) * add some more DEBUG messages to log * add env IOB_BACKITUP_EXTDB to unlock external db backups in backitup adapter diff --git a/debian/node16/Dockerfile b/debian/node16/Dockerfile index 40cb8a8..32323ae 100644 --- a/debian/node16/Dockerfile +++ b/debian/node16/Dockerfile @@ -13,7 +13,7 @@ LABEL org.opencontainers.image.title="Official ioBroker Docker Image" \ ENV DEBIAN_FRONTEND noninteractive # Install prerequisites (including node) and generating locales -RUN apt update && apt install -y \ +RUN apt-get update && apt-get install -y \ apt-utils \ cifs-utils \ curl \ @@ -32,7 +32,7 @@ RUN apt update && apt install -y \ wget \ # Install node && curl -sL https://deb.nodesource.com/setup_16.x | bash \ - && apt update && apt install -y nodejs \ + && apt-get update && apt-get install -y nodejs \ # Install node-gyp && npm install -g node-gyp \ # Generating locales @@ -68,9 +68,9 @@ RUN mkdir -p /opt/scripts/.docker_config/ \ && chown root:iobroker /usr/sbin/gosu \ && chmod +s /usr/sbin/gosu \ # Clean up installation cache - && apt autoclean -y \ - && apt autoremove \ - && apt clean \ + && apt-get autoclean -y \ + && apt-get autoremove \ + && apt-get clean \ && rm -rf /tmp/* /var/tmp/* \ && rm -rf /root/.cache/* /root/.npm/* \ && rm -rf /var/lib/apt/lists/* diff --git a/debian/node18/Dockerfile b/debian/node18/Dockerfile index 8907c78..61130a7 100644 --- a/debian/node18/Dockerfile +++ b/debian/node18/Dockerfile @@ -13,7 +13,7 @@ LABEL org.opencontainers.image.title="Official ioBroker Docker Image" \ ENV DEBIAN_FRONTEND noninteractive # Install prerequisites (including node) and generating locales -RUN apt update && apt install -y \ +RUN apt-get update && apt-get install -y \ apt-utils \ cifs-utils \ curl \ @@ -32,7 +32,7 @@ RUN apt update && apt install -y \ wget \ # Install node && curl -sL https://deb.nodesource.com/setup_18.x | bash \ - && apt update && apt install -y nodejs \ + && apt-get update && apt-get install -y nodejs \ # Install node-gyp && npm install -g node-gyp \ # Generating locales @@ -68,9 +68,9 @@ RUN mkdir -p /opt/scripts/.docker_config/ \ && chown root:iobroker /usr/sbin/gosu \ && chmod +s /usr/sbin/gosu \ # Clean up installation cache - && apt autoclean -y \ - && apt autoremove \ - && apt clean \ + && apt-get autoclean -y \ + && apt-get autoremove \ + && apt-get clean \ && rm -rf /tmp/* /var/tmp/* \ && rm -rf /root/.cache/* /root/.npm/* \ && rm -rf /var/lib/apt/lists/* diff --git a/debian/scripts/setup_packages.sh b/debian/scripts/setup_packages.sh index 2b42ab8..da1ca2f 100644 --- a/debian/scripts/setup_packages.sh +++ b/debian/scripts/setup_packages.sh @@ -2,13 +2,13 @@ if [ $1 == "-install" ] then - apt -qq update + apt-get -qq update packages=$(cat /opt/scripts/.docker_config/.packages) for i in $packages; do if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then echo "$i is not installed. Installing..." - sudo apt -qq -y install $i + sudo apt-get -qq -y install $i echo "Done." else echo "$i is already installed." @@ -16,15 +16,15 @@ then done elif [ $1 == "-update" ] then - apt -qq update - apt -qq -y upgrade + apt-get -qq update + apt-get -qq -y upgrade else echo "No paramerter found!" exit 1 fi # Silent Cleanup -apt -qq autoclean -y && apt -qq autoremove && apt -qq clean +apt-get -qq autoclean -y && apt-get -qq autoremove && apt-get -qq clean rm -rf /tmp/* /var/tmp/* && rm -rf /root/.cache/* && rm -rf /var/lib/apt/lists/* && rm -f /opt/scripts/.docker_config/.packages exit 0 From 5778c620977d9c8e35bea5e4097e1a77bda86023 Mon Sep 17 00:00:00 2001 From: buanet Date: Thu, 24 Nov 2022 17:15:09 +0100 Subject: [PATCH 07/15] add aliases in maintenance script --- debian/scripts/iobroker_startup.sh | 2 +- debian/scripts/maintenance.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 89090e4..907bd5e 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -290,7 +290,7 @@ fi # extended debug output if [[ "$debug" == "true" ]]; then - echo "[DEBUG] Some more ioBroker debug information" + echo "[DEBUG] Collecting some more ioBroker debug information..." echo ' ' # get information and send to array IFS=$'\n' diff --git a/debian/scripts/maintenance.sh b/debian/scripts/maintenance.sh index 13c6852..c0f0826 100644 --- a/debian/scripts/maintenance.sh +++ b/debian/scripts/maintenance.sh @@ -227,7 +227,7 @@ for arg in "$@"; do help|-h|--help) run=(display_help) ;; - status) + status|stat|s) run=(maintenance_status) ;; on) @@ -236,10 +236,10 @@ for arg in "$@"; do off) run=(disable_maintenance) ;; - upgrade) + upgrade|upgr|u) run=(upgrade_jscontroller) ;; - restart) + restart|rest|r) run=(restart_container) ;; -y|--yes) From 2102d1829934152394a923bb2f34708a3712c549 Mon Sep 17 00:00:00 2001 From: buanet Date: Thu, 24 Nov 2022 17:49:48 +0100 Subject: [PATCH 08/15] add error handling for usb devices --- CHANGELOG.md | 2 ++ debian/scripts/iobroker_startup.sh | 52 +++++++++++++++++------------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eda1e4..352e4a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## Changelog ### v7.2.0-beta.1 (coming soon) +* add error handling for usb devices +* add aliases to maintenance script * add env PERMISSION_CHECK ([#251](https://github.com/buanet/ioBroker.docker/issues/251)) * add some more DEBUG messages to log * add env IOB_BACKITUP_EXTDB to unlock external db backups in backitup adapter diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 907bd5e..a5dbd40 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -40,6 +40,8 @@ stop_on_error() { echo "[DEBUG] IoBroker is not running!" tail -f /dev/null else + echo ' ' + echo "This Script will exit now." exit 1 fi } @@ -52,14 +54,14 @@ echo ' ' echo "$(printf -- '-%.0s' {1..80})" echo -n "$(printf -- '-%.0s' {1..25})" && echo -n " "$dati" " && echo "$(printf -- '-%.0s' {1..25})" echo "$(printf -- '-%.0s' {1..80})" -echo '----- -----' +echo "----- -----" echo "----- ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗ ███████╗ ██████╗ -----" echo "----- ██║ ██╔═══██╗ ██╔══██╗ ██╔══██╗ ██╔═══██╗ ██║ ██╔╝ ██╔════╝ ██╔══██╗ -----" echo "----- ██║ ██║ ██║ ██████╔╝ ██████╔╝ ██║ ██║ █████╔╝ █████╗ ██████╔╝ -----" echo "----- ██║ ██║ ██║ ██╔══██╗ ██╔══██╗ ██║ ██║ ██╔═██╗ ██╔══╝ ██╔══██╗ -----" echo "----- ██║ ╚██████╔╝ ██████╔╝ ██║ ██║ ╚██████╔╝ ██║ ██╗ ███████╗ ██║ ██║ -----" echo "----- ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ -----" -echo '----- -----' +echo "----- -----" echo "----- Welcome to your ioBroker Docker container! -----" echo "----- Startupscript is now running! -----" echo "----- Please be patient! -----" @@ -123,20 +125,20 @@ echo ' ' if [[ -f /opt/.firstrun ]]; then # Updating Linux packages if [[ "$offlinemode" = "true" ]]; then - echo 'OFFLINE_MODE is \"true\". Skipping Linux package updates on first run.' + echo "OFFLINE_MODE is \"true\". Skipping Linux package updates on first run." echo ' ' else - echo 'Updating Linux packages on first run...' + echo "Updating Linux packages on first run..." bash /opt/scripts/setup_packages.sh -update echo 'Done.' echo ' ' fi # Installing packages from ENV if [[ "$packages" != "" && "$offlinemode" = "true" ]]; then - echo 'PACKAGES is set, but OFFLINE_MODE is \"true\". Skipping Linux package installation.' + echo "PACKAGES is set, but OFFLINE_MODE is \"true\". Skipping Linux package installation." echo ' ' elif [[ "$packages" != "" ]]; then - echo 'PACKAGES is set. Installing additional Linux packages.' + echo "PACKAGES is set. Installing additional Linux packages." echo "Checking the following packages:" $packages"..." echo $packages > /opt/scripts/.docker_config/.packages bash /opt/scripts/setup_packages.sh -install @@ -151,7 +153,7 @@ if [[ -f /opt/.firstrun ]]; then echo 'Done.' echo ' ' else - echo 'This is not the first run of this container. Skipping first run preparation.' + echo "This is not the first run of this container. Skipping first run preparation." echo ' ' fi @@ -347,7 +349,7 @@ fi # Checking ENV for Backitup (external database backups) if [[ "$backitup" == "true" ]]; then - echo -n 'IOB_BACKITUP_EXTDB is \"true\". Unlocking features...' + echo -n "IOB_BACKITUP_EXTDB is \"true\". Unlocking features..." echo 'true' > /opt/scripts/.docker_config/.backitup echo 'Done.' echo ' ' @@ -355,9 +357,9 @@ fi # Checking ENV for AVAHI if [[ "$avahi" = "true" && "$offlinemode" = "true" ]]; then - echo 'AVAHI is \"true\", but OFFLINE_MODE is also \"true\". Skipping Avahi daemon setup.' + echo "AVAHI is \"true\", but OFFLINE_MODE is also \"true\". Skipping Avahi daemon setup." elif [[ "$avahi" = "true" ]]; then - echo 'AVAHI is \"true\". Running setup script...' + echo "AVAHI is \"true\". Running setup script..." chmod 755 /opt/scripts/setup_avahi.sh bash /opt/scripts/setup_avahi.sh echo 'Done.' @@ -366,9 +368,9 @@ fi # Checking ENV for Z-WAVE if [[ "$zwave" = "true" && "$offlinemode" = "true" ]]; then - echo 'ZWAVE is \"true\", but OFFLINE_MODE is also \"true\". Skipping Z-Wave setup.' + echo "ZWAVE is \"true\", but OFFLINE_MODE is also \"true\". Skipping Z-Wave setup." elif [[ "$zwave" = "true" ]]; then - echo 'ZWAVE is \"true\". Running setup script...' + echo "ZWAVE is \"true\". Running setup script..." chmod 755 /opt/scripts/setup_zwave.sh bash /opt/scripts/setup_zwave.sh echo 'Done.' @@ -377,17 +379,23 @@ fi # checking ENV for USBDEVICES if [[ "$usbdevices" != "" && "$usbdevices" != "none" ]]; then - echo 'USBDEVICES is set.' + echo "USBDEVICES is set." IFS=';' read -ra devicearray <<< "$usbdevices" for i in "${devicearray[@]}" do - echo -n "Setting permissions for "$i"... " + if [[ -f $i ]]; then + echo -n "Setting permissions for "$i"... " chown root:dialout $i chmod g+rw $i - echo 'Done.' - if [[ "$debug" == "true" ]]; then - echo "[DEBUG] Permissions set to: " $(ls -al $i) - fi + echo 'Done.' + if [[ "$debug" == "true" ]]; then echo "[DEBUG] Permissions set to: " $(ls -al $i); fi + else + echo "Looks like the device \""$i"\" does not exist." + echo "Please check your container config and start over." + echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/)." + if [[ "$debug" == "true" ]]; then echo "[DEBUG] Device info: " $(ls -al $i); fi + stop_on_error + fi done echo ' ' fi @@ -485,7 +493,7 @@ if [[ "$objectsdbtype" != "" || "$objectsdbhost" != "" || "$objectsdbport" != "" else echo "IOB_OBJECTSDB_PORT is set and value meets detected ioBroker installation." fi - echo "Done." + echo 'Done.' echo ' ' fi @@ -519,7 +527,7 @@ if [[ "$statesdbtype" != "" || "$statesdbhost" != "" || "$statesdbport" != "" ]] else echo "IOB_STATESDB_PORT is set and value meets detected ioBroker installation." fi - echo "Done." + echo 'Done.' echo ' ' fi @@ -537,14 +545,14 @@ elif [[ -f /opt/userscripts/userscript_firststart.sh || -f /opt/userscripts/user echo "Running userscript_firststart.sh..." chmod 755 /opt/userscripts/userscript_firststart.sh bash /opt/userscripts/userscript_firststart.sh - echo "Done." + echo 'Done.' echo ' ' fi if [[ -f /opt/userscripts/userscript_everystart.sh ]]; then echo "Userscript for every start detected. Running userscript_everystart.sh..." chmod 755 /opt/userscripts/userscript_everystart.sh bash /opt/userscripts/userscript_everystart.sh - echo "Done." + echo 'Done.' echo ' ' fi fi From eb32aa20b1a80b6760b0059024511b274070098a Mon Sep 17 00:00:00 2001 From: buanet Date: Thu, 24 Nov 2022 21:28:54 +0100 Subject: [PATCH 09/15] small fixes --- debian/scripts/iobroker_startup.sh | 31 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index a5dbd40..434bb62 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -128,7 +128,7 @@ if [[ -f /opt/.firstrun ]]; then echo "OFFLINE_MODE is \"true\". Skipping Linux package updates on first run." echo ' ' else - echo "Updating Linux packages on first run..." + echo "Updating Linux packages on first run... " bash /opt/scripts/setup_packages.sh -update echo 'Done.' echo ' ' @@ -139,7 +139,7 @@ if [[ -f /opt/.firstrun ]]; then echo ' ' elif [[ "$packages" != "" ]]; then echo "PACKAGES is set. Installing additional Linux packages." - echo "Checking the following packages:" $packages"..." + echo "Checking the following packages:" $packages"... " echo $packages > /opt/scripts/.docker_config/.packages bash /opt/scripts/setup_packages.sh -install echo 'Done.' @@ -291,8 +291,8 @@ else fi # extended debug output -if [[ "$debug" == "true" ]]; then - echo "[DEBUG] Collecting some more ioBroker debug information..." +if [[ "$debug" == "true" && "$multihost" != "slave" ]]; then + echo "[DEBUG] Collecting some more ioBroker debug information... " echo ' ' # get information and send to array IFS=$'\n' @@ -349,7 +349,7 @@ fi # Checking ENV for Backitup (external database backups) if [[ "$backitup" == "true" ]]; then - echo -n "IOB_BACKITUP_EXTDB is \"true\". Unlocking features..." + echo -n "IOB_BACKITUP_EXTDB is \"true\". Unlocking features... " echo 'true' > /opt/scripts/.docker_config/.backitup echo 'Done.' echo ' ' @@ -359,7 +359,7 @@ fi if [[ "$avahi" = "true" && "$offlinemode" = "true" ]]; then echo "AVAHI is \"true\", but OFFLINE_MODE is also \"true\". Skipping Avahi daemon setup." elif [[ "$avahi" = "true" ]]; then - echo "AVAHI is \"true\". Running setup script..." + echo "AVAHI is \"true\". Running setup script... " chmod 755 /opt/scripts/setup_avahi.sh bash /opt/scripts/setup_avahi.sh echo 'Done.' @@ -370,7 +370,7 @@ fi if [[ "$zwave" = "true" && "$offlinemode" = "true" ]]; then echo "ZWAVE is \"true\", but OFFLINE_MODE is also \"true\". Skipping Z-Wave setup." elif [[ "$zwave" = "true" ]]; then - echo "ZWAVE is \"true\". Running setup script..." + echo "ZWAVE is \"true\". Running setup script... " chmod 755 /opt/scripts/setup_zwave.sh bash /opt/scripts/setup_zwave.sh echo 'Done.' @@ -393,7 +393,6 @@ if [[ "$usbdevices" != "" && "$usbdevices" != "none" ]]; then echo "Looks like the device \""$i"\" does not exist." echo "Please check your container config and start over." echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/)." - if [[ "$debug" == "true" ]]; then echo "[DEBUG] Device info: " $(ls -al $i); fi stop_on_error fi done @@ -402,7 +401,7 @@ fi # Checking ENV for multihost setup if [[ "$multihost" != "" ]]; then - echo "Checking for multihost settings..." + echo "Checking for multihost settings... " # Configuring objects db host if [[ "$multihost" = "master" && "$objectsdbtype" = "" && "$objectsdbhost" = "" && "$objectsdbport" = "" ]]; then echo "IOB_MULTIHOST is set to \"master\" and no external objects db is set." @@ -465,7 +464,7 @@ fi # Checking ENVs for custom setup of objects db if [[ "$objectsdbtype" != "" || "$objectsdbhost" != "" || "$objectsdbport" != "" ]]; then - echo "Checking for custom objects db settings ..." + echo "Checking for custom objects db settings ... " if [[ "$objectsdbtype" != "$(jq -r '.objects.type' /opt/iobroker/iobroker-data/iobroker.json)" ]]; then echo "IOB_OBJECTSDB_TYPE is set and value is different from detected ioBroker installation." echo -n "Setting type of objects db to \""$objectsdbtype"\"... " @@ -499,7 +498,7 @@ fi # Checking ENVs for custom setup of states db if [[ "$statesdbtype" != "" || "$statesdbhost" != "" || "$statesdbport" != "" ]]; then - echo "Checking for custom states db settings..." + echo "Checking for custom states db settings... " if [[ "$statesdbtype" != "$(jq -r '.states.type' /opt/iobroker/iobroker-data/iobroker.json)" ]]; then echo "IOB_STATESDB_TYPE is set and value is different from detected ioBroker installation." echo -n "Setting type of states db to \""$statesdbtype"\"... " @@ -542,14 +541,14 @@ if [[ `find /opt/userscripts -type f | wc -l` -lt 1 ]]; then elif [[ -f /opt/userscripts/userscript_firststart.sh || -f /opt/userscripts/userscript_everystart.sh ]]; then if [[ -f /opt/userscripts/userscript_firststart.sh && -f /opt/.firstrun ]]; then echo "Userscript for first start detected and this is the first start of a new container." - echo "Running userscript_firststart.sh..." + echo "Running userscript_firststart.sh... " chmod 755 /opt/userscripts/userscript_firststart.sh bash /opt/userscripts/userscript_firststart.sh echo 'Done.' echo ' ' fi if [[ -f /opt/userscripts/userscript_everystart.sh ]]; then - echo "Userscript for every start detected. Running userscript_everystart.sh..." + echo "Userscript for every start detected. Running userscript_everystart.sh... " chmod 755 /opt/userscripts/userscript_everystart.sh bash /opt/userscripts/userscript_everystart.sh echo 'Done.' @@ -569,7 +568,7 @@ echo "$(printf -- '-%.0s' {1..80})" echo "----- Step 5 of 5: ioBroker startup -----" echo "$(printf -- '-%.0s' {1..80})" echo ' ' -echo "Starting ioBroker..." +echo "Starting ioBroker... " echo ' ' echo "##### #### ### ## # iobroker.js-controller log output # ## ### #### #####" @@ -580,7 +579,7 @@ echo "running" > /opt/scripts/.docker_config/.healthcheck shut_down() { echo ' ' echo "Recived termination signal (SIGTERM)." - echo "Shutting down ioBroker..." + echo "Shutting down ioBroker... " local status timeout @@ -598,7 +597,7 @@ shut_down() { # pgrep exits with status 1 when there are no matches while pgrep -u iobroker > /dev/null; (( $? != 1 )); do if (($(date +%s) > timeout)); then - echo -e '\nTimeout reached. Killing remaining processes...' + echo -e '\nTimeout reached. Killing remaining processes... ' pkill --signal SIGKILL -u iobroker echo 'Done. Have a nice day!' exit From bf348c0c5b49b39c3e8f3521ce90b99640c76fb3 Mon Sep 17 00:00:00 2001 From: buanet Date: Thu, 24 Nov 2022 21:46:18 +0100 Subject: [PATCH 10/15] testing --- debian/scripts/iobroker_startup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 434bb62..3459078 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -391,6 +391,7 @@ if [[ "$usbdevices" != "" && "$usbdevices" != "none" ]]; then if [[ "$debug" == "true" ]]; then echo "[DEBUG] Permissions set to: " $(ls -al $i); fi else echo "Looks like the device \""$i"\" does not exist." + ls -al $i echo "Please check your container config and start over." echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/)." stop_on_error From d6ac4c24459f27d79c683efa3da01f436ff1fdb8 Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 29 Nov 2022 21:02:47 +0100 Subject: [PATCH 11/15] remove ls, change log output --- debian/scripts/iobroker_startup.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 3459078..6147823 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -391,9 +391,8 @@ if [[ "$usbdevices" != "" && "$usbdevices" != "none" ]]; then if [[ "$debug" == "true" ]]; then echo "[DEBUG] Permissions set to: " $(ls -al $i); fi else echo "Looks like the device \""$i"\" does not exist." - ls -al $i - echo "Please check your container config and start over." - echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/)." + echo "Did you mount it correctly by using the \"--device\" flag?" + echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/#mounting-usb-devices)." stop_on_error fi done From a8a3631665d4a285f8160cca3610b8e5de45246f Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 29 Nov 2022 22:56:30 +0100 Subject: [PATCH 12/15] 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 6147823..e494931 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -391,7 +391,7 @@ if [[ "$usbdevices" != "" && "$usbdevices" != "none" ]]; then if [[ "$debug" == "true" ]]; then echo "[DEBUG] Permissions set to: " $(ls -al $i); fi else echo "Looks like the device \""$i"\" does not exist." - echo "Did you mount it correctly by using the \"--device\" flag?" + echo "Did you mount it correctly by using the \"--device\" option?" echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/#mounting-usb-devices)." stop_on_error fi From 842e12092087c8a613d61940a630ca53057fe820 Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 29 Nov 2022 23:07:28 +0100 Subject: [PATCH 13/15] fix device check --- 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 e494931..cbaa92a 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -383,12 +383,12 @@ if [[ "$usbdevices" != "" && "$usbdevices" != "none" ]]; then IFS=';' read -ra devicearray <<< "$usbdevices" for i in "${devicearray[@]}" do - if [[ -f $i ]]; then + if [[ -e $i ]]; then echo -n "Setting permissions for "$i"... " chown root:dialout $i chmod g+rw $i echo 'Done.' - if [[ "$debug" == "true" ]]; then echo "[DEBUG] Permissions set to: " $(ls -al $i); fi + if [[ "$debug" == "true" ]]; then echo "[DEBUG] Permissions set: " $(ls -al $i); fi else echo "Looks like the device \""$i"\" does not exist." echo "Did you mount it correctly by using the \"--device\" option?" From f609f0df8eb9d1518b427246b798915b4e3bd4d2 Mon Sep 17 00:00:00 2001 From: buanet Date: Wed, 30 Nov 2022 13:48:35 +0100 Subject: [PATCH 14/15] fix restart in maintenance script --- debian/scripts/maintenance.sh | 54 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/debian/scripts/maintenance.sh b/debian/scripts/maintenance.sh index c0f0826..c2b4a62 100644 --- a/debian/scripts/maintenance.sh +++ b/debian/scripts/maintenance.sh @@ -158,33 +158,6 @@ upgrade_jscontroller() { pkill -u root } -# restart container -restart_container() { - echo 'You are now going to call a restart of your container.' - echo 'Restarting will work depending on the configured restart policy.' - - if [[ "$autoconfirm" != yes ]]; then - local reply - - read -rp 'Do you want to continue [yes/no]? ' reply - if [[ "$reply" == y || "$reply" == Y || "$reply" == yes ]]; then - : # continue - else - return 1 - fi - else - echo 'This command was already confirmed by the -y or --yes option.' - fi - - echo -n 'Stopping ioBroker...' - stop_iob - - echo 'Container will be stopped or restarted in 5 seconds...' - sleep 5 - echo 'stopping' > "$healthcheck" - pkill -u root -} - # stop iobroker and wait until all processes stopped or pkill_timeout is reached stop_iob() { local status timeout @@ -217,6 +190,33 @@ stop_iob() { echo -e '\nDone.' } +# restart container +restart_container() { + echo 'You are now going to call a restart of your container.' + echo 'Restarting will work depending on the configured restart policy.' + + if [[ "$autoconfirm" != yes ]]; then + local reply + + read -rp 'Do you want to continue [yes/no]? ' reply + if [[ "$reply" == y || "$reply" == Y || "$reply" == yes ]]; then + : # continue + else + return 1 + fi + else + echo 'This command was already confirmed by the -y or --yes option.' + fi + + echo -n 'Stopping ioBroker...' + stop_iob + + echo 'Container will be stopped or restarted in 5 seconds...' + sleep 5 + echo 'stopping' > "$healthcheck" + pkill -u root +} + # parsing commands and options # default command to run unless another was given From b597178246e4bb002ccfe579cd9b4985fbeaae82 Mon Sep 17 00:00:00 2001 From: buanet Date: Wed, 30 Nov 2022 13:58:24 +0100 Subject: [PATCH 15/15] prepare beta --- CHANGELOG.md | 3 ++- docs/README_docker_hub_buanet.md | 10 ++++------ docs/README_docker_hub_iobroker.md | 10 ++++------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 352e4a5..fc3c863 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changelog -### v7.2.0-beta.1 (coming soon) +### v7.2.0-beta.1 (30.11.2022) +* fix restart option in maintenance script * add error handling for usb devices * add aliases to maintenance script * add env PERMISSION_CHECK ([#251](https://github.com/buanet/ioBroker.docker/issues/251)) diff --git a/docs/README_docker_hub_buanet.md b/docs/README_docker_hub_buanet.md index 84f49b3..888e5f6 100644 --- a/docs/README_docker_hub_buanet.md +++ b/docs/README_docker_hub_buanet.md @@ -29,18 +29,16 @@ New major image versions (e.g. v4, v5, v6) always come with a new major version It is highly recommended not to use the `latest` tag for production, especially when using any kind of automated update procedure like watchtower. Please use the `latest-v[X]` tag instead. ### Node 16 versions -* [`v7.0.1`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`latest-v7`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`latest`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile) +* [`v7.1.2`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile), [`v7.1.2-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile), [`v7.1.2-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile), [`v7.1.2-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile), [`latest-v7`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile), [`latest`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile) +* [`v7.1.1`](https://github.com/buanet/ioBroker.docker/blob/v7.1.1/debian/node16/Dockerfile), [`v7.1.1-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.1.1/debian/node16/Dockerfile), [`v7.1.1-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.1.1/debian/node16/Dockerfile), [`v7.1.1-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.1.1/debian/node16/Dockerfile) +* [`v7.1.0`](https://github.com/buanet/ioBroker.docker/blob/v7.1.0/debian/node16/Dockerfile), [`v7.1.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.1.0/debian/node16/Dockerfile), [`v7.1.0-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.1.0/debian/node16/Dockerfile), [`v7.1.0-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.1.0/debian/node16/Dockerfile) +* [`v7.0.1`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile) * [`v7.0.0`](https://github.com/buanet/ioBroker.docker/blob/v7.0.0/debian/node16/Dockerfile), [`v7.0.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.0.0/debian/node16/Dockerfile), [`v7.0.0-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.0.0/debian/node16/Dockerfile), [`v7.0.0-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.0.0/debian/node16/Dockerfile) ### Node 14 versions * [`v6.1.0`](https://github.com/buanet/ioBroker.docker/blob/v6.1.0/debian/node14/Dockerfile), [`v6.1.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v6.1.0/debian/node14/Dockerfile), [`v6.1.0-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v6.1.0/debian/node14/Dockerfile), [`v6.1.0-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v6.1.0/debian/node14/Dockerfile), [`latest-v6`](https://github.com/buanet/ioBroker.docker/blob/v6.1.0/debian/node14/Dockerfile) * [`v6.0.0`](https://github.com/buanet/ioBroker.docker/blob/v6.0.0/debian/node14/Dockerfile), [`v6.0.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v6.0.0/debian/node14/Dockerfile), [`v6.0.0-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v6.0.0/debian/node14/Dockerfile), [`v6.0.0-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v6.0.0/debian/node14/Dockerfile) -### Node 12 versions -* [`v5.2.0`](https://github.com/buanet/ioBroker.docker/blob/v5.2.0/debian/node12/Dockerfile), [`v5.2.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v5.2.0/debian/node12/Dockerfile), [`v5.2.0-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v5.2.0/debian/node12/Dockerfile), [`v5.2.0-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v5.2.0/debian/node12/Dockerfile), [`latest-v5`](https://github.com/buanet/ioBroker.docker/blob/v5.2.0/debian/node12/Dockerfile) -* [`v5.1.0`](https://github.com/buanet/ioBroker.docker/blob/v5.1.0/amd64/Dockerfile), [`v5.1.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v5.1.0/amd64/Dockerfile), [`v5.1.0-armv7hf`](https://github.com/buanet/ioBroker.docker/blob/v5.1.0/armv7hf/Dockerfile), [`v5.1.0-aarch64`](https://github.com/buanet/ioBroker.docker/blob/v5.1.0/aarch64/Dockerfile) -* [`v5.0.0`](https://github.com/buanet/ioBroker.docker/blob/v5.0.0/amd64/Dockerfile), [`v5.0.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v5.0.0/amd64/Dockerfile), [`v5.0.0-armv7hf`](https://github.com/buanet/ioBroker.docker/blob/v5.0.0/armv7hf/Dockerfile), [`v5.0.0-aarch64`](https://github.com/buanet/ioBroker.docker/blob/v5.0.0/aarch64/Dockerfile) - # What is ioBroker? IoBroker is a open source IoT platform written in JavaScript that easily connects smarthome components from different manufactures. With the help of plugins (called: "adapters") ioBroker is able to communicate with a big variety of IoT hardware and services using different protocols and APIs.
diff --git a/docs/README_docker_hub_iobroker.md b/docs/README_docker_hub_iobroker.md index 4936209..c64d8d4 100644 --- a/docs/README_docker_hub_iobroker.md +++ b/docs/README_docker_hub_iobroker.md @@ -30,18 +30,16 @@ New major image versions (e.g. v4, v5, v6) always come with a new major version It is highly recommended not to use the `latest` tag for production, especially when using any kind of automated update procedure like watchtower. Please use the `latest-v[X]` tag instead. ### Node 16 versions -* [`v7.0.1`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`latest-v7`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`latest`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile) +* [`v7.1.2`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile), [`v7.1.2-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile), [`v7.1.2-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile), [`v7.1.2-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile), [`latest-v7`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile), [`latest`](https://github.com/buanet/ioBroker.docker/blob/v7.1.2/debian/node16/Dockerfile) +* [`v7.1.1`](https://github.com/buanet/ioBroker.docker/blob/v7.1.1/debian/node16/Dockerfile), [`v7.1.1-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.1.1/debian/node16/Dockerfile), [`v7.1.1-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.1.1/debian/node16/Dockerfile), [`v7.1.1-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.1.1/debian/node16/Dockerfile) +* [`v7.1.0`](https://github.com/buanet/ioBroker.docker/blob/v7.1.0/debian/node16/Dockerfile), [`v7.1.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.1.0/debian/node16/Dockerfile), [`v7.1.0-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.1.0/debian/node16/Dockerfile), [`v7.1.0-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.1.0/debian/node16/Dockerfile) +* [`v7.0.1`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile), [`v7.0.1-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.0.1/debian/node16/Dockerfile) * [`v7.0.0`](https://github.com/buanet/ioBroker.docker/blob/v7.0.0/debian/node16/Dockerfile), [`v7.0.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v7.0.0/debian/node16/Dockerfile), [`v7.0.0-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v7.0.0/debian/node16/Dockerfile), [`v7.0.0-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v7.0.0/debian/node16/Dockerfile) ### Node 14 versions * [`v6.1.0`](https://github.com/buanet/ioBroker.docker/blob/v6.1.0/debian/node14/Dockerfile), [`v6.1.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v6.1.0/debian/node14/Dockerfile), [`v6.1.0-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v6.1.0/debian/node14/Dockerfile), [`v6.1.0-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v6.1.0/debian/node14/Dockerfile), [`latest-v6`](https://github.com/buanet/ioBroker.docker/blob/v6.1.0/debian/node14/Dockerfile) * [`v6.0.0`](https://github.com/buanet/ioBroker.docker/blob/v6.0.0/debian/node14/Dockerfile), [`v6.0.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v6.0.0/debian/node14/Dockerfile), [`v6.0.0-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v6.0.0/debian/node14/Dockerfile), [`v6.0.0-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v6.0.0/debian/node14/Dockerfile) -### Node 12 versions -* [`v5.2.0`](https://github.com/buanet/ioBroker.docker/blob/v5.2.0/debian/node12/Dockerfile), [`v5.2.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v5.2.0/debian/node12/Dockerfile), [`v5.2.0-arm32v7`](https://github.com/buanet/ioBroker.docker/blob/v5.2.0/debian/node12/Dockerfile), [`v5.2.0-arm64v8`](https://github.com/buanet/ioBroker.docker/blob/v5.2.0/debian/node12/Dockerfile), [`latest-v5`](https://github.com/buanet/ioBroker.docker/blob/v5.2.0/debian/node12/Dockerfile) -* [`v5.1.0`](https://github.com/buanet/ioBroker.docker/blob/v5.1.0/amd64/Dockerfile), [`v5.1.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v5.1.0/amd64/Dockerfile), [`v5.1.0-armv7hf`](https://github.com/buanet/ioBroker.docker/blob/v5.1.0/armv7hf/Dockerfile), [`v5.1.0-aarch64`](https://github.com/buanet/ioBroker.docker/blob/v5.1.0/aarch64/Dockerfile) -* [`v5.0.0`](https://github.com/buanet/ioBroker.docker/blob/v5.0.0/amd64/Dockerfile), [`v5.0.0-amd64`](https://github.com/buanet/ioBroker.docker/blob/v5.0.0/amd64/Dockerfile), [`v5.0.0-armv7hf`](https://github.com/buanet/ioBroker.docker/blob/v5.0.0/armv7hf/Dockerfile), [`v5.0.0-aarch64`](https://github.com/buanet/ioBroker.docker/blob/v5.0.0/aarch64/Dockerfile) - # What is ioBroker? IoBroker is a open source IoT platform written in JavaScript that easily connects smarthome components from different manufactures. With the help of plugins (called: "adapters") ioBroker is able to communicate with a big variety of IoT hardware and services using different protocols and APIs.