diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/dependencies.d/init-tvheadend b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/dependencies.d/init-tvheadend new file mode 100644 index 00000000..e69de29b diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/finish b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/finish new file mode 100644 index 00000000..711a1d5d --- /dev/null +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/finish @@ -0,0 +1,27 @@ +#!/command/with-contenv bashio +# shellcheck shell=bash +# ============================================================================== +# Home Assistant Community Add-on: TVHeadend +# Take down the S6 supervision tree when cron fails +# ============================================================================== +declare exit_code +readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + fi + [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt +elif [[ "${exit_code_service}" -ne 0 ]]; then + if [[ "${exit_code_container}" -eq 0 ]]; then + echo "${exit_code_service}" > /run/s6-linux-init-container-results/exitcode + fi + exec /run/s6/basedir/bin/halt +fi diff --git a/tvheadend/rootfs/etc/services.d/cron/run b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/run similarity index 93% rename from tvheadend/rootfs/etc/services.d/cron/run rename to tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/run index b94b1274..d5791e1b 100644 --- a/tvheadend/rootfs/etc/services.d/cron/run +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: TVHeadend # Runs the cron daemon diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/type b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/type new file mode 100644 index 00000000..1780f9f4 --- /dev/null +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/cron/type @@ -0,0 +1 @@ +longrun \ No newline at end of file diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/dependencies.d/base b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/dependencies.d/base new file mode 100644 index 00000000..e69de29b diff --git a/tvheadend/rootfs/etc/cont-init.d/customizations.sh b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/run similarity index 97% rename from tvheadend/rootfs/etc/cont-init.d/customizations.sh rename to tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/run index d8f92588..0f2c8057 100644 --- a/tvheadend/rootfs/etc/cont-init.d/customizations.sh +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: TVHeadend # Executes user customizations on startup diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/type b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/type new file mode 100644 index 00000000..3d92b15f --- /dev/null +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/up b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/up new file mode 100644 index 00000000..f3db9e85 --- /dev/null +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-customizations/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-customizations/run diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/dependencies.d/init-customizations b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/dependencies.d/init-customizations new file mode 100644 index 00000000..e69de29b diff --git a/tvheadend/rootfs/etc/cont-init.d/tvheadend.sh b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/run similarity index 99% rename from tvheadend/rootfs/etc/cont-init.d/tvheadend.sh rename to tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/run index f801082c..b76a1383 100644 --- a/tvheadend/rootfs/etc/cont-init.d/tvheadend.sh +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: TVHeadend # Executes user customizations on startup diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/type b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/type new file mode 100644 index 00000000..3d92b15f --- /dev/null +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/up b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/up new file mode 100644 index 00000000..12519040 --- /dev/null +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-tvheadend/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-tvheadend/run diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/dependencies.d/init-tvheadend b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/dependencies.d/init-tvheadend new file mode 100644 index 00000000..e69de29b diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/finish b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/finish new file mode 100644 index 00000000..2fccdf84 --- /dev/null +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/finish @@ -0,0 +1,27 @@ +#!/command/with-contenv bashio +# shellcheck shell=bash +# ============================================================================== +# Home Assistant Community Add-on: TVHeadend +# Take down the S6 supervision tree when tvheadend fails +# ============================================================================== +declare exit_code +readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + fi + [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt +elif [[ "${exit_code_service}" -ne 0 ]]; then + if [[ "${exit_code_container}" -eq 0 ]]; then + echo "${exit_code_service}" > /run/s6-linux-init-container-results/exitcode + fi + exec /run/s6/basedir/bin/halt +fi diff --git a/tvheadend/rootfs/etc/services.d/tvheadend/run b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/run similarity index 93% rename from tvheadend/rootfs/etc/services.d/tvheadend/run rename to tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/run index fa1eb93e..2ddf5f4b 100644 --- a/tvheadend/rootfs/etc/services.d/tvheadend/run +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: TVHeadend # Starts TVHeadend diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/type b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/type new file mode 100644 index 00000000..1780f9f4 --- /dev/null +++ b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/tvheadend/type @@ -0,0 +1 @@ +longrun \ No newline at end of file diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/cron b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/cron new file mode 100644 index 00000000..e69de29b diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-customizations b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-customizations new file mode 100644 index 00000000..e69de29b diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-tvheadend b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-tvheadend new file mode 100644 index 00000000..e69de29b diff --git a/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/tvheadend b/tvheadend/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/tvheadend new file mode 100644 index 00000000..e69de29b diff --git a/tvheadend/rootfs/etc/services.d/cron/finish b/tvheadend/rootfs/etc/services.d/cron/finish deleted file mode 100644 index 2809cd78..00000000 --- a/tvheadend/rootfs/etc/services.d/cron/finish +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/execlineb -S0 -# ============================================================================== -# Home Assistant Community Add-on: TVHeadend -# Take down the S6 supervision tree when crond fails -# ============================================================================== -if -n { s6-test $# -ne 0 } -if -n { s6-test ${1} -eq 256 } - -s6-svscanctl -t /var/run/s6/services diff --git a/tvheadend/rootfs/etc/services.d/tvheadend/finish b/tvheadend/rootfs/etc/services.d/tvheadend/finish deleted file mode 100644 index 00c21cfb..00000000 --- a/tvheadend/rootfs/etc/services.d/tvheadend/finish +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/execlineb -S0 -# ============================================================================== -# Home Assistant Community Add-on: TVHeadend -# Take down the S6 supervision tree when TVHeadend fails -# ============================================================================== -if -n { s6-test $# -ne 0 } -if -n { s6-test ${1} -eq 256 } - -s6-svscanctl -t /var/run/s6/services