diff --git a/zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/dependencies.d/base b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/dependencies.d/base new file mode 100644 index 0000000..e69de29 diff --git a/zerotier/rootfs/etc/cont-init.d/zerotier.sh b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/run similarity index 98% rename from zerotier/rootfs/etc/cont-init.d/zerotier.sh rename to zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/run index a005303..370d17a 100755 --- a/zerotier/rootfs/etc/cont-init.d/zerotier.sh +++ b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/run @@ -1,4 +1,5 @@ #!/command/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: ZeroTier One # Generates an identiy in case it does not exists yet diff --git a/zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/type b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/type @@ -0,0 +1 @@ +oneshot diff --git a/zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/up b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/up new file mode 100644 index 0000000..bef0a09 --- /dev/null +++ b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/init-zerotier/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-zerotier/run diff --git a/zerotier/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-zerotier b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-zerotier new file mode 100644 index 0000000..e69de29 diff --git a/zerotier/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/zerotier b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/zerotier new file mode 100644 index 0000000..e69de29 diff --git a/zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/dependencies.d/init-zerotier b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/dependencies.d/init-zerotier new file mode 100644 index 0000000..e69de29 diff --git a/zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/finish b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/finish new file mode 100755 index 0000000..804d21a --- /dev/null +++ b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/finish @@ -0,0 +1,27 @@ +#!/command/with-contenv bashio +# shellcheck shell=bash +# ============================================================================== +# Home Assistant Community Add-on: ZeroTier One +# Take down the S6 supervision tree when ZeroTier 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/zerotier/rootfs/etc/services.d/zerotier/run b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/run similarity index 95% rename from zerotier/rootfs/etc/services.d/zerotier/run rename to zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/run index 2866cfc..e5e5c9e 100755 --- a/zerotier/rootfs/etc/services.d/zerotier/run +++ b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/run @@ -1,4 +1,5 @@ #!/command/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: ZeroTier One # Runs ZeroTier One diff --git a/zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/type b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/zerotier/rootfs/etc/s6-overlay/s6-rc.d/zerotier/type @@ -0,0 +1 @@ +longrun diff --git a/zerotier/rootfs/etc/services.d/zerotier/finish b/zerotier/rootfs/etc/services.d/zerotier/finish deleted file mode 100755 index dd03827..0000000 --- a/zerotier/rootfs/etc/services.d/zerotier/finish +++ /dev/null @@ -1,11 +0,0 @@ -#!/command/with-contenv bashio -# ============================================================================== -# Home Assistant Community Add-on: ZeroTier One -# Take down the S6 supervision tree when ZeroTier fails -# ============================================================================== -if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then - bashio::log.warning "ZeroTier crashed, halting add-on" - /run/s6/basedir/bin/halt -fi - -bashio::log.info "ZeroTier stopped, restarting..."