diff --git a/chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/dependencies.d/init-chrony b/chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/dependencies.d/init-chrony new file mode 100644 index 0000000..e69de29 diff --git a/chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/finish b/chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/finish new file mode 100755 index 0000000..9bd4061 --- /dev/null +++ b/chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/finish @@ -0,0 +1,27 @@ +#!/command/with-contenv bashio +# shellcheck shell=bash +# ============================================================================== +# Home Assistant Community Add-on: chrony +# Take down the S6 supervision tree when chrony 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/chrony/rootfs/etc/services.d/chronyd/run b/chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/run similarity index 94% rename from chrony/rootfs/etc/services.d/chronyd/run rename to chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/run index 91a7ded..513bcf1 100755 --- a/chrony/rootfs/etc/services.d/chronyd/run +++ b/chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/run @@ -1,4 +1,5 @@ #!/command/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: chrony # Runs chrony daemon diff --git a/chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/type b/chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/chrony/rootfs/etc/s6-overlay/s6-rc.d/chrony/type @@ -0,0 +1 @@ +longrun diff --git a/chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/dependencies.d/base b/chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/dependencies.d/base new file mode 100644 index 0000000..e69de29 diff --git a/chrony/rootfs/etc/cont-init.d/chrony.sh b/chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/run similarity index 98% rename from chrony/rootfs/etc/cont-init.d/chrony.sh rename to chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/run index 03ac74e..04d821f 100755 --- a/chrony/rootfs/etc/cont-init.d/chrony.sh +++ b/chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/run @@ -1,4 +1,5 @@ #!/command/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: chrony # Configures chrony diff --git a/chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/type b/chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/type @@ -0,0 +1 @@ +oneshot diff --git a/chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/up b/chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/up new file mode 100644 index 0000000..ffa2046 --- /dev/null +++ b/chrony/rootfs/etc/s6-overlay/s6-rc.d/init-chrony/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-chrony/run diff --git a/chrony/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/chrony b/chrony/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/chrony new file mode 100644 index 0000000..e69de29 diff --git a/chrony/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-chrony b/chrony/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-chrony new file mode 100644 index 0000000..e69de29 diff --git a/chrony/rootfs/etc/services.d/chronyd/finish b/chrony/rootfs/etc/services.d/chronyd/finish deleted file mode 100755 index e7920df..0000000 --- a/chrony/rootfs/etc/services.d/chronyd/finish +++ /dev/null @@ -1,11 +0,0 @@ -#!/command/with-contenv bashio -# ============================================================================== -# Home Assistant Community Add-on: chrony -# Take down the S6 supervision tree when chrony fails -# ============================================================================== -if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then - bashio::log.warning "chrony crashed, halting add-on" - /run/s6/basedir/bin/halt -fi - -bashio::log.info "chrony stopped, restarting..."