mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-10 09:35:58 +02:00
fixed SC2163 and SC2068
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
###################################
|
###################################
|
||||||
# Export all addon options as env #
|
# Export all addon options as env #
|
||||||
###################################
|
###################################
|
||||||
@@ -10,13 +10,13 @@ JSONSOURCE="/data/options.json"
|
|||||||
# Export keys as env variables
|
# Export keys as env variables
|
||||||
# echo "All addon options were exported as variables"
|
# echo "All addon options were exported as variables"
|
||||||
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
||||||
for KEYS in ${arr[@]}; do
|
for KEYS in "${arr[@]}"; do
|
||||||
# export key
|
# export key
|
||||||
VALUE=$(jq .$KEYS ${JSONSOURCE})
|
VALUE=$(jq ."$KEYS" ${JSONSOURCE})
|
||||||
line="${KEYS}=${VALUE//[\"\']/}"
|
line="${KEYS}=${VALUE//[\"\']/}"
|
||||||
# Use locally
|
# Use locally
|
||||||
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
||||||
export $line
|
export line
|
||||||
# Export the variable to run scripts
|
# Export the variable to run scripts
|
||||||
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
||||||
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
||||||
@@ -26,8 +26,9 @@ done
|
|||||||
# Set timezone #
|
# Set timezone #
|
||||||
################
|
################
|
||||||
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
||||||
if [ -f /usr/share/zoneinfo/$TZ ]; then
|
if [ -f /usr/share/zoneinfo/"$TZ" ]; then
|
||||||
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
||||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
|
ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
###################################
|
###################################
|
||||||
# Export all addon options as env #
|
# Export all addon options as env #
|
||||||
###################################
|
###################################
|
||||||
@@ -10,13 +10,13 @@ JSONSOURCE="/data/options.json"
|
|||||||
# Export keys as env variables
|
# Export keys as env variables
|
||||||
# echo "All addon options were exported as variables"
|
# echo "All addon options were exported as variables"
|
||||||
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
||||||
for KEYS in ${arr[@]}; do
|
for KEYS in "${arr[@]}"; do
|
||||||
# export key
|
# export key
|
||||||
VALUE=$(jq .$KEYS ${JSONSOURCE})
|
VALUE=$(jq ."$KEYS" ${JSONSOURCE})
|
||||||
line="${KEYS}=${VALUE//[\"\']/}"
|
line="${KEYS}=${VALUE//[\"\']/}"
|
||||||
# Use locally
|
# Use locally
|
||||||
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
||||||
export $line
|
export line
|
||||||
# Export the variable to run scripts
|
# Export the variable to run scripts
|
||||||
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
||||||
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
||||||
@@ -26,8 +26,9 @@ done
|
|||||||
# Set timezone #
|
# Set timezone #
|
||||||
################
|
################
|
||||||
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
||||||
if [ -f /usr/share/zoneinfo/$TZ ]; then
|
if [ -f /usr/share/zoneinfo/"$TZ" ]; then
|
||||||
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
||||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
|
ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
###################################
|
###################################
|
||||||
# Export all addon options as env #
|
# Export all addon options as env #
|
||||||
###################################
|
###################################
|
||||||
@@ -10,13 +10,13 @@ JSONSOURCE="/data/options.json"
|
|||||||
# Export keys as env variables
|
# Export keys as env variables
|
||||||
# echo "All addon options were exported as variables"
|
# echo "All addon options were exported as variables"
|
||||||
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
||||||
for KEYS in ${arr[@]}; do
|
for KEYS in "${arr[@]}"; do
|
||||||
# export key
|
# export key
|
||||||
VALUE=$(jq .$KEYS ${JSONSOURCE})
|
VALUE=$(jq ."$KEYS" ${JSONSOURCE})
|
||||||
line="${KEYS}=${VALUE//[\"\']/}"
|
line="${KEYS}=${VALUE//[\"\']/}"
|
||||||
# Use locally
|
# Use locally
|
||||||
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
||||||
export $line
|
export line
|
||||||
# Export the variable to run scripts
|
# Export the variable to run scripts
|
||||||
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
||||||
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
||||||
@@ -26,8 +26,9 @@ done
|
|||||||
# Set timezone #
|
# Set timezone #
|
||||||
################
|
################
|
||||||
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
||||||
if [ -f /usr/share/zoneinfo/$TZ ]; then
|
if [ -f /usr/share/zoneinfo/"$TZ" ]; then
|
||||||
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
||||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
|
ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
###################################
|
###################################
|
||||||
# Export all addon options as env #
|
# Export all addon options as env #
|
||||||
###################################
|
###################################
|
||||||
@@ -10,13 +10,13 @@ JSONSOURCE="/data/options.json"
|
|||||||
# Export keys as env variables
|
# Export keys as env variables
|
||||||
# echo "All addon options were exported as variables"
|
# echo "All addon options were exported as variables"
|
||||||
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
||||||
for KEYS in ${arr[@]}; do
|
for KEYS in "${arr[@]}"; do
|
||||||
# export key
|
# export key
|
||||||
VALUE=$(jq .$KEYS ${JSONSOURCE})
|
VALUE=$(jq ."$KEYS" ${JSONSOURCE})
|
||||||
line="${KEYS}=${VALUE//[\"\']/}"
|
line="${KEYS}=${VALUE//[\"\']/}"
|
||||||
# Use locally
|
# Use locally
|
||||||
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
||||||
export $line
|
export line
|
||||||
# Export the variable to run scripts
|
# Export the variable to run scripts
|
||||||
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
||||||
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
||||||
@@ -26,8 +26,9 @@ done
|
|||||||
# Set timezone #
|
# Set timezone #
|
||||||
################
|
################
|
||||||
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
||||||
if [ -f /usr/share/zoneinfo/$TZ ]; then
|
if [ -f /usr/share/zoneinfo/"$TZ" ]; then
|
||||||
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
||||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
|
ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
###################################
|
###################################
|
||||||
# Export all addon options as env #
|
# Export all addon options as env #
|
||||||
###################################
|
###################################
|
||||||
@@ -10,13 +10,13 @@ JSONSOURCE="/data/options.json"
|
|||||||
# Export keys as env variables
|
# Export keys as env variables
|
||||||
# echo "All addon options were exported as variables"
|
# echo "All addon options were exported as variables"
|
||||||
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
||||||
for KEYS in ${arr[@]}; do
|
for KEYS in "${arr[@]}"; do
|
||||||
# export key
|
# export key
|
||||||
VALUE=$(jq .$KEYS ${JSONSOURCE})
|
VALUE=$(jq ."$KEYS" ${JSONSOURCE})
|
||||||
line="${KEYS}=${VALUE//[\"\']/}"
|
line="${KEYS}=${VALUE//[\"\']/}"
|
||||||
# Use locally
|
# Use locally
|
||||||
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
||||||
export $line
|
export line
|
||||||
# Export the variable to run scripts
|
# Export the variable to run scripts
|
||||||
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
||||||
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
||||||
@@ -26,8 +26,9 @@ done
|
|||||||
# Set timezone #
|
# Set timezone #
|
||||||
################
|
################
|
||||||
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
||||||
if [ -f /usr/share/zoneinfo/$TZ ]; then
|
if [ -f /usr/share/zoneinfo/"$TZ" ]; then
|
||||||
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
||||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
|
ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
33
whoogle/rootfs/scripts/00-global_var.sh
Normal file
33
whoogle/rootfs/scripts/00-global_var.sh
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
###################################
|
||||||
|
# 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 ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
||||||
|
export line
|
||||||
|
# Export the variable to run scripts
|
||||||
|
line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
|
||||||
|
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run*
|
||||||
|
done
|
||||||
|
|
||||||
|
################
|
||||||
|
# Set timezone #
|
||||||
|
################
|
||||||
|
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
||||||
|
if [ -f /usr/share/zoneinfo/"$TZ" ]; then
|
||||||
|
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
||||||
|
ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone
|
||||||
|
fi
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user