mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-07 14:38:48 +02:00
Update 99-run.sh
This commit is contained in:
@@ -2,15 +2,39 @@
|
|||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# hadolint ignore=SC2155
|
# hadolint ignore=SC2155
|
||||||
|
|
||||||
sleep 1000000
|
###################################
|
||||||
|
# Export all addon options as env #
|
||||||
|
###################################
|
||||||
|
|
||||||
|
# For all keys in options.json
|
||||||
|
JSONSOURCE="/data/options.json"
|
||||||
|
|
||||||
|
# Export keys as env variables
|
||||||
|
# echo "All addon options were exported as variables"
|
||||||
|
mapfile -t arr < <(jq -r 'keys[]' "${JSONSOURCE}")
|
||||||
|
|
||||||
|
for KEYS in "${arr[@]}"; do
|
||||||
|
# export key
|
||||||
|
VALUE=$(jq ."$KEYS" "${JSONSOURCE}")
|
||||||
|
line="${KEYS}='${VALUE//[\"\']/}'"
|
||||||
|
# Use locally
|
||||||
|
if [[ "${KEYS}" == *"PASS"* ]]; then
|
||||||
|
bashio::log.blue "${KEYS}=******"
|
||||||
|
else
|
||||||
|
bashio::log.blue "$line"
|
||||||
|
fi
|
||||||
|
# Export the variable to run scripts
|
||||||
|
export $line
|
||||||
|
if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null; fi
|
||||||
|
if cat /etc/cont-init.d/*run* &>/dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null; fi
|
||||||
|
done
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Define database #
|
# Define database #
|
||||||
###################
|
###################
|
||||||
|
|
||||||
bashio::log.info "Defining database"
|
bashio::log.info "Defining database"
|
||||||
DBTYPE=$(bashio::config 'DB_CONNECTION')
|
case "$DB_CONNECTION" in
|
||||||
case "$DBTYPE" in
|
|
||||||
|
|
||||||
# Use MariaDB
|
# Use MariaDB
|
||||||
mariadb_addon)
|
mariadb_addon)
|
||||||
|
|||||||
Reference in New Issue
Block a user