Use s6 style init only when s6 is not installed (#360)

Fixes #309

Signed-off-by: Wouter Born <github@maindrain.net>
pull/363/head
Wouter Born 2021-05-16 00:41:51 +02:00 committed by GitHub
parent b96cb8a4bc
commit e7bd9b55a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 20 deletions

View File

@ -78,13 +78,11 @@ fi
chown -R openhab:openhab "${OPENHAB_HOME}"
sync
# Run s6-style init continuation scripts if existent
if [ -d /etc/cont-init.d ]
then
for script in $(find /etc/cont-init.d -type f | grep -v \~ | sort)
do
. "${script}"
done
# Run s6-style init continuation scripts if dir exists and s6 is not installed
if [ -d /etc/cont-init.d ] && [ $(ls /bin/s6-* 2>/dev/null | wc -l) == 0 ]; then
for script in $(find /etc/cont-init.d -type f | grep -v \~ | sort); do
. "${script}"
done
fi
# sync again after continuation scripts have been run
@ -92,8 +90,8 @@ sync
# Use server mode with the default command when there is no pseudo-TTY
if [ "$interactive" == "false" ] && [ "$(IFS=" "; echo "$@")" == "su-exec openhab tini -s ./start.sh" ]; then
command=($@ server)
exec "${command[@]}"
command=($@ server)
exec "${command[@]}"
else
exec "$@"
exec "$@"
fi

18
debian/entrypoint vendored
View File

@ -87,13 +87,11 @@ fi
chown -R openhab:openhab "${OPENHAB_HOME}"
sync
# Run s6-style init continuation scripts if existent
if [ -d /etc/cont-init.d ]
then
for script in $(find /etc/cont-init.d -type f | grep -v \~ | sort)
do
. "${script}"
done
# Run s6-style init continuation scripts if dir exists and s6 is not installed
if [ -d /etc/cont-init.d ] && [ $(ls /usr/bin/s6-* 2>/dev/null | wc -l) == 0 ]; then
for script in $(find /etc/cont-init.d -type f | grep -v \~ | sort); do
. "${script}"
done
fi
# sync again after continuation scripts have been run
@ -101,8 +99,8 @@ sync
# Use server mode with the default command when there is no pseudo-TTY
if [ "$interactive" == "false" ] && [ "$(IFS=" "; echo "$@")" == "gosu openhab tini -s ./start.sh" ]; then
command=($@ server)
exec "${command[@]}"
command=($@ server)
exec "${command[@]}"
else
exec "$@"
exec "$@"
fi