mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-28 19:34:05 +02:00
Initial build https://github.com/alexbelgium/hassio-addons/issues/581
This commit is contained in:
8
autobrr/rootfs/etc/services.d/nginx/finish
Normal file
8
autobrr/rootfs/etc/services.d/nginx/finish
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree when Nginx fails
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
29
autobrr/rootfs/etc/services.d/nginx/run
Normal file
29
autobrr/rootfs/etc/services.d/nginx/run
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
|
||||
# Set variables
|
||||
slug=autobrr
|
||||
port=7474
|
||||
CONFIG_LOCATION=/config/addons_config/"$slug"/config.xml
|
||||
|
||||
# Wait for transmission to become available
|
||||
bashio::net.wait_for "$port" localhost 900
|
||||
|
||||
if bashio::config.has_value 'CONFIG_LOCATION'; then
|
||||
CONFIG_LOCATION="$(bashio::config 'CONFIG_LOCATION')"
|
||||
# Modify if it is a base directory
|
||||
if [[ "$CONFIG_LOCATION" == *.* ]]; then CONFIG_LOCATION="$(dirname $CONFIG_LOCATION)"; fi
|
||||
CONFIG_LOCATION="$CONFIG_LOCATION"/config.xml
|
||||
fi
|
||||
|
||||
# Set UrlBase
|
||||
if ! grep -q "<UrlBase>/hassioautobrr</UrlBase>" "$CONFIG_LOCATION" && ! bashio::config.true "ingress_disabled"; then
|
||||
bashio::log.warning "BaseUrl not set properly, restarting"
|
||||
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
|
||||
sed -i "/<Config>/a <UrlBase>\/hassioautobrr<\/UrlBase>" "$CONFIG_LOCATION"
|
||||
bashio::addon.restart
|
||||
fi
|
||||
|
||||
bashio::log.info "Starting NGinx..."
|
||||
exec nginx
|
||||
Reference in New Issue
Block a user