mirror of
https://github.com/hassio-addons/addon-vscode.git
synced 2025-05-03 18:51:23 +00:00
🔨 Migrate old-style base scripts s6-rc (#546)
This commit is contained in:
parent
dc9c456ac7
commit
c723527552
27 changed files with 43 additions and 13 deletions
27
vscode/rootfs/etc/s6-overlay/s6-rc.d/code-server/finish
Executable file
27
vscode/rootfs/etc/s6-overlay/s6-rc.d/code-server/finish
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Studio Code Server
|
||||
# Take down the S6 supervision tree when the code server 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="code-server"
|
||||
|
||||
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,12 +1,13 @@
|
|||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Studio Code Server
|
||||
# Runs the code server
|
||||
# Runs the code-server
|
||||
# ==============================================================================
|
||||
declare -a options
|
||||
declare config_path
|
||||
|
||||
bashio::log.info 'Starting the code server...'
|
||||
bashio::log.info 'Starting code-server...'
|
||||
|
||||
config_path="/config"
|
||||
if bashio::config.has_value 'config_path'; then
|
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/code-server/type
Normal file
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/code-server/type
Normal file
|
@ -0,0 +1 @@
|
|||
longrun
|
|
@ -1,4 +1,5 @@
|
|||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Studio Code Server
|
||||
# Sets up code-server.
|
|
@ -0,0 +1 @@
|
|||
oneshot
|
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-code-server/up
Normal file
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-code-server/up
Normal file
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/init-code-server/run
|
|
@ -1,4 +1,5 @@
|
|||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Studio Code Server
|
||||
# Pre-configures the Mosquitto clients, if the service is available
|
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-mosquitto/type
Normal file
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-mosquitto/type
Normal file
|
@ -0,0 +1 @@
|
|||
oneshot
|
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-mosquitto/up
Normal file
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-mosquitto/up
Normal file
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/init-mosquitto/run
|
|
@ -1,4 +1,5 @@
|
|||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Studio Code Server
|
||||
# Pre-configures the MySQL clients, if the service is available
|
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-mysql/type
Normal file
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-mysql/type
Normal file
|
@ -0,0 +1 @@
|
|||
oneshot
|
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-mysql/up
Normal file
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-mysql/up
Normal file
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/init-mysql/run
|
|
@ -1,4 +1,5 @@
|
|||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Studio Code Server
|
||||
# Persists user settings and installs custom user packages.
|
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/type
Normal file
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/type
Normal file
|
@ -0,0 +1 @@
|
|||
oneshot
|
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/up
Normal file
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/up
Normal file
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/init-user/run
|
|
@ -1,11 +0,0 @@
|
|||
#!/command/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Studio Code Server
|
||||
# Take down the S6 supervision tree when the code server fails
|
||||
# ==============================================================================
|
||||
if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then
|
||||
bashio::log.warning "code-server crashed, halting add-on"
|
||||
exec /run/s6/basedir/bin/halt
|
||||
fi
|
||||
|
||||
bashio::log.info "code-server stopped, restarting..."
|
Loading…
Add table
Add a link
Reference in a new issue