add error handling for user scripts

This commit is contained in:
buanet
2023-10-11 09:20:33 +02:00
parent 10de4b1a55
commit 814cfae657
3 changed files with 19 additions and 16 deletions

View File

@@ -1 +1 @@
v9.0.1 v9.1.0-beta.1

View File

@@ -1,5 +1,9 @@
## Changelog ## Changelog
### v9.1.0-beta.1 (coming soon)
* enhance logging in iobroker_startup.sh
* add error handling for user scripts
### v9.0.1 (10.10.2023) ### 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)) * 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 silent cleanup to setup_avahi.sh

View File

@@ -133,11 +133,7 @@ if [[ -f /opt/.docker_config/.first_run ]]; then
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 else
if bash /opt/scripts/setup_packages.sh -update; then if ! bash /opt/scripts/setup_packages.sh -update; then echo "Failed."; fi
echo " "
else
echo "Error: Updating failed."
fi
fi fi
echo " " echo " "
# Installing packages from ENV # Installing packages from ENV
@@ -145,11 +141,7 @@ if [[ -f /opt/.docker_config/.first_run ]]; 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"
if bash /opt/scripts/setup_packages.sh -install; then if ! bash /opt/scripts/setup_packages.sh -install; then echo "Failed."; fi
echo " "
else
echo "Error: Installation failed."
fi
fi fi
echo " " echo " "
# Register maintenance script # Register maintenance script
@@ -505,17 +497,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