mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-11 01:55:59 +02:00
lint
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
#!/usr/bin/env bashio
|
#!/usr/bin/env bashio
|
||||||
|
|
||||||
CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
||||||
CONFIGSOURCE="$(dirname $CONFIGSOURCE)"
|
CONFIGSOURCE="$(dirname "$CONFIGSOURCE")"
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# CONFIG IMPORT #
|
# CONFIG IMPORT #
|
||||||
#################
|
#################
|
||||||
|
|
||||||
if [ $(ls -A "$CONFIGSOURCE/configurations") ]; then
|
if [ "$(ls -A "$CONFIGSOURCE/configurations")" ]; then
|
||||||
bashio::log.info "Configurations were found in $CONFIGSOURCE/configurations, they will be loaded."
|
bashio::log.info "Configurations were found in $CONFIGSOURCE/configurations, they will be loaded."
|
||||||
JSON_CONFIGURATION_DIR="$CONFIGSOURCE/configurations"
|
JSON_CONFIGURATION_DIR="$CONFIGSOURCE/configurations"
|
||||||
export JSON_CONFIGURATION_DIR
|
export JSON_CONFIGURATION_DIR
|
||||||
@@ -18,38 +18,38 @@ fi
|
|||||||
################
|
################
|
||||||
|
|
||||||
if bashio::config.has_value 'Updates'; then
|
if bashio::config.has_value 'Updates'; then
|
||||||
|
|
||||||
if [ "$(ls -A ${CONFIGSOURCE}/import_files)" ]; then
|
if [ "$(ls -A "${CONFIGSOURCE}"/import_files)" ]; then
|
||||||
# Align update with options
|
# Align update with options
|
||||||
echo ""
|
echo ""
|
||||||
FREQUENCY=$(bashio::config 'Updates')
|
FREQUENCY=$(bashio::config 'Updates')
|
||||||
bashio::log.info "$FREQUENCY updates"
|
bashio::log.info "$FREQUENCY updates"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Sets cron // do not delete this message
|
# Sets cron // do not delete this message
|
||||||
cp /templates/cronupdate /etc/cron."${FREQUENCY}"/
|
cp /templates/cronupdate /etc/cron."${FREQUENCY}"/
|
||||||
chmod 777 /etc/cron."${FREQUENCY}"/cronupdate
|
chmod 777 /etc/cron."${FREQUENCY}"/cronupdate
|
||||||
|
|
||||||
# Sets cron to run with www-data user
|
# Sets cron to run with www-data user
|
||||||
# sed -i 's|root|www-data|g' /etc/crontab
|
# sed -i 's|root|www-data|g' /etc/crontab
|
||||||
|
|
||||||
# Starts cron
|
# Starts cron
|
||||||
service cron start
|
service cron start
|
||||||
|
|
||||||
# Export variables
|
# Export variables
|
||||||
IMPORT_DIR_WHITELIST="${CONFIGSOURCE}/import_files"
|
IMPORT_DIR_WHITELIST="${CONFIGSOURCE}/import_files"
|
||||||
export IMPORT_DIR_WHITELIST
|
export IMPORT_DIR_WHITELIST
|
||||||
|
|
||||||
bashio::log.info "Automatic updates were requested. The files in ${CONFIGSOURCE}/import_files will be imported $FREQUENCY."
|
bashio::log.info "Automatic updates were requested. The files in ${CONFIGSOURCE}/import_files will be imported $FREQUENCY."
|
||||||
|
|
||||||
else
|
else
|
||||||
bashio::log.fatal "Automatic updates were requested, but there are no configuration files in ${CONFIGSOURCE}/import_files. There will therefore be be no automatic updates."
|
bashio::log.fatal "Automatic updates were requested, but there are no configuration files in ${CONFIGSOURCE}/import_files. There will therefore be be no automatic updates."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
bashio::log.info "Automatic updates not set in addon config. If you add configuration files in ${CONFIGSOURCE}/import_files, they won't be automatically updated."
|
bashio::log.info "Automatic updates not set in addon config. If you add configuration files in ${CONFIGSOURCE}/import_files, they won't be automatically updated."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##############
|
##############
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
for k in $(bashio::jq "${__BASHIO_ADDON_CONFIG}" 'keys | .[]'); do
|
|
||||||
printf "$(bashio::config $k)" >/var/run/s6/container_environment/$k
|
|
||||||
done
|
|
||||||
Reference in New Issue
Block a user