small fixes

This commit is contained in:
buanet
2022-11-24 21:28:54 +01:00
parent 2102d18299
commit eb32aa20b1

View File

@@ -128,7 +128,7 @@ if [[ -f /opt/.firstrun ]]; 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 ' ' echo ' '
else else
echo "Updating Linux packages on first run..." echo "Updating Linux packages on first run... "
bash /opt/scripts/setup_packages.sh -update bash /opt/scripts/setup_packages.sh -update
echo 'Done.' echo 'Done.'
echo ' ' echo ' '
@@ -139,7 +139,7 @@ if [[ -f /opt/.firstrun ]]; then
echo ' ' echo ' '
elif [[ "$packages" != "" ]]; then 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 "Checking the following packages:" $packages"... "
echo $packages > /opt/scripts/.docker_config/.packages echo $packages > /opt/scripts/.docker_config/.packages
bash /opt/scripts/setup_packages.sh -install bash /opt/scripts/setup_packages.sh -install
echo 'Done.' echo 'Done.'
@@ -291,8 +291,8 @@ else
fi fi
# extended debug output # extended debug output
if [[ "$debug" == "true" ]]; then if [[ "$debug" == "true" && "$multihost" != "slave" ]]; then
echo "[DEBUG] Collecting some more ioBroker debug information..." echo "[DEBUG] Collecting some more ioBroker debug information... "
echo ' ' echo ' '
# get information and send to array # get information and send to array
IFS=$'\n' IFS=$'\n'
@@ -349,7 +349,7 @@ fi
# Checking ENV for Backitup (external database backups) # Checking ENV for Backitup (external database backups)
if [[ "$backitup" == "true" ]]; then 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 'true' > /opt/scripts/.docker_config/.backitup
echo 'Done.' echo 'Done.'
echo ' ' echo ' '
@@ -359,7 +359,7 @@ fi
if [[ "$avahi" = "true" && "$offlinemode" = "true" ]]; then 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 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 chmod 755 /opt/scripts/setup_avahi.sh
bash /opt/scripts/setup_avahi.sh bash /opt/scripts/setup_avahi.sh
echo 'Done.' echo 'Done.'
@@ -370,7 +370,7 @@ fi
if [[ "$zwave" = "true" && "$offlinemode" = "true" ]]; then 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 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 chmod 755 /opt/scripts/setup_zwave.sh
bash /opt/scripts/setup_zwave.sh bash /opt/scripts/setup_zwave.sh
echo 'Done.' echo 'Done.'
@@ -393,7 +393,6 @@ if [[ "$usbdevices" != "" && "$usbdevices" != "none" ]]; then
echo "Looks like the device \""$i"\" does not exist." echo "Looks like the device \""$i"\" does not exist."
echo "Please check your container config and start over." 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 "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 stop_on_error
fi fi
done done
@@ -402,7 +401,7 @@ fi
# Checking ENV for multihost setup # Checking ENV for multihost setup
if [[ "$multihost" != "" ]]; then if [[ "$multihost" != "" ]]; then
echo "Checking for multihost settings..." echo "Checking for multihost settings... "
# Configuring objects db host # Configuring objects db host
if [[ "$multihost" = "master" && "$objectsdbtype" = "" && "$objectsdbhost" = "" && "$objectsdbport" = "" ]]; then if [[ "$multihost" = "master" && "$objectsdbtype" = "" && "$objectsdbhost" = "" && "$objectsdbport" = "" ]]; then
echo "IOB_MULTIHOST is set to \"master\" and no external objects db is set." 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 # Checking ENVs for custom setup of objects db
if [[ "$objectsdbtype" != "" || "$objectsdbhost" != "" || "$objectsdbport" != "" ]]; then 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 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 "IOB_OBJECTSDB_TYPE is set and value is different from detected ioBroker installation."
echo -n "Setting type of objects db to \""$objectsdbtype"\"... " echo -n "Setting type of objects db to \""$objectsdbtype"\"... "
@@ -499,7 +498,7 @@ fi
# Checking ENVs for custom setup of states db # Checking ENVs for custom setup of states db
if [[ "$statesdbtype" != "" || "$statesdbhost" != "" || "$statesdbport" != "" ]]; then 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 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 "IOB_STATESDB_TYPE is set and value is different from detected ioBroker installation."
echo -n "Setting type of states db to \""$statesdbtype"\"... " 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 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 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 "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 bash /opt/userscripts/userscript_firststart.sh
echo 'Done.' echo 'Done.'
echo ' ' echo ' '
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 bash /opt/userscripts/userscript_everystart.sh
echo 'Done.' echo 'Done.'
@@ -569,7 +568,7 @@ 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... "
echo ' ' echo ' '
echo "##### #### ### ## # iobroker.js-controller log output # ## ### #### #####" echo "##### #### ### ## # iobroker.js-controller log output # ## ### #### #####"
@@ -580,7 +579,7 @@ echo "running" > /opt/scripts/.docker_config/.healthcheck
shut_down() { shut_down() {
echo ' ' echo ' '
echo "Recived termination signal (SIGTERM)." echo "Recived termination signal (SIGTERM)."
echo "Shutting down ioBroker..." echo "Shutting down ioBroker... "
local status timeout local status timeout
@@ -598,7 +597,7 @@ shut_down() {
# pgrep exits with status 1 when there are no matches # pgrep exits with status 1 when there are no matches
while pgrep -u iobroker > /dev/null; (( $? != 1 )); do while pgrep -u iobroker > /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... '
pkill --signal SIGKILL -u iobroker pkill --signal SIGKILL -u iobroker
echo 'Done. Have a nice day!' echo 'Done. Have a nice day!'
exit exit