mirror of
https://github.com/hassio-addons/addon-motioneye.git
synced 2025-05-04 11:11:29 +00:00
Migrate old-style base scripts s6-rc
This commit is contained in:
parent
86895dc82b
commit
4ca874237d
29 changed files with 72 additions and 27 deletions
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: motionEye
|
||||
# Send Discovery information to Home Assistant
|
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/discovery/type
Normal file
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/discovery/type
Normal file
|
@ -0,0 +1 @@
|
|||
oneshot
|
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/discovery/up
Normal file
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/discovery/up
Normal file
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/discovery/run
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: motionEye
|
||||
# Creates initial motionEye configuration in case it is non-existing
|
|
@ -0,0 +1 @@
|
|||
oneshot
|
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/init-motioneye/run
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: motionEye
|
||||
# Configures NGINX for use with motionEye
|
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/type
Normal file
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/type
Normal file
|
@ -0,0 +1 @@
|
|||
oneshot
|
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/up
Normal file
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/up
Normal file
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/init-nginx/run
|
|
@ -0,0 +1 @@
|
|||
|
27
motioneye/rootfs/etc/s6-overlay/s6-rc.d/motioneye/finish
Executable file
27
motioneye/rootfs/etc/s6-overlay/s6-rc.d/motioneye/finish
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: motionEye
|
||||
# Take down the S6 supervision tree when motionEye 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="motionEye"
|
||||
|
||||
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
|
|
@ -1,11 +1,11 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: motionEye
|
||||
# Runs the motionEye
|
||||
# ==============================================================================
|
||||
declare -a options
|
||||
|
||||
|
||||
bashio::log.info "Starting motionEye..."
|
||||
|
||||
options+=(-c /data/motioneye/motioneye.conf)
|
||||
|
@ -15,8 +15,5 @@ if bashio::debug; then
|
|||
options+=(-d)
|
||||
fi
|
||||
|
||||
# Send out discovery information
|
||||
./discovery &
|
||||
|
||||
# Run the motionEye
|
||||
exec meyectl startserver "${options[@]}"
|
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/motioneye/type
Normal file
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/motioneye/type
Normal file
|
@ -0,0 +1 @@
|
|||
longrun
|
26
motioneye/rootfs/etc/s6-overlay/s6-rc.d/nginx/finish
Executable file
26
motioneye/rootfs/etc/s6-overlay/s6-rc.d/nginx/finish
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/command/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: motionEye
|
||||
# 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
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: motionEye
|
||||
# Runs the Nginx daemon
|
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/nginx/type
Normal file
1
motioneye/rootfs/etc/s6-overlay/s6-rc.d/nginx/type
Normal file
|
@ -0,0 +1 @@
|
|||
longrun
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: motionEye
|
||||
# Take down the S6 supervision tree when motionEye fails
|
||||
# ==============================================================================
|
||||
if -n { s6-test $# -ne 0 }
|
||||
if -n { s6-test ${1} -eq 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: motionEye
|
||||
# Take down the S6 supervision tree when Nginx fails
|
||||
# ==============================================================================
|
||||
if -n { s6-test $# -ne 0 }
|
||||
if -n { s6-test ${1} -eq 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
Loading…
Add table
Add a link
Reference in a new issue