#!/usr/bin/with-contenv bashio # shellcheck shell=bash # ============================================================================== # Wait for transmission to become available bashio::net.wait_for 7878 localhost 900 # Set Config location CONFIG_LOCATION=/config/addons_config/radarr/config.xml 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 "/radarr" "$CONFIG_LOCATION" && ! bashio::config.true "ingress_disabled"; then bashio::log.warning "BaseUrl not set properly, restarting" sed -i "/UrlBase/d" "$CONFIG_LOCATION" sed -i "//a \/radarr<\/UrlBase>" "$CONFIG_LOCATION" bashio::addon.restart fi # Disable Ingress if bashio::config.true "ingress_disabled"; then bashio::log.info "Ingress is disabled, removing base url" # Remove BaseUrl if grep -q "radarr" "$CONFIG_LOCATION"; then bashio::log.warning "BaseUrl removed, restarting" sed -i "/radarr/d" "$CONFIG_LOCATION" bashio::addon.restart fi fi bashio::log.info "Starting NGinx..." exec nginx