diff --git a/telegraf/entrypoint.sh b/telegraf/entrypoint.sh index f26d685..b2d29dd 100755 --- a/telegraf/entrypoint.sh +++ b/telegraf/entrypoint.sh @@ -11,22 +11,5 @@ else # Allow telegraf to send ICMP packets and bind to privliged ports setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf" - echo "env" - env - echo " ############################## " - - echo "ls /" - ls / - echo " ############################## " - - - echo "find /config" - find /config - echo " ############################## " - echo "find /addons" - find /addons - echo " ############################## " - - exec setpriv --reuid telegraf --init-groups "$@" fi \ No newline at end of file diff --git a/telegraf/rootfs/etc/conf-init.d/00-banner.sh b/telegraf/rootfs/etc/conf-init.d/00-banner.sh new file mode 100755 index 0000000..c031ad8 --- /dev/null +++ b/telegraf/rootfs/etc/conf-init.d/00-banner.sh @@ -0,0 +1,37 @@ +#!/command/with-contenv bashio +# ============================================================================== +# Home Assistant Community Add-on: Base Images +# Displays a simple add-on banner on startup +# ============================================================================== +if bashio::supervisor.ping; then + bashio::log.blue \ + '-----------------------------------------------------------' + bashio::log.blue " Add-on: $(bashio::addon.name)" + bashio::log.blue " $(bashio::addon.description)" + bashio::log.blue \ + '-----------------------------------------------------------' + + bashio::log.blue " Add-on version: $(bashio::addon.version)" + if bashio::var.true "$(bashio::addon.update_available)"; then + bashio::log.magenta ' There is an update available for this add-on!' + bashio::log.magenta \ + " Latest add-on version: $(bashio::addon.version_latest)" + bashio::log.magenta ' Please consider upgrading as soon as possible.' + else + bashio::log.green ' You are running the latest version of this add-on.' + fi + + bashio::log.blue " System: $(bashio::info.operating_system)" \ + " ($(bashio::info.arch) / $(bashio::info.machine))" + bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)" + bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)" + + bashio::log.blue \ + '-----------------------------------------------------------' + bashio::log.blue \ + ' Please, share the above information when looking for help' + bashio::log.blue \ + ' or support in, e.g., GitHub, forums or the Discord chat.' + bashio::log.blue \ + '-----------------------------------------------------------' +fi \ No newline at end of file diff --git a/telegraf/rootfs/etc/conf-init.d/01-log-level.sh b/telegraf/rootfs/etc/conf-init.d/01-log-level.sh new file mode 100755 index 0000000..47b46eb --- /dev/null +++ b/telegraf/rootfs/etc/conf-init.d/01-log-level.sh @@ -0,0 +1,46 @@ +#!/command/with-contenv bashio +# ============================================================================== +# Home Assistant Community Add-on: Base Images +# Sets the log level correctly +# ============================================================================== +declare log_level + +# Check if the log level configuration option exists +if bashio::config.exists log_level; then + + # Find the matching LOG_LEVEL + log_level=$(bashio::string.lower "$(bashio::config log_level)") + case "${log_level}" in + all) + log_level="${__BASHIO_LOG_LEVEL_ALL}" + ;; + trace) + log_level="${__BASHIO_LOG_LEVEL_TRACE}" + ;; + debug) + log_level="${__BASHIO_LOG_LEVEL_DEBUG}" + ;; + info) + log_level="${__BASHIO_LOG_LEVEL_INFO}" + ;; + notice) + log_level="${__BASHIO_LOG_LEVEL_NOTICE}" + ;; + warning) + log_level="${__BASHIO_LOG_LEVEL_WARNING}" + ;; + error) + log_level="${__BASHIO_LOG_LEVEL_ERROR}" + ;; + fatal) + log_level="${__BASHIO_LOG_LEVEL_FATAL}" + ;; + off) + log_level="${__BASHIO_LOG_LEVEL_OFF}" + ;; + *) + bashio::exit.nok "Unknown log_level: ${log_level}" + esac + + bashio::log.blue "Log level is set to ${__BASHIO_LOG_LEVELS[$log_level]}" +fi \ No newline at end of file diff --git a/telegraf/rootfs/etc/conf-init.d/02-set-timezone.sh b/telegraf/rootfs/etc/conf-init.d/02-set-timezone.sh new file mode 100755 index 0000000..35b0336 --- /dev/null +++ b/telegraf/rootfs/etc/conf-init.d/02-set-timezone.sh @@ -0,0 +1,11 @@ +#!/command/with-contenv bashio +# ============================================================================== +# Home Assistant Community Add-on: Base Images +# Configures the timezone +# ============================================================================== +if ! bashio::var.is_empty "${TZ}"; then + bashio::log.info "Configuring timezone" + + ln --symbolic --no-dereference --force "/usr/share/zoneinfo/${TZ}" /etc/localtime + echo "${TZ}" > /etc/timezone +fi \ No newline at end of file