Skip to content

Commit

Permalink
Migrate add-on layout to S6 Overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
casse-boubou committed Oct 18, 2023
1 parent ce1776a commit b7cfde4
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 42 deletions.
10 changes: 0 additions & 10 deletions p2pool/rootfs/etc/cont-init.d/30-config.sh

This file was deleted.

Empty file.
27 changes: 27 additions & 0 deletions p2pool/rootfs/etc/s6-overlay/s6-rc.d/p2pool/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# Take down the S6 supervision tree when P2pool fails
# ==============================================================================
declare exit_code
readonly exit_code_container=$(</run/s6-linux-init-container-results/exitcode)
readonly exit_code_service="${1}"
readonly exit_code_signal="${2}"
readonly service="P2pool"

bashio::log.info \
"Service ${service} exited with code ${exit_code_service}" \
"(by signal ${exit_code_signal})"

if [[ "${exit_code_service}" -eq 256 ]]; then
if [[ "${exit_code_container}" -eq 0 ]]; then
echo $((128 + $exit_code_signal)) > /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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/with-contenv bashio
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Add-on: P2pool
Expand Down
1 change: 1 addition & 0 deletions p2pool/rootfs/etc/s6-overlay/s6-rc.d/p2pool/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
27 changes: 27 additions & 0 deletions p2pool/rootfs/etc/s6-overlay/s6-rc.d/status_commande/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# Take down the S6 supervision tree when status_commande fails
# ==============================================================================
declare exit_code
readonly exit_code_container=$(</run/s6-linux-init-container-results/exitcode)
readonly exit_code_service="${1}"
readonly exit_code_signal="${2}"
readonly service="Status_Commande"

bashio::log.info \
"Service ${service} exited with code ${exit_code_service}" \
"(by signal ${exit_code_signal})"

if [[ "${exit_code_service}" -eq 256 ]]; then
if [[ "${exit_code_container}" -eq 0 ]]; then
echo $((128 + $exit_code_signal)) > /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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/with-contenv bashio
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Add-on: P2pool
Expand Down
1 change: 1 addition & 0 deletions p2pool/rootfs/etc/s6-overlay/s6-rc.d/status_commande/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
Empty file.
15 changes: 0 additions & 15 deletions p2pool/rootfs/etc/services.d/p2pool/finish

This file was deleted.

15 changes: 0 additions & 15 deletions p2pool/rootfs/etc/services.d/status_commande/finish

This file was deleted.

0 comments on commit b7cfde4

Please sign in to comment.