mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-09 17:31:03 +01:00
fix: auto-fix linting issues
This commit is contained in:
committed by
github-actions[bot]
parent
205a7e9b84
commit
0d3c7619b4
@@ -20,7 +20,7 @@ validate_string() {
|
|||||||
bashio::log.fatal "Expected: $description"
|
bashio::log.fatal "Expected: $description"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
return 0 # Optional field not provided
|
return 0 # Optional field not provided
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ validate_path() {
|
|||||||
# Normalize path and check if it's within base path
|
# Normalize path and check if it's within base path
|
||||||
local full_path="$base_path/$value"
|
local full_path="$base_path/$value"
|
||||||
local real_path
|
local real_path
|
||||||
real_path=$(realpath -m "$full_path" 2>/dev/null || echo "$full_path")
|
real_path=$(realpath -m "$full_path" 2> /dev/null || echo "$full_path")
|
||||||
local real_base
|
local real_base
|
||||||
real_base=$(realpath -m "$base_path")
|
real_base=$(realpath -m "$base_path")
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ validate_path() {
|
|||||||
# Function to validate URL
|
# Function to validate URL
|
||||||
validate_url() {
|
validate_url() {
|
||||||
local config_key="$1"
|
local config_key="$1"
|
||||||
local allowed_schemes="$2" # e.g., "http|https"
|
local allowed_schemes="$2" # e.g., "http|https"
|
||||||
local description="$3"
|
local description="$3"
|
||||||
local required="${4:-true}"
|
local required="${4:-true}"
|
||||||
|
|
||||||
|
|||||||
@@ -149,8 +149,8 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
diskname="$disk"
|
diskname="$disk"
|
||||||
diskname="${diskname//\\//}" # replace \ with /
|
diskname="${diskname//\\//}" # replace \ with /
|
||||||
diskname="${diskname##*/}" # Get only last part of the name
|
diskname="${diskname##*/}" # Get only last part of the name
|
||||||
MOUNTED=false
|
MOUNTED=false
|
||||||
|
|
||||||
# Start
|
# Start
|
||||||
|
|||||||
498
.templates/bashio-standalone.sh
Normal file → Executable file
498
.templates/bashio-standalone.sh
Normal file → Executable file
@@ -9,47 +9,50 @@
|
|||||||
|
|
||||||
# Whether to emit ANSI colors (disabled if not a TTY)
|
# Whether to emit ANSI colors (disabled if not a TTY)
|
||||||
if [ -t 1 ]; then
|
if [ -t 1 ]; then
|
||||||
_BASHIO_COLOR=1
|
_BASHIO_COLOR=1
|
||||||
else
|
else
|
||||||
_BASHIO_COLOR=0
|
_BASHIO_COLOR=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_bashio_color() {
|
_bashio_color() {
|
||||||
# $1=name; returns ANSI sequence or empty
|
# $1=name; returns ANSI sequence or empty
|
||||||
if [ "$_BASHIO_COLOR" != "1" ]; then return 0; fi
|
if [ "$_BASHIO_COLOR" != "1" ]; then return 0; fi
|
||||||
case "$1" in
|
case "$1" in
|
||||||
blue) printf '\033[34m' ;;
|
blue) printf '\033[34m' ;;
|
||||||
green) printf '\033[32m' ;;
|
green) printf '\033[32m' ;;
|
||||||
yellow) printf '\033[33m' ;;
|
yellow) printf '\033[33m' ;;
|
||||||
red) printf '\033[31m' ;;
|
red) printf '\033[31m' ;;
|
||||||
magenta) printf '\033[35m' ;;
|
magenta) printf '\033[35m' ;;
|
||||||
reset) printf '\033[0m' ;;
|
reset) printf '\033[0m' ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
_bashio_log() {
|
_bashio_log() {
|
||||||
# $1=color name, $2...=msg
|
# $1=color name, $2...=msg
|
||||||
local c="$1"; shift
|
local c="$1"
|
||||||
local pre; pre="$(_bashio_color "$c")"
|
shift
|
||||||
local rst; rst="$(_bashio_color reset)"
|
local pre
|
||||||
printf '%s%s%s\n' "$pre" "$*" "$rst"
|
pre="$(_bashio_color "$c")"
|
||||||
|
local rst
|
||||||
|
rst="$(_bashio_color reset)"
|
||||||
|
printf '%s%s%s\n' "$pre" "$*" "$rst"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optional JSON options source (single flat object or nested).
|
# Optional JSON options source (single flat object or nested).
|
||||||
# Set STANDALONE_OPTIONS_JSON to a path (e.g., /data/options.json).
|
# Set STANDALONE_OPTIONS_JSON to a path (e.g., /data/options.json).
|
||||||
# If jq is present, keys can be fetched as .key or .nested.key
|
# If jq is present, keys can be fetched as .key or .nested.key
|
||||||
_bashio_json_get() {
|
_bashio_json_get() {
|
||||||
# $1=key (dot.notation). echoes value or empty; returns 0 always
|
# $1=key (dot.notation). echoes value or empty; returns 0 always
|
||||||
local key="${1:-}"
|
local key="${1:-}"
|
||||||
local file="${STANDALONE_OPTIONS_JSON:-}"
|
local file="${STANDALONE_OPTIONS_JSON:-}"
|
||||||
if [ -z "$file" ] || [ ! -f "$file" ] || ! command -v jq >/dev/null 2>&1; then
|
if [ -z "$file" ] || [ ! -f "$file" ] || ! command -v jq > /dev/null 2>&1; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
# jq -r returns "null" for missing; convert to empty
|
# jq -r returns "null" for missing; convert to empty
|
||||||
local val
|
local val
|
||||||
val="$(jq -er --arg k "$key" '. as $r | getpath(($k|split("."))) // empty' "$file" 2>/dev/null || true)"
|
val="$(jq -er --arg k "$key" '. as $r | getpath(($k|split("."))) // empty' "$file" 2> /dev/null || true)"
|
||||||
[ "$val" = "null" ] && val=""
|
[ "$val" = "null" ] && val=""
|
||||||
printf '%s' "$val"
|
printf '%s' "$val"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Map a bashio "key" to an env var name.
|
# Map a bashio "key" to an env var name.
|
||||||
@@ -59,127 +62,128 @@ _bashio_json_get() {
|
|||||||
# 3) dot->underscore, dash->underscore (upper & lower)
|
# 3) dot->underscore, dash->underscore (upper & lower)
|
||||||
# 4) with prefixes: CFG_, CONFIG_, ADDON_, OPTION_, OPT_
|
# 4) with prefixes: CFG_, CONFIG_, ADDON_, OPTION_, OPT_
|
||||||
_bashio_env_get() {
|
_bashio_env_get() {
|
||||||
# $1=key
|
# $1=key
|
||||||
local key="${1:-}"
|
local key="${1:-}"
|
||||||
[ -z "$key" ] && return 0
|
[ -z "$key" ] && return 0
|
||||||
|
|
||||||
local variants=()
|
local variants=()
|
||||||
variants+=("$key")
|
variants+=("$key")
|
||||||
variants+=("$(printf '%s' "$key" | tr '[:lower:]' '[:upper:]')")
|
variants+=("$(printf '%s' "$key" | tr '[:lower:]' '[:upper:]')")
|
||||||
variants+=("$(printf '%s' "$key" | tr '.' '_' | tr '-' '_' )")
|
variants+=("$(printf '%s' "$key" | tr '.' '_' | tr '-' '_')")
|
||||||
variants+=("$(printf '%s' "$key" | tr '.' '_' | tr '-' '_' | tr '[:lower:]' '[:upper:]')")
|
variants+=("$(printf '%s' "$key" | tr '.' '_' | tr '-' '_' | tr '[:lower:]' '[:upper:]')")
|
||||||
|
|
||||||
local prefixes=(""
|
local prefixes=(""
|
||||||
"CFG_" "CONFIG_" "ADDON_" "OPTION_" "OPT_")
|
"CFG_" "CONFIG_" "ADDON_" "OPTION_" "OPT_")
|
||||||
|
|
||||||
local v p name
|
local v p name
|
||||||
for v in "${variants[@]}"; do
|
for v in "${variants[@]}"; do
|
||||||
for p in "${prefixes[@]}"; do
|
for p in "${prefixes[@]}"; do
|
||||||
name="${p}${v}"
|
name="${p}${v}"
|
||||||
if [ -n "${!name+x}" ]; then
|
if [ -n "${!name+x}" ]; then
|
||||||
printf '%s' "${!name}"
|
printf '%s' "${!name}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Helper: true/false parsing
|
# Helper: true/false parsing
|
||||||
_bashio_is_true() {
|
_bashio_is_true() {
|
||||||
# $1=value
|
# $1=value
|
||||||
case "${1:-}" in
|
case "${1:-}" in
|
||||||
1|true|TRUE|yes|YES|on|On) return 0 ;;
|
1 | true | TRUE | yes | YES | on | On) return 0 ;;
|
||||||
*) return 1 ;;
|
*) return 1 ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Net wait using /dev/tcp (POSIX bash) with a timeout
|
# Net wait using /dev/tcp (POSIX bash) with a timeout
|
||||||
_bashio_tcp_wait() {
|
_bashio_tcp_wait() {
|
||||||
# $1=host $2=port $3=timeout(s, default 30)
|
# $1=host $2=port $3=timeout(s, default 30)
|
||||||
local host="$1" port="$2" to="${3:-30}"
|
local host="$1" port="$2" to="${3:-30}"
|
||||||
local start now
|
local start now
|
||||||
start="$(date +%s)"
|
start="$(date +%s)"
|
||||||
while :; do
|
while :; do
|
||||||
if exec 3<>"/dev/tcp/${host}/${port}" 2>/dev/null; then
|
if exec 3<> "/dev/tcp/${host}/${port}" 2> /dev/null; then
|
||||||
exec 3>&- 3<&-
|
exec 3>&- 3<&-
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
now="$(date +%s)"
|
now="$(date +%s)"
|
||||||
if [ $((now - start)) -ge "$to" ]; then
|
if [ $((now - start)) -ge "$to" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# -------- logs ---------------------------------------------------------------
|
# -------- logs ---------------------------------------------------------------
|
||||||
|
|
||||||
bashio::log.blue() { _bashio_log blue "$*"; }
|
bashio::log.blue() { _bashio_log blue "$*"; }
|
||||||
bashio::log.green() { _bashio_log green "$*"; }
|
bashio::log.green() { _bashio_log green "$*"; }
|
||||||
bashio::log.yellow() { _bashio_log yellow "$*"; }
|
bashio::log.yellow() { _bashio_log yellow "$*"; }
|
||||||
bashio::log.red() { _bashio_log red "$*"; }
|
bashio::log.red() { _bashio_log red "$*"; }
|
||||||
bashio::log.magenta() { _bashio_log magenta "$*"; }
|
bashio::log.magenta() { _bashio_log magenta "$*"; }
|
||||||
|
|
||||||
# compatibility aliases often used
|
# compatibility aliases often used
|
||||||
bashio::log.info() { bashio::log.blue "$@"; }
|
bashio::log.info() { bashio::log.blue "$@"; }
|
||||||
bashio::log.warning() { bashio::log.yellow "$@"; }
|
bashio::log.warning() { bashio::log.yellow "$@"; }
|
||||||
bashio::log.error() { bashio::log.red "$@"; }
|
bashio::log.error() { bashio::log.red "$@"; }
|
||||||
bashio::log.debug() { printf '%s\n' "$*"; }
|
bashio::log.debug() { printf '%s\n' "$*"; }
|
||||||
|
|
||||||
# -------- supervisor & addon meta -------------------------------------------
|
# -------- supervisor & addon meta -------------------------------------------
|
||||||
|
|
||||||
# In standalone, "ping" always fails unless forced
|
# In standalone, "ping" always fails unless forced
|
||||||
bashio::supervisor.ping() {
|
bashio::supervisor.ping() {
|
||||||
if _bashio_is_true "${STANDALONE_FORCE_SUPERVISOR_PING:-}"; then
|
if _bashio_is_true "${STANDALONE_FORCE_SUPERVISOR_PING:-}"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add-on metadata (use env or sensible defaults)
|
# Add-on metadata (use env or sensible defaults)
|
||||||
bashio::addon.name() { printf '%s' "${ADDON_NAME:-Standalone container}"; }
|
bashio::addon.name() { printf '%s' "${ADDON_NAME:-Standalone container}"; }
|
||||||
bashio::addon.description() { printf '%s' "${ADDON_DESCRIPTION:-Running without Home Assistant Supervisor}"; }
|
bashio::addon.description() { printf '%s' "${ADDON_DESCRIPTION:-Running without Home Assistant Supervisor}"; }
|
||||||
bashio::addon.version() { printf '%s' "${BUILD_VERSION:-1.0}"; }
|
bashio::addon.version() { printf '%s' "${BUILD_VERSION:-1.0}"; }
|
||||||
bashio::addon.version_latest(){ printf '%s' "${ADDON_VERSION_LATEST:-${BUILD_VERSION:-1.0}}"; }
|
bashio::addon.version_latest() { printf '%s' "${ADDON_VERSION_LATEST:-${BUILD_VERSION:-1.0}}"; }
|
||||||
bashio::addon.update_available() {
|
bashio::addon.update_available() {
|
||||||
if [ "${ADDON_VERSION_LATEST:-}" != "" ] && [ "${ADDON_VERSION_LATEST:-}" != "${BUILD_VERSION:-}" ]; then
|
if [ "${ADDON_VERSION_LATEST:-}" != "" ] && [ "${ADDON_VERSION_LATEST:-}" != "${BUILD_VERSION:-}" ]; then
|
||||||
printf '%s' "true"; return 0
|
printf '%s' "true"
|
||||||
fi
|
return 0
|
||||||
printf '%s' "false"
|
fi
|
||||||
|
printf '%s' "false"
|
||||||
}
|
}
|
||||||
bashio::addon.ingress_port() { printf '%s' "${ADDON_INGRESS_PORT:-}"; }
|
bashio::addon.ingress_port() { printf '%s' "${ADDON_INGRESS_PORT:-}"; }
|
||||||
bashio::addon.ingress_entry() { printf '%s' "${ADDON_INGRESS_ENTRY:-}"; }
|
bashio::addon.ingress_entry() { printf '%s' "${ADDON_INGRESS_ENTRY:-}"; }
|
||||||
bashio::addon.ip_address() { printf '%s' "${ADDON_IP_ADDRESS:-}"; }
|
bashio::addon.ip_address() { printf '%s' "${ADDON_IP_ADDRESS:-}"; }
|
||||||
|
|
||||||
# Ports:
|
# Ports:
|
||||||
# - numeric arg "8080" -> env PORT_8080 or ADDON_PORT_8080, falling back to the number
|
# - numeric arg "8080" -> env PORT_8080 or ADDON_PORT_8080, falling back to the number
|
||||||
# - non-numeric "WEB_PORT" -> resolve as config/env key
|
# - non-numeric "WEB_PORT" -> resolve as config/env key
|
||||||
bashio::addon.port() {
|
bashio::addon.port() {
|
||||||
local arg="${1:-}"
|
local arg="${1:-}"
|
||||||
if [[ "$arg" =~ ^[0-9]+$ ]]; then
|
if [[ "$arg" =~ ^[0-9]+$ ]]; then
|
||||||
local v
|
local v
|
||||||
v="$(_bashio_env_get "PORT_${arg}")"
|
v="$(_bashio_env_get "PORT_${arg}")"
|
||||||
[ -z "$v" ] && v="$(_bashio_env_get "ADDON_PORT_${arg}")"
|
[ -z "$v" ] && v="$(_bashio_env_get "ADDON_PORT_${arg}")"
|
||||||
printf '%s' "${v:-$arg}"
|
printf '%s' "${v:-$arg}"
|
||||||
else
|
else
|
||||||
printf '%s' "$(_bashio_env_get "$arg")"
|
printf '%s' "$(_bashio_env_get "$arg")"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# -------- system info --------------------------------------------------------
|
# -------- system info --------------------------------------------------------
|
||||||
|
|
||||||
bashio::info.operating_system() {
|
bashio::info.operating_system() {
|
||||||
if [ -r /etc/os-release ]; then
|
if [ -r /etc/os-release ]; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
printf '%s' "${PRETTY_NAME:-${NAME:-Linux}}"
|
printf '%s' "${PRETTY_NAME:-${NAME:-Linux}}"
|
||||||
else
|
else
|
||||||
printf '%s' "Linux"
|
printf '%s' "Linux"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
bashio::info.arch() { uname -m; }
|
bashio::info.arch() { uname -m; }
|
||||||
bashio::info.machine() { uname -m; }
|
bashio::info.machine() { uname -m; }
|
||||||
bashio::info.homeassistant(){ printf '%s' "standalone"; }
|
bashio::info.homeassistant() { printf '%s' "standalone"; }
|
||||||
bashio::info.supervisor() { printf '%s' "standalone"; }
|
bashio::info.supervisor() { printf '%s' "standalone"; }
|
||||||
|
|
||||||
# -------- config -------------------------------------------------------------
|
# -------- config -------------------------------------------------------------
|
||||||
|
|
||||||
@@ -187,24 +191,30 @@ bashio::info.supervisor() { printf '%s' "standalone"; }
|
|||||||
# 1) ENV (several name variants/prefixes)
|
# 1) ENV (several name variants/prefixes)
|
||||||
# 2) JSON file via STANDALONE_OPTIONS_JSON (jq required)
|
# 2) JSON file via STANDALONE_OPTIONS_JSON (jq required)
|
||||||
bashio::config() {
|
bashio::config() {
|
||||||
local key="${1:-}"
|
local key="${1:-}"
|
||||||
local v
|
local v
|
||||||
v="$(_bashio_env_get "$key")"
|
v="$(_bashio_env_get "$key")"
|
||||||
if [ -z "$v" ]; then
|
if [ -z "$v" ]; then
|
||||||
v="$(_bashio_json_get "$key")"
|
v="$(_bashio_json_get "$key")"
|
||||||
fi
|
fi
|
||||||
printf '%s' "${v:-}"
|
printf '%s' "${v:-}"
|
||||||
}
|
}
|
||||||
|
|
||||||
bashio::config.has_value() { local k="$1"; [ -n "$(bashio::config "$k")" ]; }
|
bashio::config.has_value() {
|
||||||
bashio::config.true() { local k="$1"; _bashio_is_true "$(bashio::config "$k")"; }
|
local k="$1"
|
||||||
|
[ -n "$(bashio::config "$k")" ]
|
||||||
|
}
|
||||||
|
bashio::config.true() {
|
||||||
|
local k="$1"
|
||||||
|
_bashio_is_true "$(bashio::config "$k")"
|
||||||
|
}
|
||||||
|
|
||||||
# Some add-ons call "require.ssl" (noop by default)
|
# Some add-ons call "require.ssl" (noop by default)
|
||||||
bashio::config.require.ssl(){ printf '%s' "${REQUIRE_SSL:-true}"; }
|
bashio::config.require.ssl() { printf '%s' "${REQUIRE_SSL:-true}"; }
|
||||||
|
|
||||||
# -------- variables & fs helpers --------------------------------------------
|
# -------- variables & fs helpers --------------------------------------------
|
||||||
|
|
||||||
bashio::var.true() { _bashio_is_true "${1:-}"; }
|
bashio::var.true() { _bashio_is_true "${1:-}"; }
|
||||||
bashio::var.has_value() { [ -n "${1:-}" ]; }
|
bashio::var.has_value() { [ -n "${1:-}" ]; }
|
||||||
|
|
||||||
bashio::fs.directory_exists() { [ -d "$1" ]; }
|
bashio::fs.directory_exists() { [ -d "$1" ]; }
|
||||||
@@ -213,8 +223,8 @@ bashio::fs.directory_exists() { [ -d "$1" ]; }
|
|||||||
|
|
||||||
# Wait for TCP service: bashio::net.wait_for host port [timeout]
|
# Wait for TCP service: bashio::net.wait_for host port [timeout]
|
||||||
bashio::net.wait_for() {
|
bashio::net.wait_for() {
|
||||||
local host="$1" port="$2" to="${3:-30}"
|
local host="$1" port="$2" to="${3:-30}"
|
||||||
_bashio_tcp_wait "$host" "$port" "$to"
|
_bashio_tcp_wait "$host" "$port" "$to"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Discovery stubs; map to common env names, or JSON:
|
# Discovery stubs; map to common env names, or JSON:
|
||||||
@@ -222,33 +232,33 @@ bashio::net.wait_for() {
|
|||||||
# bashio::services "mqtt" "host"
|
# bashio::services "mqtt" "host"
|
||||||
# bashio::services "mysql" "port"
|
# bashio::services "mysql" "port"
|
||||||
bashio::services() {
|
bashio::services() {
|
||||||
local svc="${1:-}" key="${2:-}"
|
local svc="${1:-}" key="${2:-}"
|
||||||
[ -z "$svc" ] && return 0
|
[ -z "$svc" ] && return 0
|
||||||
local upper svc_upper var v
|
local upper svc_upper var v
|
||||||
upper="$(printf '%s' "$key" | tr '[:lower:]' '[:upper:]')"
|
upper="$(printf '%s' "$key" | tr '[:lower:]' '[:upper:]')"
|
||||||
svc_upper="$(printf '%s' "$svc" | tr '[:lower:]' '[:upper:]')"
|
svc_upper="$(printf '%s' "$svc" | tr '[:lower:]' '[:upper:]')"
|
||||||
|
|
||||||
# Common mappings
|
# Common mappings
|
||||||
case "$svc_upper:$upper" in
|
case "$svc_upper:$upper" in
|
||||||
MQTT:HOST) var="MQTT_HOST" ;;
|
MQTT:HOST) var="MQTT_HOST" ;;
|
||||||
MQTT:PORT) var="MQTT_PORT" ;;
|
MQTT:PORT) var="MQTT_PORT" ;;
|
||||||
MQTT:USERNAME) var="MQTT_USER" ;;
|
MQTT:USERNAME) var="MQTT_USER" ;;
|
||||||
MQTT:PASSWORD) var="MQTT_PASSWORD" ;;
|
MQTT:PASSWORD) var="MQTT_PASSWORD" ;;
|
||||||
MQTT:TLS) var="MQTT_TLS" ;;
|
MQTT:TLS) var="MQTT_TLS" ;;
|
||||||
MYSQL:HOST|MARIADB:HOST) var="DB_HOST" ;;
|
MYSQL:HOST | MARIADB:HOST) var="DB_HOST" ;;
|
||||||
MYSQL:PORT|MARIADB:PORT) var="DB_PORT" ;;
|
MYSQL:PORT | MARIADB:PORT) var="DB_PORT" ;;
|
||||||
MYSQL:USERNAME|MARIADB:USERNAME) var="DB_USER" ;;
|
MYSQL:USERNAME | MARIADB:USERNAME) var="DB_USER" ;;
|
||||||
MYSQL:PASSWORD|MARIADB:PASSWORD) var="DB_PASSWORD" ;;
|
MYSQL:PASSWORD | MARIADB:PASSWORD) var="DB_PASSWORD" ;;
|
||||||
MYSQL:DATABASE|MARIADB:DATABASE) var="DB_NAME" ;;
|
MYSQL:DATABASE | MARIADB:DATABASE) var="DB_NAME" ;;
|
||||||
*) var="${svc_upper}_${upper}" ;;
|
*) var="${svc_upper}_${upper}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
v="$(_bashio_env_get "$var")"
|
v="$(_bashio_env_get "$var")"
|
||||||
if [ -z "$v" ] && [ -n "${STANDALONE_OPTIONS_JSON:-}" ]; then
|
if [ -z "$v" ] && [ -n "${STANDALONE_OPTIONS_JSON:-}" ]; then
|
||||||
v="$(_bashio_json_get "services.${svc}.${key}")"
|
v="$(_bashio_json_get "services.${svc}.${key}")"
|
||||||
[ -z "$v" ] && v="$(_bashio_json_get "${svc}.${key}")"
|
[ -z "$v" ] && v="$(_bashio_json_get "${svc}.${key}")"
|
||||||
fi
|
fi
|
||||||
printf '%s' "${v:-}"
|
printf '%s' "${v:-}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ----- extras for broader compatibility --------------------------------------
|
# ----- extras for broader compatibility --------------------------------------
|
||||||
@@ -258,165 +268,177 @@ _BASHIO_CACHE_DIR="${BASHIO_CACHE_DIR:-/tmp/.bashio}"
|
|||||||
mkdir -p "$_BASHIO_CACHE_DIR"
|
mkdir -p "$_BASHIO_CACHE_DIR"
|
||||||
|
|
||||||
bashio::cache.exists() { [ -f "$_BASHIO_CACHE_DIR/${1}.cache" ]; }
|
bashio::cache.exists() { [ -f "$_BASHIO_CACHE_DIR/${1}.cache" ]; }
|
||||||
bashio::cache.get() { [ -f "$_BASHIO_CACHE_DIR/${1}.cache" ] && cat "$_BASHIO_CACHE_DIR/${1}.cache"; }
|
bashio::cache.get() { [ -f "$_BASHIO_CACHE_DIR/${1}.cache" ] && cat "$_BASHIO_CACHE_DIR/${1}.cache"; }
|
||||||
bashio::cache.set() { mkdir -p "$_BASHIO_CACHE_DIR"; printf '%s' "${2:-}" > "$_BASHIO_CACHE_DIR/${1}.cache"; }
|
bashio::cache.set() {
|
||||||
|
mkdir -p "$_BASHIO_CACHE_DIR"
|
||||||
|
printf '%s' "${2:-}" > "$_BASHIO_CACHE_DIR/${1}.cache"
|
||||||
|
}
|
||||||
|
|
||||||
# Filesystem helpers frequently used
|
# Filesystem helpers frequently used
|
||||||
bashio::fs.file_exists() { [ -f "$1" ]; }
|
bashio::fs.file_exists() { [ -f "$1" ]; }
|
||||||
bashio::fs.directory_exists() { [ -d "$1" ]; } # already defined earlier; keep if present
|
bashio::fs.directory_exists() { [ -d "$1" ]; } # already defined earlier; keep if present
|
||||||
bashio::fs.file_contains() { local f="$1" p="$2"; [ -f "$f" ] && grep -q -- "$p" "$f"; }
|
bashio::fs.file_contains() {
|
||||||
|
local f="$1" p="$2"
|
||||||
|
[ -f "$f" ] && grep -q -- "$p" "$f"
|
||||||
|
}
|
||||||
|
|
||||||
# jq wrapper (some add-ons call bashio::jq)
|
# jq wrapper (some add-ons call bashio::jq)
|
||||||
bashio::jq() { command -v jq >/dev/null 2>&1 && jq "$@"; }
|
bashio::jq() { command -v jq > /dev/null 2>&1 && jq "$@"; }
|
||||||
|
|
||||||
# env presence (even if empty) used by config.exists
|
# env presence (even if empty) used by config.exists
|
||||||
_bashio_env_has() {
|
_bashio_env_has() {
|
||||||
local key="$1" p v name
|
local key="$1" p v name
|
||||||
[ -z "$key" ] && return 1
|
[ -z "$key" ] && return 1
|
||||||
local variants=(
|
local variants=(
|
||||||
"$key"
|
"$key"
|
||||||
"$(printf '%s' "$key" | tr '.' '_' )"
|
"$(printf '%s' "$key" | tr '.' '_')"
|
||||||
"$(printf '%s' "$key" | tr '.' '_' | tr '[:lower:]' '[:upper:]')"
|
"$(printf '%s' "$key" | tr '.' '_' | tr '[:lower:]' '[:upper:]')"
|
||||||
"$(printf '%s' "$key" | tr '[:lower:]' '[:upper:]')"
|
"$(printf '%s' "$key" | tr '[:lower:]' '[:upper:]')"
|
||||||
)
|
)
|
||||||
for v in "${variants[@]}"; do
|
for v in "${variants[@]}"; do
|
||||||
for p in "" "CFG_" "CONFIG_" "ADDON_" "OPTION_" "OPT_"; do
|
for p in "" "CFG_" "CONFIG_" "ADDON_" "OPTION_" "OPT_"; do
|
||||||
name="${p}${v}"
|
name="${p}${v}"
|
||||||
if [ -n "${!name+x}" ]; then # defined, even if empty
|
if [ -n "${!name+x}" ]; then # defined, even if empty
|
||||||
printf '%s' "$name"
|
printf '%s' "$name"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
done
|
return 1
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# config.exists : key is present (env or JSON), even if value is empty
|
# config.exists : key is present (env or JSON), even if value is empty
|
||||||
bashio::config.exists() {
|
bashio::config.exists() {
|
||||||
local key="$1" file="${STANDALONE_OPTIONS_JSON:-}"
|
local key="$1" file="${STANDALONE_OPTIONS_JSON:-}"
|
||||||
_bashio_env_has "$key" && return 0
|
_bashio_env_has "$key" && return 0
|
||||||
if [ -n "$file" ] && command -v jq >/dev/null 2>&1; then
|
if [ -n "$file" ] && command -v jq > /dev/null 2>&1; then
|
||||||
jq -e --arg k "$key" 'haspath(($k|split(".")))' "$file" >/dev/null 2>&1
|
jq -e --arg k "$key" 'haspath(($k|split(".")))' "$file" > /dev/null 2>&1
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# addon.option : write/delete option in JSON when possible; fallback no-op/env
|
# addon.option : write/delete option in JSON when possible; fallback no-op/env
|
||||||
bashio::addon.option() {
|
bashio::addon.option() {
|
||||||
local key="$1" value="${2-__BASHIO_UNSET__}" file="${STANDALONE_OPTIONS_JSON:-}"
|
local key="$1" value="${2-__BASHIO_UNSET__}" file="${STANDALONE_OPTIONS_JSON:-}"
|
||||||
if [ -n "$file" ] && command -v jq >/dev/null 2>&1; then
|
if [ -n "$file" ] && command -v jq > /dev/null 2>&1; then
|
||||||
local tmp; tmp="$(mktemp)"
|
local tmp
|
||||||
if [ "$value" = "__BASHIO_UNSET__" ]; then
|
tmp="$(mktemp)"
|
||||||
jq --arg k "$key" 'delpath(($k|split(".")))' "$file" >"$tmp" && mv "$tmp" "$file"
|
if [ "$value" = "__BASHIO_UNSET__" ]; then
|
||||||
else
|
jq --arg k "$key" 'delpath(($k|split(".")))' "$file" > "$tmp" && mv "$tmp" "$file"
|
||||||
jq --arg k "$key" --arg v "$value" 'setpath(($k|split(".")); $v)' "$file" >"$tmp" && mv "$tmp" "$file"
|
else
|
||||||
|
jq --arg k "$key" --arg v "$value" 'setpath(($k|split(".")); $v)' "$file" > "$tmp" && mv "$tmp" "$file"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
# Fallbacks: export as env or treat delete as no-op
|
||||||
|
if [ "$value" != "__BASHIO_UNSET__" ]; then
|
||||||
|
export "$(printf '%s' "$key" | tr '.' '_' | tr '-' '_')"="$value"
|
||||||
fi
|
fi
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
# Fallbacks: export as env or treat delete as no-op
|
|
||||||
if [ "$value" != "__BASHIO_UNSET__" ]; then
|
|
||||||
export "$(printf '%s' "$key" | tr '.' '_' | tr '-' '_')"="$value"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# services.available : check if we can resolve at least a host for the service
|
# services.available : check if we can resolve at least a host for the service
|
||||||
bashio::services.available() {
|
bashio::services.available() {
|
||||||
local svc="$1" host; host="$(bashio::services "$svc" "host")"
|
local svc="$1" host
|
||||||
[ -n "$host" ]
|
host="$(bashio::services "$svc" "host")"
|
||||||
|
[ -n "$host" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# var helpers
|
# var helpers
|
||||||
bashio::var.false() { ! _bashio_is_true "${1:-}"; }
|
bashio::var.false() { ! _bashio_is_true "${1:-}"; }
|
||||||
bashio::var.has_value() { [ -n "${1:-}" ]; } # already present; keep if defined
|
bashio::var.has_value() { [ -n "${1:-}" ]; } # already present; keep if defined
|
||||||
|
|
||||||
# exits used by many add-ons
|
# exits used by many add-ons
|
||||||
bashio::exit.ok() { exit 0; }
|
bashio::exit.ok() { exit 0; }
|
||||||
bashio::exit.nok() { local m="${1:-}"; [ -n "$m" ] && bashio::log.red "$m"; exit 1; }
|
bashio::exit.nok() {
|
||||||
|
local m="${1:-}"
|
||||||
|
[ -n "$m" ] && bashio::log.red "$m"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# core.check : Supervisor does a config check; allow an overridable command
|
# core.check : Supervisor does a config check; allow an overridable command
|
||||||
# Set STANDALONE_CORE_CHECK_CMD="hass --script check_config -c /config" to enable
|
# Set STANDALONE_CORE_CHECK_CMD="hass --script check_config -c /config" to enable
|
||||||
bashio::core.check() {
|
bashio::core.check() {
|
||||||
if [ -n "${STANDALONE_CORE_CHECK_CMD:-}" ]; then
|
if [ -n "${STANDALONE_CORE_CHECK_CMD:-}" ]; then
|
||||||
eval "$STANDALONE_CORE_CHECK_CMD"
|
eval "$STANDALONE_CORE_CHECK_CMD"
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- improvements & extra shims ---------------------------------------------
|
# --- improvements & extra shims ---------------------------------------------
|
||||||
|
|
||||||
# Respect NO_COLOR and dumb terminals
|
# Respect NO_COLOR and dumb terminals
|
||||||
if [ -n "${NO_COLOR:-}" ] || [ "${TERM:-}" = "dumb" ]; then
|
if [ -n "${NO_COLOR:-}" ] || [ "${TERM:-}" = "dumb" ]; then
|
||||||
_BASHIO_COLOR=0
|
_BASHIO_COLOR=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# net.wait_for: prefer nc if available, fallback to /dev/tcp
|
# net.wait_for: prefer nc if available, fallback to /dev/tcp
|
||||||
_bashio_tcp_wait_nc() {
|
_bashio_tcp_wait_nc() {
|
||||||
# $1=host $2=port $3=timeout(s)
|
# $1=host $2=port $3=timeout(s)
|
||||||
command -v nc >/dev/null 2>&1 || return 1
|
command -v nc > /dev/null 2>&1 || return 1
|
||||||
local host="$1" port="$2" to="${3:-30}"
|
local host="$1" port="$2" to="${3:-30}"
|
||||||
# BusyBox and OpenBSD nc differ; cover both styles
|
# BusyBox and OpenBSD nc differ; cover both styles
|
||||||
nc -z -w "$to" "$host" "$port" 2>/dev/null || nc -z "$host" "$port" 2>/dev/null
|
nc -z -w "$to" "$host" "$port" 2> /dev/null || nc -z "$host" "$port" 2> /dev/null
|
||||||
}
|
}
|
||||||
bashio::net.wait_for() {
|
bashio::net.wait_for() {
|
||||||
local host="$1" port="$2" to="${3:-30}"
|
local host="$1" port="$2" to="${3:-30}"
|
||||||
_bashio_tcp_wait_nc "$host" "$port" "$to" && return 0
|
_bashio_tcp_wait_nc "$host" "$port" "$to" && return 0
|
||||||
_bashio_tcp_wait "$host" "$port" "$to"
|
_bashio_tcp_wait "$host" "$port" "$to"
|
||||||
}
|
}
|
||||||
|
|
||||||
# DNS helper: bashio::dns.host <hostname> -> prints an IP (or empty)
|
# DNS helper: bashio::dns.host <hostname> -> prints an IP (or empty)
|
||||||
bashio::dns.host() {
|
bashio::dns.host() {
|
||||||
local h="${1:-}"
|
local h="${1:-}"
|
||||||
[ -z "$h" ] && return 1
|
[ -z "$h" ] && return 1
|
||||||
if command -v getent >/dev/null 2>&1; then
|
if command -v getent > /dev/null 2>&1; then
|
||||||
getent ahostsv4 "$h" | awk '{print $1; exit}'
|
getent ahostsv4 "$h" | awk '{print $1; exit}'
|
||||||
else
|
else
|
||||||
# fallback: try busybox nslookup
|
# fallback: try busybox nslookup
|
||||||
nslookup "$h" 2>/dev/null | awk '/^Address: /{print $2; exit}'
|
nslookup "$h" 2> /dev/null | awk '/^Address: /{print $2; exit}'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Hostname
|
# Hostname
|
||||||
bashio::host.hostname() {
|
bashio::host.hostname() {
|
||||||
command -v hostname >/dev/null 2>&1 && hostname || printf '%s' "${HOSTNAME:-unknown}"
|
command -v hostname > /dev/null 2>&1 && hostname || printf '%s' "${HOSTNAME:-unknown}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Home Assistant token (no Supervisor; read from env or JSON)
|
# Home Assistant token (no Supervisor; read from env or JSON)
|
||||||
bashio::homeassistant.token() {
|
bashio::homeassistant.token() {
|
||||||
local t="${HOMEASSISTANT_TOKEN:-${HASS_TOKEN:-}}"
|
local t="${HOMEASSISTANT_TOKEN:-${HASS_TOKEN:-}}"
|
||||||
if [ -z "$t" ] && [ -n "${STANDALONE_OPTIONS_JSON:-}" ] && command -v jq >/dev/null 2>&1; then
|
if [ -z "$t" ] && [ -n "${STANDALONE_OPTIONS_JSON:-}" ] && command -v jq > /dev/null 2>&1; then
|
||||||
t="$(jq -er '.homeassistant.token // empty' "$STANDALONE_OPTIONS_JSON" 2>/dev/null || true)"
|
t="$(jq -er '.homeassistant.token // empty' "$STANDALONE_OPTIONS_JSON" 2> /dev/null || true)"
|
||||||
fi
|
fi
|
||||||
printf '%s' "${t:-}"
|
printf '%s' "${t:-}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# config.array:
|
# config.array:
|
||||||
# Accepts CSV ("a,b,c"), space/newline-separated text, or JSON array ["a","b"].
|
# Accepts CSV ("a,b,c"), space/newline-separated text, or JSON array ["a","b"].
|
||||||
# Prints one item per line (common pattern in add-ons: `mapfile -t arr < <(bashio::config.array key)`).
|
# Prints one item per line (common pattern in add-ons: `mapfile -t arr < <(bashio::config.array key)`).
|
||||||
bashio::config.array() {
|
bashio::config.array() {
|
||||||
local key="${1:-}" raw val
|
local key="${1:-}" raw val
|
||||||
raw="$(bashio::config "$key")"
|
raw="$(bashio::config "$key")"
|
||||||
[ -z "$raw" ] && return 0
|
[ -z "$raw" ] && return 0
|
||||||
|
|
||||||
# JSON array?
|
# JSON array?
|
||||||
if command -v jq >/dev/null 2>&1 && printf '%s' "$raw" | jq -e . >/dev/null 2>&1; then
|
if command -v jq > /dev/null 2>&1 && printf '%s' "$raw" | jq -e . > /dev/null 2>&1; then
|
||||||
printf '%s' "$raw" | jq -r '.[]' 2>/dev/null && return 0
|
printf '%s' "$raw" | jq -r '.[]' 2> /dev/null && return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# CSV -> newline
|
# CSV -> newline
|
||||||
if printf '%s' "$raw" | grep -q ','; then
|
if printf '%s' "$raw" | grep -q ','; then
|
||||||
printf '%s' "$raw" | tr ',' '\n'
|
printf '%s' "$raw" | tr ',' '\n'
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Already space/newline-separated
|
# Already space/newline-separated
|
||||||
printf '%s\n' "$raw"
|
printf '%s\n' "$raw"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optional: common require.* shims (treat as advisory in standalone)
|
# Optional: common require.* shims (treat as advisory in standalone)
|
||||||
bashio::config.require.username() { :; }
|
bashio::config.require.username() { :; }
|
||||||
bashio::config.require.password() { :; }
|
bashio::config.require.password() { :; }
|
||||||
bashio::config.require.port() { :; }
|
bashio::config.require.port() { :; }
|
||||||
|
|
||||||
# -------- end ----------------------------------------------------------------
|
# -------- end ----------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#!/command/with-contenv bashio
|
#!/command/with-contenv bashio
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
set -e # Exit immediately if a command exits with a non-zero status
|
set -e # Exit immediately if a command exits with a non-zero status
|
||||||
|
|
||||||
|
|
||||||
# Detect if this is PID1 (main container process) — do this once at the start
|
# Detect if this is PID1 (main container process) — do this once at the start
|
||||||
PID1=false
|
PID1=false
|
||||||
@@ -38,7 +37,7 @@ for candidate in "${candidate_shebangs[@]}"; do
|
|||||||
# Test if command exists and can actually execute a shell command (for shells)
|
# Test if command exists and can actually execute a shell command (for shells)
|
||||||
if [ -x "$command_path" ]; then
|
if [ -x "$command_path" ]; then
|
||||||
# Try as both 'sh -c' and 'bashio echo' style
|
# Try as both 'sh -c' and 'bashio echo' style
|
||||||
if "$command_path" -c 'echo yes' >/dev/null 2>&1 || "$command_path" echo "yes" >/dev/null 2>&1; then
|
if "$command_path" -c 'echo yes' > /dev/null 2>&1 || "$command_path" echo "yes" > /dev/null 2>&1; then
|
||||||
shebang="$candidate"
|
shebang="$candidate"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@@ -91,7 +90,7 @@ done
|
|||||||
|
|
||||||
# Start run scripts in services.d and s6-overlay/s6-rc.d if PID1
|
# Start run scripts in services.d and s6-overlay/s6-rc.d if PID1
|
||||||
if $PID1; then
|
if $PID1; then
|
||||||
shopt -s nullglob # Don't expand unmatched globs to themselves
|
shopt -s nullglob # Don't expand unmatched globs to themselves
|
||||||
for runfile in /etc/services.d/*/run /etc/s6-overlay/s6-rc.d/*/run; do
|
for runfile in /etc/services.d/*/run /etc/s6-overlay/s6-rc.d/*/run; do
|
||||||
[ -f "$runfile" ] || continue
|
[ -f "$runfile" ] || continue
|
||||||
echo "Starting: $runfile"
|
echo "Starting: $runfile"
|
||||||
@@ -103,7 +102,8 @@ if $PID1; then
|
|||||||
sed -i -E 's|s6-svwait[[:space:]]+-d[[:space:]]+([^[:space:]]+)|bash -c '\''while [ -f \1/supervise/pid ]; do sleep 0.5; done'\''|g' "$runfile"
|
sed -i -E 's|s6-svwait[[:space:]]+-d[[:space:]]+([^[:space:]]+)|bash -c '\''while [ -f \1/supervise/pid ]; do sleep 0.5; done'\''|g' "$runfile"
|
||||||
sed -i -E 's|s6-svwait[[:space:]]+-u[[:space:]]+([^[:space:]]+)|bash -c '\''until [ -f \1/supervise/pid ]; do sleep 0.5; done'\''|g' "$runfile"
|
sed -i -E 's|s6-svwait[[:space:]]+-u[[:space:]]+([^[:space:]]+)|bash -c '\''until [ -f \1/supervise/pid ]; do sleep 0.5; done'\''|g' "$runfile"
|
||||||
chmod +x "$runfile"
|
chmod +x "$runfile"
|
||||||
( exec "$runfile" ) & true
|
(exec "$runfile") &
|
||||||
|
true
|
||||||
done
|
done
|
||||||
shopt -u nullglob
|
shopt -u nullglob
|
||||||
fi
|
fi
|
||||||
@@ -119,19 +119,19 @@ if $PID1; then
|
|||||||
terminate() {
|
terminate() {
|
||||||
echo "Termination signal received, forwarding to subprocesses..."
|
echo "Termination signal received, forwarding to subprocesses..."
|
||||||
# Terminate all direct child processes
|
# Terminate all direct child processes
|
||||||
if command -v pgrep &>/dev/null; then
|
if command -v pgrep &> /dev/null; then
|
||||||
for pid in $(pgrep -P $$); do
|
for pid in $(pgrep -P $$); do
|
||||||
echo "Terminating child PID $pid"
|
echo "Terminating child PID $pid"
|
||||||
kill -TERM "$pid" 2>/dev/null || echo "Failed to terminate PID $pid"
|
kill -TERM "$pid" 2> /dev/null || echo "Failed to terminate PID $pid"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
# Fallback: Scan /proc for children
|
# Fallback: Scan /proc for children
|
||||||
for pid in /proc/[0-9]*/; do
|
for pid in /proc/[0-9]*/; do
|
||||||
pid=${pid#/proc/}
|
pid=${pid#/proc/}
|
||||||
pid=${pid%/}
|
pid=${pid%/}
|
||||||
if [[ "$pid" -ne 1 ]] && grep -q "^PPid:\s*$$" "/proc/$pid/status" 2>/dev/null; then
|
if [[ "$pid" -ne 1 ]] && grep -q "^PPid:\s*$$" "/proc/$pid/status" 2> /dev/null; then
|
||||||
echo "Terminating child PID $pid"
|
echo "Terminating child PID $pid"
|
||||||
kill -TERM "$pid" 2>/dev/null || echo "Failed to terminate PID $pid"
|
kill -TERM "$pid" 2> /dev/null || echo "Failed to terminate PID $pid"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ if [ -n "${ALSA_CARD:-}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Define permissions for audio
|
# Define permissions for audio
|
||||||
AUDIO_GID=$(stat -c %g /dev/snd/* | head -n1) && \
|
AUDIO_GID=$(stat -c %g /dev/snd/* | head -n1) \
|
||||||
( groupmod -o -g "$AUDIO_GID" audio 2>/dev/null || groupadd -o -g "$AUDIO_GID" audio || true ) && \
|
&& (groupmod -o -g "$AUDIO_GID" audio 2> /dev/null || groupadd -o -g "$AUDIO_GID" audio || true) \
|
||||||
usermod -aG audio "${USER:-pi}" || true
|
&& usermod -aG audio "${USER:-pi}" || true
|
||||||
|
|
||||||
# Fix timezone as per installer
|
# Fix timezone as per installer
|
||||||
CURRENT_TIMEZONE="$(timedatectl show --value --property=Timezone)"
|
CURRENT_TIMEZONE="$(timedatectl show --value --property=Timezone)"
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
],
|
],
|
||||||
"name": "WIP - Collabora",
|
"name": "WIP - Collabora",
|
||||||
"options": {
|
"options": {
|
||||||
"domain": "",
|
|
||||||
"username": "",
|
|
||||||
"password": "",
|
|
||||||
"aliasgroup1": "",
|
"aliasgroup1": "",
|
||||||
"dictionaries": "",
|
"dictionaries": "",
|
||||||
"extra_params": ""
|
"domain": "",
|
||||||
|
"extra_params": "",
|
||||||
|
"password": "",
|
||||||
|
"username": ""
|
||||||
},
|
},
|
||||||
"ports": {
|
"ports": {
|
||||||
"9980/tcp": 9980
|
"9980/tcp": 9980
|
||||||
@@ -30,13 +30,13 @@
|
|||||||
"9980/tcp": "Web interface"
|
"9980/tcp": "Web interface"
|
||||||
},
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
"domain": "str?",
|
"TZ": "str?",
|
||||||
"username": "str?",
|
|
||||||
"password": "password?",
|
|
||||||
"aliasgroup1": "str?",
|
"aliasgroup1": "str?",
|
||||||
"dictionaries": "str?",
|
"dictionaries": "str?",
|
||||||
|
"domain": "str?",
|
||||||
"extra_params": "str?",
|
"extra_params": "str?",
|
||||||
"TZ": "str?"
|
"password": "password?",
|
||||||
|
"username": "str?"
|
||||||
},
|
},
|
||||||
"slug": "collabora",
|
"slug": "collabora",
|
||||||
"url": "https://github.com/alexbelgium/hassio-addons",
|
"url": "https://github.com/alexbelgium/hassio-addons",
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ ln -sf "${CONFIG_DEST}" "${COOL_CONFIG}"
|
|||||||
SYSTEMPLATE_DIR="/opt/cool/systemplate/etc"
|
SYSTEMPLATE_DIR="/opt/cool/systemplate/etc"
|
||||||
if [ -d "${SYSTEMPLATE_DIR}" ]; then
|
if [ -d "${SYSTEMPLATE_DIR}" ]; then
|
||||||
cp /etc/hosts "${SYSTEMPLATE_DIR}/hosts"
|
cp /etc/hosts "${SYSTEMPLATE_DIR}/hosts"
|
||||||
cp /etc/hostname "${SYSTEMPLATE_DIR}/hostname" 2>/dev/null || true
|
cp /etc/hostname "${SYSTEMPLATE_DIR}/hostname" 2> /dev/null || true
|
||||||
cp /etc/resolv.conf "${SYSTEMPLATE_DIR}/resolv.conf"
|
cp /etc/resolv.conf "${SYSTEMPLATE_DIR}/resolv.conf"
|
||||||
fi
|
fi
|
||||||
chown 1001 /opt/cool/systemplate
|
chown 1001 /opt/cool/systemplate
|
||||||
|
|||||||
0
emby/rootfs/etc/services.d/nginx/run
Normal file → Executable file
0
emby/rootfs/etc/services.d/nginx/run
Normal file → Executable file
0
emby_beta/rootfs/etc/services.d/nginx/run
Normal file → Executable file
0
emby_beta/rootfs/etc/services.d/nginx/run
Normal file → Executable file
@@ -57,12 +57,12 @@ The web UI can be found at `<your-ip>:8071` or through the Home Assistant sideba
|
|||||||
| `keyfile` | str | `privkey.pem` | SSL private key file (in `/ssl/`) |
|
| `keyfile` | str | `privkey.pem` | SSL private key file (in `/ssl/`) |
|
||||||
| `NoAuth` | bool | `true` | Disable authentication (resets database when changed) |
|
| `NoAuth` | bool | `true` | Disable authentication (resets database when changed) |
|
||||||
| `disable_thumbnails` | bool | `true` | Disable thumbnail generation for improved performance |
|
| `disable_thumbnails` | bool | `true` | Disable thumbnail generation for improved performance |
|
||||||
| `base_folder` | str | *(optional)* | Root folder for file browser (defaults to all mapped folders) |
|
| `base_folder` | str | _(optional)_ | Root folder for file browser (defaults to all mapped folders) |
|
||||||
| `localdisks` | str | *(optional)* | Local drives to mount (e.g., `sda1,sdb1,MYNAS`) |
|
| `localdisks` | str | _(optional)_ | Local drives to mount (e.g., `sda1,sdb1,MYNAS`) |
|
||||||
| `networkdisks` | str | *(optional)* | SMB shares to mount (e.g., `//SERVER/SHARE`) |
|
| `networkdisks` | str | _(optional)_ | SMB shares to mount (e.g., `//SERVER/SHARE`) |
|
||||||
| `cifsusername` | str | *(optional)* | SMB username for network shares |
|
| `cifsusername` | str | _(optional)_ | SMB username for network shares |
|
||||||
| `cifspassword` | str | *(optional)* | SMB password for network shares |
|
| `cifspassword` | str | _(optional)_ | SMB password for network shares |
|
||||||
| `cifsdomain` | str | *(optional)* | SMB domain for network shares |
|
| `cifsdomain` | str | _(optional)_ | SMB domain for network shares |
|
||||||
|
|
||||||
### Example Configuration
|
### Example Configuration
|
||||||
|
|
||||||
|
|||||||
@@ -78,12 +78,13 @@ environment:
|
|||||||
}
|
}
|
||||||
image: ghcr.io/alexbelgium/grampsweb-{arch}
|
image: ghcr.io/alexbelgium/grampsweb-{arch}
|
||||||
init: false
|
init: false
|
||||||
options: {
|
options:
|
||||||
|
{
|
||||||
"CELERY_NUM_WORKERS": 2,
|
"CELERY_NUM_WORKERS": 2,
|
||||||
"GUNICORN_NUM_WORKERS": 8,
|
"GUNICORN_NUM_WORKERS": 8,
|
||||||
"certfile": "fullchain.pem",
|
"certfile": "fullchain.pem",
|
||||||
"keyfile": "privkey.pem",
|
"keyfile": "privkey.pem",
|
||||||
"ssl": false
|
"ssl": false,
|
||||||
}
|
}
|
||||||
map:
|
map:
|
||||||
- type: addon_config
|
- type: addon_config
|
||||||
|
|||||||
0
nextcloud/rootfs/etc/services.d/cron/run
Normal file → Executable file
0
nextcloud/rootfs/etc/services.d/cron/run
Normal file → Executable file
0
nzbget/rootfs/etc/services.d/nginx/run
Normal file → Executable file
0
nzbget/rootfs/etc/services.d/nginx/run
Normal file → Executable file
@@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
# Start omni-tools container content
|
# Start omni-tools container content
|
||||||
bashio::log.info "Starting application"
|
bashio::log.info "Starting application"
|
||||||
/./docker-entrypoint.sh nginx -g "daemon off;" &>/proc/1/fd/1
|
/./docker-entrypoint.sh nginx -g "daemon off;" &> /proc/1/fd/1
|
||||||
|
|||||||
@@ -170,10 +170,10 @@
|
|||||||
"cifspassword": "str?",
|
"cifspassword": "str?",
|
||||||
"cifsusername": "str?",
|
"cifsusername": "str?",
|
||||||
"claim": "str",
|
"claim": "str",
|
||||||
|
"clear_codecs_folder": "bool?",
|
||||||
"localdisks": "str?",
|
"localdisks": "str?",
|
||||||
"networkdisks": "str?",
|
"networkdisks": "str?",
|
||||||
"skip_permissions_check": "bool?",
|
"skip_permissions_check": "bool?",
|
||||||
"clear_codecs_folder": "bool?",
|
|
||||||
"smbv1": "bool?"
|
"smbv1": "bool?"
|
||||||
},
|
},
|
||||||
"slug": "plex_nas",
|
"slug": "plex_nas",
|
||||||
|
|||||||
0
qbittorrent/rootfs/etc/s6-overlay/s6-rc.d/svc-qbittorrent/run
Normal file → Executable file
0
qbittorrent/rootfs/etc/s6-overlay/s6-rc.d/svc-qbittorrent/run
Normal file → Executable file
0
qbittorrent/rootfs/etc/services.d/nginx/run
Normal file → Executable file
0
qbittorrent/rootfs/etc/services.d/nginx/run
Normal file → Executable file
0
qbittorrent/rootfs/etc/services.d/timer/run
Normal file → Executable file
0
qbittorrent/rootfs/etc/services.d/timer/run
Normal file → Executable file
0
scrutiny/rootfs/etc/services.d/nginx/run
Normal file → Executable file
0
scrutiny/rootfs/etc/services.d/nginx/run
Normal file → Executable file
0
sonarr/rootfs/etc/services.d/nginx/run
Normal file → Executable file
0
sonarr/rootfs/etc/services.d/nginx/run
Normal file → Executable file
@@ -98,6 +98,9 @@
|
|||||||
"80/tcp": "Web interface"
|
"80/tcp": "Web interface"
|
||||||
},
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
|
"AI_API_KEY": "str?",
|
||||||
|
"AI_MODEL_NAME": "str?",
|
||||||
|
"AI_RATELIMIT": "str?",
|
||||||
"ALLOWED_HOSTS": "str?",
|
"ALLOWED_HOSTS": "str?",
|
||||||
"DB_TYPE": "list(sqlite|postgresql_external)",
|
"DB_TYPE": "list(sqlite|postgresql_external)",
|
||||||
"DEBUG": "list(1|0)",
|
"DEBUG": "list(1|0)",
|
||||||
@@ -107,9 +110,6 @@
|
|||||||
"POSTGRES_PORT": "str?",
|
"POSTGRES_PORT": "str?",
|
||||||
"POSTGRES_USER": "str?",
|
"POSTGRES_USER": "str?",
|
||||||
"SECRET_KEY": "str",
|
"SECRET_KEY": "str",
|
||||||
"AI_MODEL_NAME": "str?",
|
|
||||||
"AI_API_KEY": "str?",
|
|
||||||
"AI_RATELIMIT": "str?",
|
|
||||||
"externalfiles_folder": "str?"
|
"externalfiles_folder": "str?"
|
||||||
},
|
},
|
||||||
"services": [
|
"services": [
|
||||||
|
|||||||
0
zzz_archived_bitwarden/rootfs/etc/services.d/bitwarden/run
Normal file → Executable file
0
zzz_archived_bitwarden/rootfs/etc/services.d/bitwarden/run
Normal file → Executable file
0
zzz_archived_bitwarden/rootfs/etc/services.d/nginx/run
Normal file → Executable file
0
zzz_archived_bitwarden/rootfs/etc/services.d/nginx/run
Normal file → Executable file
Reference in New Issue
Block a user