Compare commits

...

34 Commits

Author SHA1 Message Date
André Germann
3a8e38b3ee Merge pull request #407 from buanet/dependabot/github_actions/beta/actions/checkout-4.1.1
Bump actions/checkout from 4.1.0 to 4.1.1
2023-11-23 15:59:20 +01:00
dependabot[bot]
fa9e09ed1b Bump actions/checkout from 4.1.0 to 4.1.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-23 14:57:28 +00:00
buanet
5c97b2a041 release v9.1.0-beta.3 2023-11-23 15:53:08 +01:00
buanet
c6b0d307b5 prepare new beta 2023-11-17 22:54:04 +01:00
buanet
59ffff608a change target branch for dependabot 2023-11-17 18:40:08 +01:00
buanet
6c34c0a081 add --force to restore in maintenance script 2023-11-14 20:45:10 +01:00
buanet
92821ab262 improve shebang in scripts 2023-11-14 20:29:17 +01:00
buanet
2eb7f4e71f fix typo 2023-11-06 18:14:25 +01:00
buanet
b626063647 enhance logging/ fix typos 2023-11-06 16:57:56 +01:00
buanet
cef5ed1ef5 fix typos in logging 2023-11-06 16:53:34 +01:00
buanet
68b285d55f update comment 2023-11-06 16:01:12 +01:00
buanet
e1910d6f3b add logging for new env 2023-11-06 15:55:15 +01:00
buanet
bc483cc5f0 small enhancements for beta testing 2023-11-06 15:49:22 +01:00
buanet
bf87667fc0 improve maintenance command by symlinking 2023-11-03 20:37:49 +01:00
buanet
375d192c7c fix restore/ adding backup file selection 2023-11-03 18:02:10 +01:00
André Germann
4738e035b5 Merge pull request #392 from buanet/feature-error-handling-user-scripts
add error handling for user scripts
2023-10-17 21:59:34 +02:00
buanet
814cfae657 add error handling for user scripts 2023-10-11 09:20:33 +02:00
buanet
10de4b1a55 Revert "add error handling for user scripts"
This reverts commit 760a36f72a.
2023-10-11 00:18:38 +02:00
buanet
760a36f72a add error handling for user scripts 2023-10-11 00:08:14 +02:00
buanet
55c5b44537 fix calling iob in iobroker_startup.sh 2023-10-10 22:58:03 +02:00
buanet
317264f849 update changelog 2023-10-10 22:41:27 +02:00
buanet
4614b8c41a fix issue with apt repo failing 2023-10-10 20:49:48 +02:00
buanet
d4469b80d5 change version 2023-10-10 20:06:51 +02:00
buanet
24d5f3c9ed set push to true for dev-node20 2023-10-10 19:47:37 +02:00
buanet
f01167d513 add silent cleanup to setup_avahi.sh 2023-10-10 19:01:12 +02:00
André Germann
f27a29a325 Merge pull request #385 from z1r0-/avahi-startup-fix-debian-12
updated start command for avahi-daemon to work with Debian 12 (fixes …
2023-10-10 18:42:58 +02:00
André Germann
a24628e306 Merge pull request #386 from buanet/main
rebase by merge
2023-10-10 18:39:45 +02:00
Alexander Sajzew
3553ce3a65 start without daemonize and put it into background so we can redirect logs 2023-10-10 18:37:24 +02:00
André Germann
75f6496ffe Merge pull request #383 from buanet/dependabot/github_actions/main/actions/checkout-4.1.0
Bump actions/checkout from 4.0.0 to 4.1.0
2023-10-10 18:06:13 +02:00
Alexander Sajzew
f7de2fbad2 updated start command for avahi-daemon to work with Debian 12 (fixes #384) 2023-10-10 17:24:01 +02:00
dependabot[bot]
b56d2fad26 Bump actions/checkout from 4.0.0 to 4.1.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v4.1.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-09 09:42:52 +00:00
buanet
51306ed80d aktivate push 2023-10-09 10:18:05 +02:00
buanet
5d382d082b fix version in log and dockerfile 2023-10-09 10:11:21 +02:00
André Germann
aa86db5724 Merge pull request #382 from buanet/main
update beta with changes from main
2023-10-08 23:21:39 +02:00
18 changed files with 190 additions and 106 deletions

View File

@@ -1 +1 @@
v9.0.0 v9.1.0-beta.3

View File

@@ -5,4 +5,4 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "daily" interval: "daily"
target-branch: "main" target-branch: "beta"

View File

@@ -24,7 +24,7 @@ jobs:
run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4.1.0 uses: actions/checkout@v4.1.1
with: with:
repository: 'buanet/ioBroker.docker' repository: 'buanet/ioBroker.docker'
ref: ${{ env.RELEASE_TAG }} ref: ${{ env.RELEASE_TAG }}
@@ -43,10 +43,10 @@ jobs:
echo "[LOG] Buildnumber/Timestamp: $DATI" echo "[LOG] Buildnumber/Timestamp: $DATI"
echo "dati=$DATI" >> $GITHUB_ENV echo "dati=$DATI" >> $GITHUB_ENV
# Set values in iobroker_startup.sh # Set values in iobroker_startup.sh
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${BUILD}/$DATI/" ./debian12/scripts/iobroker_startup.sh > ./debian12/scripts/iobroker_startup.tmp sed -e "s/\${VERSION}/$VERSION/" -e "s/\${BUILD}/$DATI/" ./debian12/scripts/iobroker_startup.sh > ./debian12/scripts/iobroker_startup.tmp
mv -f ./debian12/scripts/iobroker_startup.tmp ./debian12/scripts/iobroker_startup.sh mv -f ./debian12/scripts/iobroker_startup.tmp ./debian12/scripts/iobroker_startup.sh
# Set values in Dockerfile # Set values in Dockerfile
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" -e "s/\${NODE}/${{ vars.RECOMMENDED_NODE_VERSION }}/" ./debian12/Dockerfile > ./debian12/Dockerfile.tmp sed -e "s/\${VERSION}/$VERSION/" -e "s/\${DATI}/$DATI/" -e "s/\${NODE}/${{ vars.RECOMMENDED_NODE_VERSION }}/" ./debian12/Dockerfile > ./debian12/Dockerfile.tmp
mv -f ./debian12/Dockerfile.tmp ./debian12/Dockerfile mv -f ./debian12/Dockerfile.tmp ./debian12/Dockerfile
- name: Set up QEMU - name: Set up QEMU
@@ -96,7 +96,7 @@ jobs:
run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4.1.0 uses: actions/checkout@v4.1.1
with: with:
repository: 'buanet/ioBroker.docker' repository: 'buanet/ioBroker.docker'
ref: ${{ env.RELEASE_TAG }} ref: ${{ env.RELEASE_TAG }}
@@ -115,10 +115,10 @@ jobs:
echo "[LOG] Buildnumber/Timestamp: $DATI" echo "[LOG] Buildnumber/Timestamp: $DATI"
echo "dati=$DATI" >> $GITHUB_ENV echo "dati=$DATI" >> $GITHUB_ENV
# Set values in iobroker_startup.sh # Set values in iobroker_startup.sh
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${BUILD}/$DATI/" ./debian12/scripts/iobroker_startup.sh > ./debian12/scripts/iobroker_startup.tmp sed -e "s/\${VERSION}/$VERSION/" -e "s/\${BUILD}/$DATI/" ./debian12/scripts/iobroker_startup.sh > ./debian12/scripts/iobroker_startup.tmp
mv -f ./debian12/scripts/iobroker_startup.tmp ./debian12/scripts/iobroker_startup.sh mv -f ./debian12/scripts/iobroker_startup.tmp ./debian12/scripts/iobroker_startup.sh
# Set values in Dockerfile # Set values in Dockerfile
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" -e "s/\${NODE}/${{ vars.EXPERIMENTAL_NODE_VERSION }}/" ./debian12/Dockerfile > ./debian12/Dockerfile.tmp sed -e "s/\${VERSION}/$VERSION/" -e "s/\${DATI}/$DATI/" -e "s/\${NODE}/${{ vars.EXPERIMENTAL_NODE_VERSION }}/" ./debian12/Dockerfile > ./debian12/Dockerfile.tmp
mv -f ./debian12/Dockerfile.tmp ./debian12/Dockerfile mv -f ./debian12/Dockerfile.tmp ./debian12/Dockerfile
- name: Set up QEMU - name: Set up QEMU

View File

@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4.1.0 uses: actions/checkout@v4.1.1
with: with:
repository: 'buanet/ioBroker.docker' repository: 'buanet/ioBroker.docker'
@@ -85,7 +85,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4.0.0 uses: actions/checkout@v4.1.1
with: with:
repository: 'buanet/ioBroker.docker' repository: 'buanet/ioBroker.docker'
@@ -134,7 +134,7 @@ jobs:
with: with:
context: ./debian12 context: ./debian12
file: ./debian12/Dockerfile file: ./debian12/Dockerfile
push: false push: true
platforms: | platforms: |
linux/amd64 linux/amd64
linux/arm64 linux/arm64

View File

@@ -18,7 +18,7 @@ jobs:
echo "RELEASE_TAG=$LATESTRELEASE" >> $GITHUB_ENV echo "RELEASE_TAG=$LATESTRELEASE" >> $GITHUB_ENV
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4.1.0 uses: actions/checkout@v4.1.1
with: with:
repository: 'buanet/ioBroker.docker' repository: 'buanet/ioBroker.docker'
ref: ${{ env.RELEASE_TAG }} ref: ${{ env.RELEASE_TAG }}
@@ -37,10 +37,10 @@ jobs:
echo "[LOG] Buildnumber/Timestamp: $DATI" echo "[LOG] Buildnumber/Timestamp: $DATI"
echo "dati=$DATI" >> $GITHUB_ENV echo "dati=$DATI" >> $GITHUB_ENV
# Set values in iobroker_startup.sh # Set values in iobroker_startup.sh
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${BUILD}/$DATI/" ./debian12/scripts/iobroker_startup.sh > ./debian12/scripts/iobroker_startup.tmp sed -e "s/\${VERSION}/$VERSION/" -e "s/\${BUILD}/$DATI/" ./debian12/scripts/iobroker_startup.sh > ./debian12/scripts/iobroker_startup.tmp
mv -f ./debian12/scripts/iobroker_startup.tmp ./debian12/scripts/iobroker_startup.sh mv -f ./debian12/scripts/iobroker_startup.tmp ./debian12/scripts/iobroker_startup.sh
# Set values in Dockerfile # Set values in Dockerfile
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" -e "s/\${NODE}/${{ vars.RECOMMENDED_NODE_VERSION }}/" ./debian12/Dockerfile > ./debian12/Dockerfile.tmp sed -e "s/\${VERSION}/$VERSION/" -e "s/\${DATI}/$DATI/" -e "s/\${NODE}/${{ vars.RECOMMENDED_NODE_VERSION }}/" ./debian12/Dockerfile > ./debian12/Dockerfile.tmp
mv -f ./debian12/Dockerfile.tmp ./debian12/Dockerfile mv -f ./debian12/Dockerfile.tmp ./debian12/Dockerfile
- name: Set up QEMU - name: Set up QEMU
@@ -94,7 +94,7 @@ jobs:
echo "RELEASE_TAG=$LATESTRELEASE" >> $GITHUB_ENV echo "RELEASE_TAG=$LATESTRELEASE" >> $GITHUB_ENV
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4.1.0 uses: actions/checkout@v4.1.1
with: with:
repository: 'buanet/ioBroker.docker' repository: 'buanet/ioBroker.docker'
ref: ${{ env.RELEASE_TAG }} ref: ${{ env.RELEASE_TAG }}
@@ -113,10 +113,10 @@ jobs:
echo "[LOG] Buildnumber/Timestamp: $DATI" echo "[LOG] Buildnumber/Timestamp: $DATI"
echo "dati=$DATI" >> $GITHUB_ENV echo "dati=$DATI" >> $GITHUB_ENV
# Set values in iobroker_startup.sh # Set values in iobroker_startup.sh
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${BUILD}/$DATI/" ./debian12/scripts/iobroker_startup.sh > ./debian12/scripts/iobroker_startup.tmp sed -e "s/\${VERSION}/$VERSION/" -e "s/\${BUILD}/$DATI/" ./debian12/scripts/iobroker_startup.sh > ./debian12/scripts/iobroker_startup.tmp
mv -f ./debian12/scripts/iobroker_startup.tmp ./debian12/scripts/iobroker_startup.sh mv -f ./debian12/scripts/iobroker_startup.tmp ./debian12/scripts/iobroker_startup.sh
# Set values in Dockerfile # Set values in Dockerfile
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" -e "s/\${NODE}/${{ vars.RECOMMENDED_NODE_VERSION }}/" ./debian12/Dockerfile > ./debian12/Dockerfile.tmp sed -e "s/\${VERSION}/$VERSION/" -e "s/\${DATI}/$DATI/" -e "s/\${NODE}/${{ vars.RECOMMENDED_NODE_VERSION }}/" ./debian12/Dockerfile > ./debian12/Dockerfile.tmp
mv -f ./debian12/Dockerfile.tmp ./debian12/Dockerfile mv -f ./debian12/Dockerfile.tmp ./debian12/Dockerfile
- name: Set up QEMU - name: Set up QEMU
@@ -137,7 +137,7 @@ jobs:
with: with:
context: ./debian12 context: ./debian12
file: ./debian12/Dockerfile file: ./debian12/Dockerfile
push: false ##### For first test of new workflow push: true
platforms: | platforms: |
linux/amd64 linux/amd64
linux/arm/v7 linux/arm/v7

View File

@@ -12,7 +12,7 @@ jobs:
update-docker-readme: update-docker-readme:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4.1.0 - uses: actions/checkout@v4.1.1
- name: Update Docker Hub Readme (buanet) - name: Update Docker Hub Readme (buanet)
uses: peter-evans/dockerhub-description@v3.4.2 uses: peter-evans/dockerhub-description@v3.4.2

View File

@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4.1.0 uses: actions/checkout@v4.1.1
with: with:
repository: 'buanet/ioBroker.docker' repository: 'buanet/ioBroker.docker'
token: ${{ secrets.ACTIONS_PAT }} token: ${{ secrets.ACTIONS_PAT }}

View File

@@ -1,5 +1,26 @@
## Changelog ## Changelog
### v9.1.0-beta.3 (23.11.2023)
* add --force to restore in maintenance script
* improve shebang in scripts for downgrade and portability
* v9.1.0-beta.2 (06.11.2023)
* enhance logging/ fix typos
* add env PACKAGES_UPDATE and remove automatic package updates on first container start
* improve setuid/setgid handling during startup ([#397](https://github.com/buanet/ioBroker.docker/issues/397))
* move maintenance script registration to dockerfile ([#390](https://github.com/buanet/ioBroker.docker/issues/390))
* v9.1.0-beta.1 (03.11.2023)
* improve maintenance command by symlinking ([#390](https://github.com/buanet/ioBroker.docker/issues/390))
* fix restore/ adding backup file selection ([#394](https://github.com/buanet/ioBroker.docker/issues/394))
* fix calling iob start|stop with parameters
* enhance logging in iobroker_startup.sh
* add error handling for user scripts
### 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) ### v9.0.0 (09.10.2023)
* update official docs * update official docs
* v9.0.0-beta.2 (28.09.2023) * v9.0.0-beta.2 (28.09.2023)

View File

@@ -75,6 +75,10 @@ RUN apt-get update && apt-get upgrade -y \
&& chown -R iobroker:iobroker /opt/scripts /opt/userscripts \ && chown -R iobroker:iobroker /opt/scripts /opt/userscripts \
&& chmod 755 /opt/scripts/*.sh \ && chmod 755 /opt/scripts/*.sh \
&& chmod 755 /opt/userscripts/*.sh \ && chmod 755 /opt/userscripts/*.sh \
# register maintenance command
&& ln -s /opt/scripts/maintenance.sh /bin/maintenance \
&& ln -s /opt/scripts/maintenance.sh /bin/maint \
&& ln -s /opt/scripts/maintenance.sh /bin/m \
# Clean up installation cache # Clean up installation cache
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& apt-get autoclean -y \ && apt-get autoclean -y \

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Script checks health of running container # Script checks health of running container

View File

@@ -1,4 +1,4 @@
#!/usr/bin/bash #!/usr/bin/env bash
# run iob fix # run iob fix
iob_fix () { iob_fix () {
@@ -39,27 +39,48 @@ iob_diag () {
fi fi
} }
if [ "$1" = "fix" ]; then # call iobroker fixer # run iobroker maintenance script
iob_fix iob_maint() {
elif [ "$1" = "node fix" ]; then # call iobroker node fixer
echo "The execution of this command is blocked as your ioBroker is running inside a Docker container!"
echo "To fix any issues with nodejs, please pull the latest version of the Docker image and recreate your container."
elif [ "$1" = "diag" ]; then # call iobroker diag script
iob_diag
elif [ "$1" = "start" ] || [ "$1" = "stop" ] || [ "$1" = "restart" ]; then # block execution of iobroker start | stop | restart
echo "The execution of this command is blocked as your ioBroker is running inside a Docker container!"
echo "For more details see ioBroker Docker image docs (https://docs.buanet.de/iobroker-docker-image/docs/) or use the maintenance script 'maintenance --help'."
elif [ "$1" = "m" ] || [ "$1" = "maint" ] || [ "$1" = "maintenance" ]; then # call iobroker maintenance script
shift shift
if [ "$(id -u)" -eq 0 ]; then # check for execution as root if [ "$(id -u)" -eq 0 ]; then
gosu iobroker bash /opt/scripts/maintenance.sh "$@" gosu iobroker bash /opt/scripts/maintenance.sh "$@"
else else
bash /opt/scripts/maintenance.sh "$@" bash /opt/scripts/maintenance.sh "$@"
fi fi
else # passing all other parameters to iobroker.js }
if [ "$(id -u)" -eq 0 ]; then # check for execution as root
# pass parameters and run iobroker.js
iob_run() {
if [ "$(id -u)" -eq 0 ]; then
gosu iobroker node /opt/iobroker/node_modules/iobroker.js-controller/iobroker.js "$@" gosu iobroker node /opt/iobroker/node_modules/iobroker.js-controller/iobroker.js "$@"
else else
node /opt/iobroker/node_modules/iobroker.js-controller/iobroker.js "$@" node /opt/iobroker/node_modules/iobroker.js-controller/iobroker.js "$@"
fi fi
}
if [ "$1" = "fix" ]; then
# call iobroker fixer
iob_fix
elif [ "$1" = "node fix" ]; then
# call iobroker node fixer
echo "The execution of this command is blocked as your ioBroker is running inside a Docker container!"
echo "To fix any issues with nodejs, please pull the latest version of the Docker image and recreate your container."
elif [ "$1" = "diag" ]; then
# call iobroker diag script
iob_diag
elif [ "$1" = "start" ] || [ "$1" = "stop" ] || [ "$1" = "restart" ]; then
# block execution of iobroker start | stop | restart but pass start | stop for adapters
if [ ! "$2" ]; then
echo "The execution of this command is blocked as your ioBroker is running inside a Docker container!"
echo "For more details see ioBroker Docker image docs (https://docs.buanet.de/iobroker-docker-image/docs/) or use the maintenance script 'maintenance --help'."
else
# passing all other parameters to iobroker.js but check for execution as root
iob_run "$@"
fi
elif [ "$1" = "m" ] || [ "$1" = "maint" ] || [ "$1" = "maintenance" ]; then
# call iobroker maintenance script but check for execution as root
iob_maint "$@"
else
# passing all other parameters to iobroker.js but check for execution as root
iob_run "$@"
fi fi

View File

@@ -17,17 +17,18 @@ offlinemode=$OFFLINE_MODE
objectsdbhost=$IOB_OBJECTSDB_HOST objectsdbhost=$IOB_OBJECTSDB_HOST
objectsdbport=$IOB_OBJECTSDB_PORT objectsdbport=$IOB_OBJECTSDB_PORT
objectsdbtype=$IOB_OBJECTSDB_TYPE objectsdbtype=$IOB_OBJECTSDB_TYPE
objectsdbname=$IOB_OBJECTSDB_NAME # new for sentinel support objectsdbname=$IOB_OBJECTSDB_NAME
objectsdbpass=$IOB_OBJECTSDB_PASS # new for auth support objectsdbpass=$IOB_OBJECTSDB_PASS
packages=$PACKAGES packages=$PACKAGES
packagesupdate=$PACKAGES_UPDATE
permissioncheck=$PERMISSION_CHECK permissioncheck=$PERMISSION_CHECK
setgid=$SETGID setgid=$SETGID
setuid=$SETUID setuid=$SETUID
statesdbhost=$IOB_STATESDB_HOST statesdbhost=$IOB_STATESDB_HOST
statesdbport=$IOB_STATESDB_PORT statesdbport=$IOB_STATESDB_PORT
statesdbtype=$IOB_STATESDB_TYPE statesdbtype=$IOB_STATESDB_TYPE
statesdbname=$IOB_STATESDB_NAME # new for sentinel support statesdbname=$IOB_STATESDB_NAME
statesdbpass=$IOB_STATESDB_PASS # new for auth support statesdbpass=$IOB_STATESDB_PASS
usbdevices=$USBDEVICES usbdevices=$USBDEVICES
set -u set -u
@@ -99,6 +100,7 @@ if [[ "$statesdbname" != "" ]]; then echo -n "----- " && echo
if [[ "$statesdbpass" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" IOB_STATESDB_PASS: "***")" && echo " -----"; fi if [[ "$statesdbpass" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" IOB_STATESDB_PASS: "***")" && echo " -----"; fi
if [[ "$offlinemode" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" OFFLINE_MODE: "$offlinemode")" && 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 [[ "$packages" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" PACKAGES: "$packages")" && echo " -----"; fi
if [[ "$packagesupdate" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" PACKAGES_UPDATE: "$packagesupdate")" && echo " -----"; fi
if [[ "$permissioncheck" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" PERMISSION_CHECK: "$permissioncheck")" && 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 [[ "$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 [[ "$setuid" != "" ]]; then echo -n "----- " && echo -n "$(printf "%-20s %-28s" SETUID: "$setuid")" && echo " -----"; fi
@@ -123,7 +125,7 @@ fi
# STEP 1 - Preparing container # STEP 1 - Preparing container
##### #####
echo "$(printf -- '-%.0s' {1..80})" echo "$(printf -- '-%.0s' {1..80})"
echo "----- Step 1 of 5: Preparing container -----" echo "----- Step 1 of 5: Preparing Container -----"
echo "$(printf -- '-%.0s' {1..80})" echo "$(printf -- '-%.0s' {1..80})"
echo " " echo " "
@@ -132,31 +134,27 @@ if [[ -f /opt/.docker_config/.first_run ]]; then
# Updating Linux packages # Updating Linux packages
if [[ "$offlinemode" = "true" ]]; then 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."
else echo " "
bash /opt/scripts/setup_packages.sh -update elif [[ "$packagesupdate" = "true" ]]; then
if ! bash /opt/scripts/setup_packages.sh -update; then echo "Failed."; fi
echo " "
fi fi
echo " "
# Installing packages from ENV # Installing packages from ENV
if [[ "$packages" != "" && "$offlinemode" = "true" ]]; then 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."
elif [[ "$packages" != "" ]]; then elif [[ "$packages" != "" ]]; then
echo "PACKAGES is set. Installing the following additional Linux packages: ""$packages" 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 "Failed."; fi
fi fi
echo " " echo " "
# Register maintenance script
echo -n "Registering maintenance script as command... "
echo "alias maintenance='/opt/scripts/maintenance.sh'" >> /etc/bash.bashrc
echo "alias maint='/opt/scripts/maintenance.sh'" >> /etc/bash.bashrc
echo "alias m='/opt/scripts/maintenance.sh'" >> /etc/bash.bashrc
echo "Done."
else 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."
fi fi
echo " " echo " "
# Setting UID and/ or GID # Setting UID and/ or GID
if [[ "$setgid" != "$(cat /etc/group | grep 'iobroker:' | cut -d':' -f3)" || "$setuid" != "$(cat /etc/passwd | grep 'iobroker:' | cut -d':' -f3)" ]]; then if [[ "$setgid" != "$(id -u iobroker)" || "$setuid" != "$(id -g iobroker)" ]]; then
echo "SETUID and/ or SETGID are set to custom values." echo "SETUID and/ or SETGID are set to custom values."
echo -n "Changing UID to \"""$setuid""\" and GID to \"""$setgid""\"... " echo -n "Changing UID to \"""$setuid""\" and GID to \"""$setgid""\"... "
usermod -u "$setuid" iobroker usermod -u "$setuid" iobroker
@@ -172,7 +170,7 @@ cd /opt/iobroker
# STEP 2 - Detecting ioBroker-Installation # STEP 2 - Detecting ioBroker-Installation
##### #####
echo "$(printf -- '-%.0s' {1..80})" echo "$(printf -- '-%.0s' {1..80})"
echo "----- Step 2 of 5: Detecting ioBroker installation -----" echo "----- Step 2 of 5: Detecting ioBroker Installation -----"
echo "$(printf -- '-%.0s' {1..80})" echo "$(printf -- '-%.0s' {1..80})"
echo " " echo " "
@@ -186,10 +184,10 @@ elif [[ -f /opt/iobroker/iobroker ]]; then
elif [[ "$(ls *_backupiobroker.tar.gz 2> /dev/null | wc -l)" != "0" && "$(tar -ztvf /opt/iobroker/*_backupiobroker.tar.gz "backup/backup.json" 2> /dev/null | wc -l)" != "0" ]]; then elif [[ "$(ls *_backupiobroker.tar.gz 2> /dev/null | wc -l)" != "0" && "$(tar -ztvf /opt/iobroker/*_backupiobroker.tar.gz "backup/backup.json" 2> /dev/null | wc -l)" != "0" ]]; then
echo "IoBroker backup file detected in /opt/iobroker." 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 "Since Docker Image v8, automatic initial restore is no longer supported!" echo "Since Docker image v8, automatic initial restore is no longer supported!"
echo "IoBroker will start with a fresh installation, while your backup file will be copied into the backup directory." echo "IoBroker will start with a fresh installation, while your backup file will be copied into the backup directory."
echo "You will be able to restore your backup file manually by using the backitup adapter or the containers maintenance script." echo "You will be able to restore your backup file manually by using the backitup adapter or the containers maintenance script."
echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/)." echo "For more information see ioBroker Docker image docs (https://docs.buanet.de/iobroker-docker-image/docs/)."
echo " " echo " "
echo -n "Copying backup file and restoring initial ioBroker installation... " echo -n "Copying backup file and restoring initial ioBroker installation... "
mv /opt/iobroker/*.tar.gz /opt/ mv /opt/iobroker/*.tar.gz /opt/
@@ -214,11 +212,11 @@ echo " "
# STEP 3 - Checking ioBroker-Installation # STEP 3 - Checking ioBroker-Installation
##### #####
echo "$(printf -- '-%.0s' {1..80})" echo "$(printf -- '-%.0s' {1..80})"
echo "----- Step 3 of 5: Checking ioBroker installation -----" echo "----- Step 3 of 5: Checking ioBroker Installation -----"
echo "$(printf -- '-%.0s' {1..80})" echo "$(printf -- '-%.0s' {1..80})"
echo " " echo " "
# Backing up original iobroker executable to fix sudo bug with gosu # Backing up and replace original iobroker executable to fix sudo bug with gosu
if [[ -n $(cmp /opt/scripts/iobroker.sh /opt/iobroker/iobroker) ]]; then if [[ -n $(cmp /opt/scripts/iobroker.sh /opt/iobroker/iobroker) ]]; then
echo -n "Replacing ioBroker executable to fix sudo bug... " echo -n "Replacing ioBroker executable to fix sudo bug... "
cp -a /opt/iobroker/iobroker /opt/iobroker/iobroker.bak cp -a /opt/iobroker/iobroker /opt/iobroker/iobroker.bak
@@ -299,7 +297,7 @@ elif [[ "$multihost" == "" || "$multihost" == "false" ]]; then
else else
echo "IOB_MULTIHOST is set, but the value is not valid. Please check your configuration." echo "IOB_MULTIHOST is set, but the value is not valid. Please check your configuration."
if [[ "$debug" == "true" ]]; then echo "[DEBUG] IOB_MULTIHOST = ""$multihost"; fi if [[ "$debug" == "true" ]]; then echo "[DEBUG] IOB_MULTIHOST = ""$multihost"; fi
echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/#environment-variables-env)." echo "For more information see ioBroker Docker image docs (https://docs.buanet.de/iobroker-docker-image/docs/#environment-variables-env)."
stop_on_error stop_on_error
fi fi
@@ -308,7 +306,7 @@ if [[ -f /opt/iobroker/.fresh_install && "$multihost" != "slave" ]]; then
echo -n "Initializing a fresh installation of ioBroker... " echo -n "Initializing a fresh installation of ioBroker... "
if [[ ! -d "/opt/iobroker/log" ]]; then gosu iobroker mkdir "/opt/iobroker/log"; fi if [[ ! -d "/opt/iobroker/log" ]]; then gosu iobroker mkdir "/opt/iobroker/log"; fi
set +e 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=$? return=$?
set -e set -e
rm -f /opt/iobroker/.fresh_install rm -f /opt/iobroker/.fresh_install
@@ -321,20 +319,20 @@ if [[ -f /opt/iobroker/.fresh_install && "$multihost" != "slave" ]]; then
echo "Done." echo "Done."
echo " " echo " "
else else
echo -n "Checking Database connection... " echo -n "Checking database connection... "
set +e set +e
if iob uuid &> /dev/null; then if gosu iobroker iob uuid &> /dev/null; then
echo "Done." echo "Done."
echo " " echo " "
else else
errormsg=$(iob uuid 2>&1 | sed 's/^/[DEBUG] /') errormsg=$(gosu iobroker iob uuid 2>&1 | sed 's/^/[DEBUG] /')
echo "Failed." echo "Failed."
if [[ "$debug" == "true" ]]; then if [[ "$debug" == "true" ]]; then
echo "[DEBUG] Error message: " echo "[DEBUG] Error message: "
echo "$errormsg" echo "$errormsg"
fi fi
echo "Please check your configuration and try again." echo "Please check your configuration and try again."
echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs)." echo "For more information see ioBroker Docker image docs (https://docs.buanet.de/iobroker-docker-image/docs)."
stop_on_error stop_on_error
fi fi
set -e set -e
@@ -347,20 +345,20 @@ if [[ "$multihost" == "slave" ]]; then
else else
# get admin instance and hostname # get admin instance and hostname
set +e 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 set -e
if [[ "$admininstance" != "" ]]; then if [[ "$admininstance" != "" ]]; then
if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin instance is:" "$admininstance"; 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 if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin hostname is:" "$adminhostname"; fi
else else
set +e 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 set -e
if [[ "$admininstance" != "" ]]; then 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 disabled."; fi
if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin instance is:" "$admininstance"; 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 if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected admin hostname is:" "$adminhostname"; fi
else else
echo "There was a problem detecting the admin instance of your iobroker." echo "There was a problem detecting the admin instance of your iobroker."
@@ -373,7 +371,7 @@ else
if [[ "$adminhostname" != "" && "$adminhostname" != "$(hostname)" ]]; then if [[ "$adminhostname" != "" && "$adminhostname" != "$(hostname)" ]]; then
echo "Hostname in ioBroker does not match the hostname of this container." echo "Hostname in ioBroker does not match the hostname of this container."
echo -n "Updating hostname to \"""$(hostname)""\"... " echo -n "Updating hostname to \"""$(hostname)""\"... "
bash iobroker host "$adminhostname" gosu iobroker iob host "$adminhostname"
echo "Done." echo "Done."
echo " " echo " "
elif [[ "$adminhostname" = "$(hostname)" ]]; then elif [[ "$adminhostname" = "$(hostname)" ]]; then
@@ -421,23 +419,23 @@ fi
# STEP 4 - Setting up special sessting for ioBroker-adapters # STEP 4 - Setting up special sessting for ioBroker-adapters
##### #####
echo "$(printf -- '-%.0s' {1..80})" echo "$(printf -- '-%.0s' {1..80})"
echo "----- Step 4 of 5: Applying special settings -----" echo "----- Step 4 of 5: Applying Special Settings -----"
echo "$(printf -- '-%.0s' {1..80})" echo "$(printf -- '-%.0s' {1..80})"
echo " " echo " "
echo "Some adapters have special requirements/ settings which can be activated by the use of environment variables." echo "Some adapters have special requirements/ settings which can be activated by the use of environment variables."
echo "For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/)." echo "For more information see ioBroker Docker image docs (https://docs.buanet.de/iobroker-docker-image/docs/)."
echo " " echo " "
# Checking ENV for Adminport # Checking ENV for Adminport
if [[ "$adminport" != "" && "$multihost" != "slave" ]]; then 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..') admininstanceshort=$(echo "$admininstance" | grep -m 1 -o 'admin..')
if [[ "$adminport" != "$adminportold" ]]; then if [[ "$adminport" != "$adminportold" ]]; then
echo "IOB_ADMINPORT is set and does not match port configured in ioBroker." 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 if [[ "$debug" == "true" ]]; then echo "[DEBUG] Detected Admin Port in ioBroker: " "$adminportold"; fi
echo "Setting Adminport to \"""$adminport""\"... " echo "Setting Adminport to \"""$adminport""\"... "
bash iobroker set "$admininstanceshort" --port "$adminport" gosu iobroker iob set "$admininstanceshort" --port "$adminport"
echo "Done." echo "Done."
echo " " echo " "
fi fi
@@ -478,7 +476,7 @@ if [[ "$usbdevices" != "" && "$usbdevices" != "none" ]]; then
else else
echo "Looks like the device \"""$i""\" does not exist." echo "Looks like the device \"""$i""\" does not exist."
echo "Did you mount it correctly by using the \"--device\" option?" 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)." echo "For more information see ioBroker Docker image docs (https://docs.buanet.de/iobroker-docker-image/docs/#mounting-usb-devices)."
stop_on_error stop_on_error
fi fi
done done
@@ -497,17 +495,24 @@ elif [[ -f /opt/userscripts/userscript_firststart.sh || -f /opt/userscripts/user
echo "Userscript for first start detected and this is the first start of a new container." 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 chmod 755 /opt/userscripts/userscript_firststart.sh
bash /opt/userscripts/userscript_firststart.sh if ! bash /opt/userscripts/userscript_firststart.sh; then
echo "Done." echo "Failed."
else
echo "Done."
fi
fi fi
if [[ -f /opt/userscripts/userscript_everystart.sh ]]; then 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 chmod 755 /opt/userscripts/userscript_everystart.sh
bash /opt/userscripts/userscript_everystart.sh if ! bash /opt/userscripts/userscript_everystart.sh; then
echo "Done." echo "Failed."
else
echo "Done."
fi
fi fi
echo " "
fi fi
echo " "
# Removing first run an fresh install markers when exists # Removing first run an fresh install markers when exists
if [[ -f /opt/.docker_config/.first_run ]]; then rm -f /opt/.docker_config/.first_run; fi if [[ -f /opt/.docker_config/.first_run ]]; then rm -f /opt/.docker_config/.first_run; fi
@@ -517,7 +522,7 @@ if [[ -f /opt/iobroker/.fresh_install ]]; then rm -f /opt/iobroker/.fresh_instal
# STEP 5 - Starting ioBroker # STEP 5 - Starting ioBroker
##### #####
echo "$(printf -- '-%.0s' {1..80})" echo "$(printf -- '-%.0s' {1..80})"
echo "----- Step 5 of 5: ioBroker startup -----" echo "----- Step 5 of 5: ioBroker Startup -----"
echo "$(printf -- '-%.0s' {1..80})" echo "$(printf -- '-%.0s' {1..80})"
echo " " echo " "
echo "Starting ioBroker... " echo "Starting ioBroker... "

View File

@@ -165,12 +165,12 @@ stop_iob() {
if [[ "$killbyname" != yes ]]; then if [[ "$killbyname" != yes ]]; then
# pgrep exits with status 1 when there are no matches # pgrep exits with status 1 when there are no matches
while pgrep -u iobroker -f 'io.' > /dev/null; (( $? != 1 )); do while pgrep -u iobroker -f 'io\..' > /dev/null; (( $? != 1 )); do
if (($(date +%s) > timeout)); then if (($(date +%s) > timeout)); then
echo -e "\nTimeout reached. Killing remaining processes..." echo -e "\nTimeout reached. Killing remaining processes..."
pgrep --list-full -u iobroker pgrep --list-full -u iobroker -f 'io\..'
pkill --signal SIGKILL -u iobroker -f 'io.' pkill --signal SIGKILL -u iobroker -f 'io\..'
echo "\nDone." echo "Done."
return return
fi fi
sleep 1 sleep 1
@@ -184,6 +184,7 @@ stop_iob() {
fi fi
echo -e "Done." echo -e "Done."
echo " "
} }
# restart container # restart container
@@ -218,40 +219,68 @@ restore_iobroker() {
echo "You are now going to perform a restore of your iobroker." echo "You are now going to perform a restore of your iobroker."
echo "During the restore process, the container will automatically switch into maintenance mode and stop ioBroker." echo "During the restore process, the container will automatically switch into maintenance mode and stop ioBroker."
echo "Depending on the restart policy, your container will be stopped or restarted automatically after the restore." echo "Depending on the restart policy, your container will be stopped or restarted automatically after the restore."
# check autoconfirm
if [[ "$autoconfirm" != yes ]]; then if [[ "$autoconfirm" != yes ]]; then
local reply local reply
read -rp 'Do you want to continue [yes/no]? ' reply read -rp 'Do you want to continue [yes/no]? ' reply
if [[ "$reply" == y || "$reply" == Y || "$reply" == yes ]]; then if [[ "$reply" != y && "$reply" != Y && "$reply" != yes ]]; then
: # continue return 1
else
return 1
fi fi
fi fi
echo " "
# check startup script running
if check_starting > /dev/null; then if check_starting > /dev/null; then
echo "Startup script is still running." echo "Startup script is still running."
echo "Please check container log and wait until ioBroker is sucessfully started." echo "Please check container log and wait until ioBroker is sucessfully started."
echo "Then try again."
return 1 return 1
fi fi
# check mainenance mode
if ! maintenance_enabled > /dev/null; then if ! maintenance_enabled > /dev/null; then
autoconfirm=yes autoconfirm=yes
enable_maintenance enable_maintenance
fi fi
echo -n "Restoring ioBroker... " # list backup files
backup_dir="/opt/iobroker/backups"
backup_files=($(find $backup_dir -type f))
backup_count=${#backup_files[@]}
if [[ $backup_count -eq 0 ]]; then
echo "Ther are no backup files in $backup_dir."
echo "Please check and try again."
return 1
elif [[ $backup_count -eq 1 ]]; then
selected_backup=$(basename "${backup_files[0]}")
echo "There is one backup file in $backup_dir."
else
# more than one backup file found, ask user to select
echo "There is more than one backup file in $backup_dir."
echo "Please select file for restore:"
for ((i=0; i<$backup_count; i++)); do
echo "$i: $(basename "${backup_files[$i]}")"
done
echo
read -rp "Enter the number of the backup to restore (0-$((backup_count - 1))): " selected_number
selected_backup=$(basename "${backup_files[$selected_number]}")
fi
# restoe backup
echo -n "Restoring ioBroker from $selected_backup... "
set +e set +e
bash iobroker restore 0 > /opt/iobroker/log/restore.log 2>&1 bash iobroker restore "$selected_backup" --force > /opt/iobroker/log/restore.log 2>&1
return=$? return_value=$?
set -e set -e
if [[ "$return" -ne 0 ]]; then
echo "Failed." if [[ "$return_value" -ne 0 ]]; then
echo "For more details see \"/opt/iobroker/log/restore.log\"." echo "Failed."
echo "Please check backup file location and permissions and try again." echo "For more details see \"/opt/iobroker/log/restore.log\"."
return 1 echo "Please check backup file location and permissions and try again."
return 1
fi fi
echo "Done." echo "Done."
echo " " echo " "
@@ -265,8 +294,8 @@ restore_iobroker() {
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
sleep 10 sleep 10
echo "Container will be stopped or restarted in 10 seconds..." echo "Container will be stopped or restarted in 10 seconds..."
sleep 10
echo "stopping" > "$healthcheck" echo "stopping" > "$healthcheck"
sleep 10
pkill -u iobroker pkill -u iobroker
} }

View File

@@ -1,13 +1,15 @@
#!/bin/bash #!/usr/bin/env bash
if [ -e /usr/sbin/avahi-daemon ] && [ -e /var/run/dbus ] if [ -e /usr/sbin/avahi-daemon ] && [ -e /var/run/dbus ]
then then
echo "[setup_avahi.sh] Avahi is already installed. Nothing to do here." echo "[setup_avahi.sh] Avahi is already installed. Nothing to do here."
else else
echo -n "[setup_avahi.sh] Avahi-daemon is NOT installed. Going to install it now... " 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 -q 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 apt-get -q -y --no-install-recommends install 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 # 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 "Done."
echo -n "[setup_avahi.sh] Configuring avahi-daemon... " echo -n "[setup_avahi.sh] Configuring avahi-daemon... "
sed -i '/^rlimit-nproc/s/^\(.*\)/#\1/g' /etc/avahi/avahi-daemon.conf 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 "Done."
echo -n "[setup_avahi.sh] Starting avahi-daemon... " 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." echo "Done."
exit 0 exit 0

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# reading env # reading env
debug=$DEBUG debug=$DEBUG

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# bash strict mode # bash strict mode
set -euo pipefail set -euo pipefail
@@ -58,7 +58,7 @@ if [[ "$1" == "-install" ]]; then
fi fi
done done
elif [[ "$1" == "-update" ]]; then elif [[ "$1" == "-update" ]]; then
echo -n "Updating Linux packages on first run... " echo -n "PACKAGES_UPDATE is set. Updating Linux packages on first run... "
apt-get -q update >> /opt/scripts/setup_packages.log 2>&1 apt-get -q update >> /opt/scripts/setup_packages.log 2>&1
return1=$? return1=$?
apt-get -q -y upgrade >> /opt/scripts/setup_packages.log 2>&1 apt-get -q -y upgrade >> /opt/scripts/setup_packages.log 2>&1

View File

@@ -124,6 +124,7 @@ You could use environment variables to auto configure your ioBroker container on
* `LC_ALL` (optional, default: de_DE.UTF-8) The following locales are pre-generated: de_DE.UTF-8, en_US.UTF-8 * `LC_ALL` (optional, default: de_DE.UTF-8) The following locales are pre-generated: de_DE.UTF-8, en_US.UTF-8
* `OFFLINE_MODE` (optional) Set `true` if your container has no or limited internet connection * `OFFLINE_MODE` (optional) Set `true` if your container has no or limited internet connection
* `PACKAGES` (optional) Install additional Linux packages to your container, packages should be separated by whitespace like this: `package1 package2 package3`. * `PACKAGES` (optional) Install additional Linux packages to your container, packages should be separated by whitespace like this: `package1 package2 package3`.
* `PACKAGES_UPDATE` (optional) Set `true` if you want to apply Linux package updates at the first start of a new container.
* `PERMISSION_CHECK` (optional, default: true) Set "false" to skip checking and correcting all relevant permissions on container startup (Use at own risk!!!) * `PERMISSION_CHECK` (optional, default: true) Set "false" to skip checking and correcting all relevant permissions on container startup (Use at own risk!!!)
* `SETGID` (default: 1000) In some cases it might be useful to specify the gid of the containers iobroker user to match an existing group on the docker host * `SETGID` (default: 1000) In some cases it might be useful to specify the gid of the containers iobroker user to match an existing group on the docker host
* `SETUID` (default: 1000) In some cases it might be useful to specify the uid of the containers iobroker user to match an existing user on the docker host * `SETUID` (default: 1000) In some cases it might be useful to specify the uid of the containers iobroker user to match an existing user on the docker host

View File

@@ -126,6 +126,7 @@ You could use environment variables to auto configure your ioBroker container on
* `LC_ALL` (optional, default: de_DE.UTF-8) The following locales are pre-generated: de_DE.UTF-8, en_US.UTF-8 * `LC_ALL` (optional, default: de_DE.UTF-8) The following locales are pre-generated: de_DE.UTF-8, en_US.UTF-8
* `OFFLINE_MODE` (optional) Set `true` if your container has no or limited internet connection * `OFFLINE_MODE` (optional) Set `true` if your container has no or limited internet connection
* `PACKAGES` (optional) Install additional Linux packages to your container, packages should be separated by whitespace like this: `package1 package2 package3`. * `PACKAGES` (optional) Install additional Linux packages to your container, packages should be separated by whitespace like this: `package1 package2 package3`.
* `PACKAGES_UPDATE` (optional) Set `true` if you want to apply Linux package updates at the first start of a new container.
* `PERMISSION_CHECK` (optional, default: true) Set "false" to skip checking and correcting all relevant permissions on container startup (Use at own risk!!!) * `PERMISSION_CHECK` (optional, default: true) Set "false" to skip checking and correcting all relevant permissions on container startup (Use at own risk!!!)
* `SETGID` (default: 1000) In some cases it might be useful to specify the gid of the containers iobroker user to match an existing group on the docker host * `SETGID` (default: 1000) In some cases it might be useful to specify the gid of the containers iobroker user to match an existing group on the docker host
* `SETUID` (default: 1000) In some cases it might be useful to specify the uid of the containers iobroker user to match an existing user on the docker host * `SETUID` (default: 1000) In some cases it might be useful to specify the uid of the containers iobroker user to match an existing user on the docker host