Skip to content

Commit

Permalink
🔨 Migrate old-style base scripts s6-rc (#449)
Browse files Browse the repository at this point in the history
* 🔨 Migrate old-style base scripts s6-rc

* Remove incorrect comments

* ⬆️ Upgrades python3-dev to 3.10.9-r1
  • Loading branch information
frenck committed Dec 12, 2022
1 parent ddf6da2 commit 7931adc
Show file tree
Hide file tree
Showing 29 changed files with 66 additions and 23 deletions.
2 changes: 1 addition & 1 deletion zwave-js-ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN \
build-base=0.5-r3 \
linux-headers=5.19.5-r0 \
npm=9.1.2-r0 \
python3-dev=3.10.9-r0 \
python3-dev=3.10.9-r1 \
\
&& apk add --no-cache \
eudev=3.2.11-r4 \
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Community Add-on: Z-Wave JS UI
# Send zwave_js discovery information to Home Assistant
Expand Down
1 change: 1 addition & 0 deletions zwave-js-ui/rootfs/etc/s6-overlay/s6-rc.d/discovery/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions zwave-js-ui/rootfs/etc/s6-overlay/s6-rc.d/discovery/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/discovery/run
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Community Add-on: Z-Wave JS UI
# Configures NGINX for use with this add-on.
Expand Down
1 change: 1 addition & 0 deletions zwave-js-ui/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions zwave-js-ui/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-nginx/run
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Community Add-on: Z-Wave JS UI
# Creates store folder if it doesn't exists yet
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-zwave-js-ui/run
Empty file.
Empty file.
26 changes: 26 additions & 0 deletions zwave-js-ui/rootfs/etc/s6-overlay/s6-rc.d/nginx/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/command/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: Z-Wave JS UI
# Take down the S6 supervision tree when Nginx 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="NGINX"

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
File renamed without changes.
1 change: 1 addition & 0 deletions zwave-js-ui/rootfs/etc/s6-overlay/s6-rc.d/nginx/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
27 changes: 27 additions & 0 deletions zwave-js-ui/rootfs/etc/s6-overlay/s6-rc.d/zwave-js-ui/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Community Add-on: Z-Wave JS UI
# Take down the S6 supervision tree when Z-Wave JS UI 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="Z-Wave JS UI"

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,5 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Community Add-on: Z-Wave JS UI
# Starts zwave-js-ui
Expand Down
1 change: 1 addition & 0 deletions zwave-js-ui/rootfs/etc/s6-overlay/s6-rc.d/zwave-js-ui/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
11 changes: 0 additions & 11 deletions zwave-js-ui/rootfs/etc/services.d/nginx/finish

This file was deleted.

11 changes: 0 additions & 11 deletions zwave-js-ui/rootfs/etc/services.d/zwave-js-ui/finish

This file was deleted.

0 comments on commit 7931adc

Please sign in to comment.