Add container timezone management for birdnet-pipy addon

- New init script 02-timezone.sh: reads TZ from addon config, validates
  against /usr/share/zoneinfo, applies to container (/etc/localtime,
  /etc/timezone, s6 container env)
- Change default TZ from Etc/UTC to Europe/Paris
- Increment version to 0.5.6-2
- Update CHANGELOG.md and DOCS.md

Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-11 07:12:45 +00:00
parent fae90f0614
commit 742e2ce52e
4 changed files with 33 additions and 3 deletions

View File

@@ -0,0 +1,26 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -euo pipefail
# Use timezone defined in add-on options
bashio::log.info "Setting timezone..."
TZ_VALUE="$(bashio::config 'TZ' || true)"
TZ_VALUE="${TZ_VALUE:-Europe/Paris}"
if [ ! -f "/usr/share/zoneinfo/${TZ_VALUE}" ]; then
bashio::log.warning "Invalid timezone '${TZ_VALUE}'. Falling back to Europe/Paris."
bashio::log.warning "See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for valid values."
TZ_VALUE="Europe/Paris"
fi
# Apply timezone to the container
ln -sf "/usr/share/zoneinfo/${TZ_VALUE}" /etc/localtime
echo "${TZ_VALUE}" > /etc/timezone
export TZ="${TZ_VALUE}"
# Update s6 container environment so child processes inherit the timezone
if [ -d /var/run/s6/container_environment ]; then
echo "${TZ_VALUE}" > /var/run/s6/container_environment/TZ
fi
bashio::log.notice "Timezone set to: ${TZ_VALUE}"